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 #666: [CARBONDATA-530] Keep the CarbonDeco...
Date Fri, 17 Mar 2017 11:18:24 GMT
Github user jackylk commented on a diff in the pull request:

    https://github.com/apache/incubator-carbondata/pull/666#discussion_r106629326
  
    --- Diff: integration/spark2/src/main/scala/org/apache/spark/sql/CarbonDictionaryDecoder.scala
---
    @@ -371,6 +307,79 @@ case class CarbonDictionaryDecoder(
     
     }
     
    +object CarbonDictionaryDecoder {
    +
    +  def convertOutput(output: Seq[Attribute],
    +      relations: Seq[CarbonDecoderRelation],
    +      profile: CarbonProfile,
    +      aliasMap: CarbonAliasDecoderRelation): Seq[Attribute] = {
    +    output.map { a =>
    +      val attr = aliasMap.getOrElse(a, a)
    +      val relation = relations.find(p => p.contains(attr))
    +      if (relation.isDefined && canBeDecoded(attr, profile)) {
    +        val carbonTable = relation.get.carbonRelation.carbonRelation.metaData.carbonTable
    +        val carbonDimension = carbonTable
    +          .getDimensionByName(carbonTable.getFactTableName, attr.name)
    +        if (carbonDimension != null &&
    +            carbonDimension.hasEncoding(Encoding.DICTIONARY) &&
    +            !carbonDimension.hasEncoding(Encoding.DIRECT_DICTIONARY) &&
    +            !carbonDimension.isComplex()) {
    +          val newAttr = AttributeReference(a.name,
    +            convertCarbonToSparkDataType(carbonDimension,
    +              relation.get.carbonRelation.carbonRelation),
    +            a.nullable,
    +            a.metadata)(a.exprId).asInstanceOf[Attribute]
    +          newAttr
    +        } else {
    +          a
    +        }
    +      } else {
    +        a
    +      }
    +    }
    +  }
    +
    +  def canBeDecoded(attr: Attribute, profile: CarbonProfile): Boolean = {
    --- End diff --
    
    please give some description comment for this function


---
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