[GitHub] [carbondata] QiangCai commented on a change in pull request #3874: [CARBONDATA-3931]Fix Secondary index with index column as DateType giving wrong results

2020-08-10 Thread GitBox


QiangCai commented on a change in pull request #3874:
URL: https://github.com/apache/carbondata/pull/3874#discussion_r468361486



##
File path: 
integration/spark/src/main/java/org/apache/spark/sql/secondaryindex/query/SecondaryIndexQueryResultProcessor.java
##
@@ -259,7 +262,7 @@ private void processResult(List> 
detailQueryResultItera
   CarbonDimension dims = dimensions.get(i);
   if (dims.hasEncoding(Encoding.DICTIONARY)) {
 // dictionary
-preparedRow[i] = factToIndexDictColumnMapping[dictionaryIndex++];
+preparedRow[i] = dictionaryValues[dictionaryIndex++];

Review comment:
   how about adding a method which named 
ByteArrayWrapper.getDictionaryKeyByIndex(int index)?
   





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:
us...@infra.apache.org




[GitHub] [carbondata] QiangCai commented on a change in pull request #3874: [CARBONDATA-3931]Fix Secondary index with index column as DateType giving wrong results

2020-08-06 Thread GitBox


QiangCai commented on a change in pull request #3874:
URL: https://github.com/apache/carbondata/pull/3874#discussion_r466781511



##
File path: 
integration/spark/src/main/scala/org/apache/spark/sql/secondaryindex/query/SecondaryIndexQueryResultProcessor.java
##
@@ -249,10 +249,17 @@ private void processResult(List> 
detailQueryResultItera
   private Object[] prepareRowObjectForSorting(Object[] row) {
 ByteArrayWrapper wrapper = (ByteArrayWrapper) row[0];
 // ByteBuffer[] noDictionaryBuffer = new ByteBuffer[noDictionaryCount];
-
 List dimensions = segmentProperties.getDimensions();
 Object[] preparedRow = new Object[dimensions.size() + measureCount];
 
+// get dictionary values for date type
+byte[] dictionaryKey = wrapper.getDictionaryKey();
+int[] keyArray = ByteUtil.convertBytesToIntArray(dictionaryKey);
+Object[] dictionaryValues = new Object[dimensionColumnCount + 
measureCount];
+for (int i = 0; i < keyArray.length; i++) {
+  dictionaryValues[i] = keyArray[i];

Review comment:
   why do this copy





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:
us...@infra.apache.org