Github user jackylk commented on a diff in the pull request:

    https://github.com/apache/incubator-carbondata/pull/528#discussion_r95956920
  
    --- Diff: 
integration/spark2/src/main/scala/org/apache/spark/sql/hive/CarbonMetastore.scala
 ---
    @@ -782,7 +781,49 @@ case class CarbonRelation(
             nullable = true)())
       }
     
    -  override val output = dimensionsAttr ++ measureAttr
    +  override val output = {
    +    val columns = 
tableMeta.carbonTable.getCreateOrderColumn(tableMeta.carbonTable.getFactTableName)
    +      .asScala
    +    columns.filter(!_.isInvisible).map { column =>
    +      if (column.isDimesion()) {
    +        val output: DataType = column.getDataType.toString.toLowerCase 
match {
    +          case "array" =>
    +            
CarbonMetastoreTypes.toDataType(s"array<${getArrayChildren(column.getColName)}>")
    +          case "struct" =>
    +            
CarbonMetastoreTypes.toDataType(s"struct<${getStructChildren(column.getColName)}>")
    +          case dType =>
    +            val dataType = addDecimalScaleAndPrecision(column, dType)
    +            CarbonMetastoreTypes.toDataType(dataType)
    +        }
    +        AttributeReference(column.getColName, output,
    +          nullable = true
    +        )(qualifier = Option(tableName + "." + column.getColName))
    +      } else {
    +        AttributeReference(column.getColName, 
CarbonMetastoreTypes.toDataType(
    +          column.getDataType.toString
    +            .toLowerCase match {
    +            case "int" => "long"
    +            case "short" => "long"
    +            case "decimal" => "decimal(" + 
column.getColumnSchema.getPrecision + "," + column
    +              .getColumnSchema.getScale + ")"
    +            case others => others
    +          }
    +        ),
    +          nullable = true
    +        )(qualifier = Option(tableName + "." + column.getColName))
    +      }
    +    }
    +  }
    +
    +  def addDecimalScaleAndPrecision(dimval: CarbonColumn, dataType: String): 
String = {
    +    var dType = dataType
    +    if (dimval.getDataType
    +        == 
org.apache.carbondata.core.carbon.metadata.datatype.DataType.DECIMAL) {
    --- End diff --
    
    remove the explicit package name


---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to