Login  Register

[GitHub] [carbondata] ajantha-bhat commented on a change in pull request #4073: [CARBONDATA-4104] Vector filling for complex decimal type needs to be handled

Posted by GitBox on Jan 29, 2021; 5:53am
URL: http://apache-carbondata-dev-mailing-list-archive.168.s1.nabble.com/GitHub-carbondata-akkio-97-opened-a-new-pull-request-4073-WIP-tp105327p105763.html


ajantha-bhat commented on a change in pull request #4073:
URL: https://github.com/apache/carbondata/pull/4073#discussion_r566594846



##########
File path: core/src/main/java/org/apache/carbondata/core/metadata/datatype/DecimalConverterFactory.java
##########
@@ -141,72 +151,48 @@ public void fillVector(Object valuesToBeConverted, int size,
         // for string, varchar, binary, date, decimal types
         lengthStoredInBytes = shortSizeInBytes;
       }
-      byte[] data = (byte[]) valuesToBeConverted;
-      if (pageType == DataTypes.BYTE) {
-        for (int i = 0; i < size; i++) {
-          if (nullBitSet.get(i)) {
-            vector.putNull(i);
-          } else {
-            BigDecimal value = BigDecimal.valueOf(data[i], scale);
-            if (value.scale() < newMeasureScale) {
-              value = value.setScale(newMeasureScale);
-            }
-            vector.putDecimal(i, value, precision);
-          }
-        }
-      } else if (pageType == DataTypes.SHORT) {
-        for (int i = 0; i < size; i++) {
-          if (nullBitSet.get(i)) {
-            vector.putNull(i);
-          } else {
-            BigDecimal value = BigDecimal
-                .valueOf(ByteUtil.toShortLittleEndian(data, i * shortSizeInBytes),
-                    scale);
-            if (value.scale() < newMeasureScale) {
-              value = value.setScale(newMeasureScale);
-            }
-            vector.putDecimal(i, value, precision);
-          }
-        }
-      } else if (pageType == DataTypes.SHORT_INT) {
-        int shortIntSizeInBytes = DataTypes.SHORT_INT.getSizeInBytes();
+      if (this instanceof DecimalUnscaledConverter && scale < newMeasureScale) {
+        scale = newMeasureScale;
+      }
+      if (valuesToBeConverted instanceof byte[][]) {

Review comment:
       revert this change as discussed.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[hidden email]