carbondata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jack...@apache.org
Subject [1/2] incubator-carbondata git commit: new code for carbondata-513, fix conflicts
Date Wed, 07 Dec 2016 11:13:38 GMT
Repository: incubator-carbondata
Updated Branches:
  refs/heads/master 5612a3a59 -> 8275640e0


new code for carbondata-513, fix conflicts

fix checkstyle


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

Branch: refs/heads/master
Commit: f853998fba87791889654b3a43a9577f9907200a
Parents: 5612a3a
Author: piaoyats <tongsuo@huawei.com>
Authored: Wed Dec 7 17:33:24 2016 +0800
Committer: jackylk <jacky.likun@huawei.com>
Committed: Wed Dec 7 19:10:37 2016 +0800

----------------------------------------------------------------------
 .../org/apache/carbondata/core/util/DataTypeUtil.java   | 11 ++---------
 .../collector/impl/AbstractScannedResultCollector.java  | 12 ++++--------
 .../apache/carbondata/core/util/DataTypeUtilTest.java   |  6 +++++-
 .../org/apache/spark/sql/SparkUnknownExpression.scala   |  6 +-----
 .../org/apache/spark/sql/SparkUnknownExpression.scala   |  5 +----
 5 files changed, 13 insertions(+), 27 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/f853998f/core/src/main/java/org/apache/carbondata/core/util/DataTypeUtil.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/carbondata/core/util/DataTypeUtil.java b/core/src/main/java/org/apache/carbondata/core/util/DataTypeUtil.java
index b97fd92..d179fca 100644
--- a/core/src/main/java/org/apache/carbondata/core/util/DataTypeUtil.java
+++ b/core/src/main/java/org/apache/carbondata/core/util/DataTypeUtil.java
@@ -266,10 +266,7 @@ public final class DataTypeUtil {
             return null;
           }
           java.math.BigDecimal javaDecVal = new java.math.BigDecimal(data);
-          scala.math.BigDecimal scalaDecVal = new scala.math.BigDecimal(javaDecVal);
-          org.apache.spark.sql.types.Decimal decConverter =
-              new org.apache.spark.sql.types.Decimal();
-          return decConverter.set(scalaDecVal);
+          return org.apache.spark.sql.types.Decimal.apply(javaDecVal);
         default:
           return UTF8String.fromString(data);
       }
@@ -292,11 +289,7 @@ public final class DataTypeUtil {
         case LONG:
           return data;
         case DECIMAL:
-          java.math.BigDecimal javaDecVal = new java.math.BigDecimal(data.toString());
-          scala.math.BigDecimal scalaDecVal = new scala.math.BigDecimal(javaDecVal);
-          org.apache.spark.sql.types.Decimal decConverter =
-              new org.apache.spark.sql.types.Decimal();
-          return decConverter.set(scalaDecVal);
+          return org.apache.spark.sql.types.Decimal.apply((java.math.BigDecimal) data);
         default:
           return data;
       }

http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/f853998f/core/src/main/java/org/apache/carbondata/scan/collector/impl/AbstractScannedResultCollector.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/carbondata/scan/collector/impl/AbstractScannedResultCollector.java
b/core/src/main/java/org/apache/carbondata/scan/collector/impl/AbstractScannedResultCollector.java
index 90d4bd7..ad52b5e 100644
--- a/core/src/main/java/org/apache/carbondata/scan/collector/impl/AbstractScannedResultCollector.java
+++ b/core/src/main/java/org/apache/carbondata/scan/collector/impl/AbstractScannedResultCollector.java
@@ -25,7 +25,6 @@ import org.apache.carbondata.common.logging.LogServiceFactory;
 import org.apache.carbondata.core.carbon.datastore.chunk.MeasureColumnDataChunk;
 import org.apache.carbondata.core.carbon.metadata.datatype.DataType;
 import org.apache.carbondata.core.keygenerator.KeyGenException;
-import org.apache.carbondata.core.util.DataTypeUtil;
 import org.apache.carbondata.scan.collector.ScannedResultCollector;
 import org.apache.carbondata.scan.executor.infos.BlockExecutionInfo;
 import org.apache.carbondata.scan.executor.infos.KeyStructureInfo;
@@ -100,20 +99,17 @@ public abstract class AbstractScannedResultCollector implements ScannedResultCol
 
   private Object getMeasureData(MeasureColumnDataChunk dataChunk, int index, DataType dataType)
{
     if (!dataChunk.getNullValueIndexHolder().getBitSet().get(index)) {
-      Object msrVal;
       switch (dataType) {
         case SHORT:
         case INT:
         case LONG:
-          msrVal = dataChunk.getMeasureDataHolder().getReadableLongValueByIndex(index);
-          break;
+          return dataChunk.getMeasureDataHolder().getReadableLongValueByIndex(index);
         case DECIMAL:
-          msrVal = dataChunk.getMeasureDataHolder().getReadableBigDecimalValueByIndex(index);
-          break;
+          return  org.apache.spark.sql.types.Decimal.apply(
+                  dataChunk.getMeasureDataHolder().getReadableBigDecimalValueByIndex(index));
         default:
-          msrVal = dataChunk.getMeasureDataHolder().getReadableDoubleValueByIndex(index);
+          return  dataChunk.getMeasureDataHolder().getReadableDoubleValueByIndex(index);
       }
-      return DataTypeUtil.getMeasureDataBasedOnDataType(msrVal, dataType);
     }
     return null;
   }

http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/f853998f/core/src/test/java/org/apache/carbondata/core/util/DataTypeUtilTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/carbondata/core/util/DataTypeUtilTest.java b/core/src/test/java/org/apache/carbondata/core/util/DataTypeUtilTest.java
index dd0662b..d3a3604 100644
--- a/core/src/test/java/org/apache/carbondata/core/util/DataTypeUtilTest.java
+++ b/core/src/test/java/org/apache/carbondata/core/util/DataTypeUtilTest.java
@@ -117,7 +117,11 @@ public class DataTypeUtilTest {
     scala.math.BigDecimal scalaDecVal = new scala.math.BigDecimal(javaDecVal);
     org.apache.spark.sql.types.Decimal expected =
         new org.apache.spark.sql.types.Decimal().set(scalaDecVal);
-    assertEquals(getMeasureDataBasedOnDataType(1, DataType.DECIMAL), expected);
+    assertEquals(
+            getMeasureDataBasedOnDataType(
+                    new java.math.BigDecimal(1),
+                    DataType.DECIMAL),
+            expected);
     assertEquals(getMeasureDataBasedOnDataType("1", DataType.STRING), "1");
   }
 

http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/f853998f/integration/spark/src/main/scala/org/apache/spark/sql/SparkUnknownExpression.scala
----------------------------------------------------------------------
diff --git a/integration/spark/src/main/scala/org/apache/spark/sql/SparkUnknownExpression.scala
b/integration/spark/src/main/scala/org/apache/spark/sql/SparkUnknownExpression.scala
index 89e1aa9..bf8d9b5 100644
--- a/integration/spark/src/main/scala/org/apache/spark/sql/SparkUnknownExpression.scala
+++ b/integration/spark/src/main/scala/org/apache/spark/sql/SparkUnknownExpression.scala
@@ -42,11 +42,7 @@ class SparkUnknownExpression(var sparkExp: SparkExpression)
 
     val values = carbonRowInstance.getValues.toSeq.map {
       case s: String => org.apache.spark.unsafe.types.UTF8String.fromString(s)
-      case d: java.math.BigDecimal =>
-        val javaDecVal = new java.math.BigDecimal(d.toString)
-        val scalaDecVal = new scala.math.BigDecimal(javaDecVal)
-        val decConverter = new org.apache.spark.sql.types.Decimal()
-        decConverter.set(scalaDecVal)
+      case d: java.math.BigDecimal => org.apache.spark.sql.types.Decimal.apply(d)
       case value => value
     }
     try {

http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/f853998f/integration/spark2/src/main/scala/org/apache/spark/sql/SparkUnknownExpression.scala
----------------------------------------------------------------------
diff --git a/integration/spark2/src/main/scala/org/apache/spark/sql/SparkUnknownExpression.scala
b/integration/spark2/src/main/scala/org/apache/spark/sql/SparkUnknownExpression.scala
index 284af3d..1a310c7 100644
--- a/integration/spark2/src/main/scala/org/apache/spark/sql/SparkUnknownExpression.scala
+++ b/integration/spark2/src/main/scala/org/apache/spark/sql/SparkUnknownExpression.scala
@@ -43,10 +43,7 @@ class SparkUnknownExpression(var sparkExp: SparkExpression)
     val values = carbonRowInstance.getValues.toSeq.map {
       case s: String => org.apache.spark.unsafe.types.UTF8String.fromString(s)
       case d: java.math.BigDecimal =>
-        val javaDecVal = new java.math.BigDecimal(d.toString)
-        val scalaDecVal = new scala.math.BigDecimal(javaDecVal)
-        val decConverter = new org.apache.spark.sql.types.Decimal()
-        decConverter.set(scalaDecVal)
+        org.apache.spark.sql.types.Decimal.apply(d)
       case value => value
     }
     try {


Mime
View raw message