carbondata-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jackylk <...@git.apache.org>
Subject [GitHub] incubator-carbondata pull request #795: [CARBONDATA-923] Fix issue of insert...
Date Wed, 26 Apr 2017 20:39:24 GMT
Github user jackylk commented on a diff in the pull request:

    https://github.com/apache/incubator-carbondata/pull/795#discussion_r113556768
  
    --- Diff: integration/spark2/src/main/scala/org/apache/spark/sql/hive/CarbonAnalysisRules.scala
---
    @@ -52,7 +53,26 @@ object CarbonPreInsertionCasts extends Rule[LogicalPlan] {
             )
         }
         if (child.output.size >= relation.carbonRelation.output.size) {
    -      InsertIntoCarbonTable(relation, p.partition, p.child, p.overwrite, p.ifNotExists)
    +      var index = 0
    +      val newChildOutput = child.output.map { column =>
    +        index = index + 1
    +        column match {
    +          case attr: Alias =>
    +            Alias(attr.child, s"col$index")(attr.exprId)
    +          case attr: Attribute =>
    +            Alias(attr, s"col$index")(NamedExpression.newExprId)
    +          case attr => attr
    +        }
    +      }
    +      if (newChildOutput == child.output) {
    +        InsertIntoCarbonTable(relation, p.partition, p.child, p.overwrite, p.ifNotExists)
    +      } else {
    +        InsertIntoCarbonTable(relation,
    +          p.partition,
    +          Project(newChildOutput, child),
    --- End diff --
    
    I think you can move the creation of `InsertIntoCarbonTable` below else clause, so that
it will take care of both if and else case. Only one parameter is different.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message