carbondata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ravipes...@apache.org
Subject [12/47] incubator-carbondata git commit: [CARBONDATA-97] Decimal Precision and scale is not getting applied based on schema metadata. (#843)
Date Mon, 01 Aug 2016 10:05:10 GMT
[CARBONDATA-97] Decimal Precision and scale is not getting applied based on schema metadata.
(#843)



Project: http://git-wip-us.apache.org/repos/asf/incubator-carbondata/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-carbondata/commit/fb8d8070
Tree: http://git-wip-us.apache.org/repos/asf/incubator-carbondata/tree/fb8d8070
Diff: http://git-wip-us.apache.org/repos/asf/incubator-carbondata/diff/fb8d8070

Branch: refs/heads/master
Commit: fb8d80704068899c3da104c76f5e0a007e7c2305
Parents: c3197a8
Author: sujith71955 <sujithchacko.2010@gmail.com>
Authored: Sat Jul 23 14:01:29 2016 +0530
Committer: Venkata Ramana G <g.ramana.v1@gmail.com>
Committed: Sat Jul 23 14:01:29 2016 +0530

----------------------------------------------------------------------
 .../apache/spark/sql/CarbonDatasourceRelation.scala   | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/fb8d8070/integration/spark/src/main/scala/org/apache/spark/sql/CarbonDatasourceRelation.scala
----------------------------------------------------------------------
diff --git a/integration/spark/src/main/scala/org/apache/spark/sql/CarbonDatasourceRelation.scala
b/integration/spark/src/main/scala/org/apache/spark/sql/CarbonDatasourceRelation.scala
index 3035a47..ed4e6cb 100644
--- a/integration/spark/src/main/scala/org/apache/spark/sql/CarbonDatasourceRelation.scala
+++ b/integration/spark/src/main/scala/org/apache/spark/sql/CarbonDatasourceRelation.scala
@@ -203,14 +203,22 @@ case class CarbonRelation(
       cubeMeta.carbonTable.getDimensionByTableName(cubeMeta.carbonTableIdentifier.getTableName)
         .asScala.asJava)
     sett.asScala.toSeq.filter(!_.getColumnSchema.isInvisible).map(dim => {
-      val output: DataType = metaData.carbonTable
-        .getDimensionByName(metaData.carbonTable.getFactTableName, dim.getColName).getDataType
+      val dimval = metaData.carbonTable
+        .getDimensionByName(metaData.carbonTable.getFactTableName, dim.getColName)
+      val output: DataType = dimval.getDataType
         .toString.toLowerCase match {
         case "array" => CarbonMetastoreTypes
           .toDataType(s"array<${ getArrayChildren(dim.getColName) }>")
         case "struct" => CarbonMetastoreTypes
           .toDataType(s"struct<${ getStructChildren(dim.getColName) }>")
-        case dType => CarbonMetastoreTypes.toDataType(dType)
+        case dType =>
+          var dataType = dType
+          if (dimval.getDataType == org.carbondata.core.carbon.metadata.datatype.DataType.DECIMAL)
{
+            dataType +=
+              "(" + dimval.getColumnSchema.getPrecision + "," + dimval.getColumnSchema
+                .getScale + ")"
+          }
+          CarbonMetastoreTypes.toDataType(dataType)
       }
 
       AttributeReference(


Mime
View raw message