aishikbh opened a new pull request, #13265:
URL: https://github.com/apache/pinot/pull/13265

   # Issue
   
   in `standardize`, we loop through the values if the value itself is an 
instance of Object[] , we process each of the values of `object[]`  and set the 
`isSingleValue`  factor true assuming every value here is `singleValue` and 
again call `standardize` . We will get an exception in the case where the value 
field of a map is multivalued.
   
   Example Code to Recreate the Issue:
   
   ```
   public void testMap() {
       Map<String, List<String>> testMap = new HashMap<>();
       testMap.put("testKey1", Arrays.asList("testValue1", "testValue2"));
       Object[] values = new 
Object[]{Collections.singletonList(Collections.singletonMap("testKey", 
"testValue3")), testMap
       };
       DataTypeTransformer.standardize(COLUMN, values, false);
     }
   ```
   
   Thrown exception :
   
   ```
   java.lang.IllegalStateException: Cannot read single-value from Collection: 
[testValue1, testValue2] for column: testColumn
   
        at 
com.google.common.base.Preconditions.checkState(Preconditions.java:838)
        at 
org.apache.pinot.segment.local.recordtransformer.DataTypeTransformer.standardizeCollection(DataTypeTransformer.java:197)
        at 
org.apache.pinot.segment.local.recordtransformer.DataTypeTransformer.standardize(DataTypeTransformer.java:138)
        at 
org.apache.pinot.segment.local.recordtransformer.DataTypeTransformer.standardizeCollection(DataTypeTransformer.java:181)
        at 
org.apache.pinot.segment.local.recordtransformer.DataTypeTransformer.standardize(DataTypeTransformer.java:141)
        at 
org.apache.pinot.segment.local.recordtransformer.DataTypeTransformer.standardize(DataTypeTransformer.java:154)
        at 
org.apache.pinot.segment.local.recordtransformer.DataTypeTransformerTest.testMap(DataTypeTransformerTest.java:211)
   ```
   
   # Solution
   
   Treat the Map as multivalue where we have value fields of the map as a 
`List` of `Object[]`.


-- 
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.

To unsubscribe, e-mail: [email protected]

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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to