You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pinot.apache.org by GitBox <gi...@apache.org> on 2021/07/28 23:42:06 UTC

[GitHub] [pinot] klsince commented on pull request #7224: cast to Number to convert value between numeric types

klsince commented on pull request #7224:
URL: https://github.com/apache/pinot/pull/7224#issuecomment-888690584


   Came into this issue while using jsonPathArray() during ingestion to extract the `id` field from `labels` JSONArray into a Pinot MV column. The output array from jsonPathArray() has [Int, Int, Long, Int] and led to error saying 'Long can't be cast to Integer' in this [method](https://github.com/apache/pinot/blob/master/pinot-common/src/main/java/org/apache/pinot/common/utils/PinotDataType.java#L246). Casting to `Number` to convert types for those numeric PinotDataType would fix this issue. 
   
   ```
         "labels": [
           {
             "id": 100632567,
   ...
           },
           {
             "id": 100632569,
   ...
           },
           {
             "id": 2910737149,
   ...
           },
           {
             "id": 1260414978,
        ...
           }
         ],
   ```
   
   However, this fix can't handle more complex cases, like numbers, strings, list, maps are mixed in output array from jsonPathArray(). The [complexType](https://docs.pinot.apache.org/basics/data-import/complex-type) might help in those cases.


-- 
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: commits-unsubscribe@pinot.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org