`json_extract_scalar` works but `json_extract_inde...
# troubleshooting
m
json_extract_scalar
works but
json_extract_index
doesn't
Copy code
SELECT JSON_EXTRACT_SCALAR(column_name, '$.key_name', 'STRING', '')
FROM table_name where id = 1;

SELECT JSON_EXTRACT_INDEX(column_name, '$.key_name', 'STRING', '')
FROM table_name where id = 1;
The first query returns the correct answer (the key exists for the id), however, the second one fails with the following error –
Copy code
Error Code: 200

QueryExecutionError:
Received error query execution result block: {200=QueryExecutionError:
java.lang.NullPointerException}
org.apache.pinot.query.service.dispatch.QueryDispatcher.runReducer(QueryDispatcher.java:462)
org.apache.pinot.query.service.dispatch.QueryDispatcher.submitAndReduce(QueryDispatcher.java:133)
org.apache.pinot.broker.requesthandler.MultiStageBrokerRequestHandler.handleRequest(MultiStageBrokerRequestHandler.java:255)
org.apache.pinot.broker.requesthandler.BaseBrokerRequestHandler.handleRequest(BaseBrokerRequestHandler.java:168)
Changing the
root
log level to
DEBUG
or
TRACE
for the broker does not give any more information. The column is defined as
JSON
in the schema, here's the
fieldConfig
–
Copy code
{
  "name": "column_name",
  "encodingType": "DICTIONARY",
  "indexType": "JSON",
  "indexTypes": [
    "JSON"
  ],
  "indexes": {
    "json": {
      "maxLevels": -1,
      "excludeArray": false,
      "disableCrossArrayUnnest": true,
      "includePaths": null,
      "excludePaths": null,
      "excludeFields": null,
      "indexPaths": null
    }
  },
  "tierOverwrites": null
}
The above error was on version 1.4. On the latest stable release 1.3, the error is –
Copy code
Error Code: 200

QueryExecutionError:
Received error query execution result block: {200=QueryExecutionError:
java.lang.NullPointerException: Cannot invoke "java.util.List.iterator()" because "this._arguments" is null
	at org.apache.pinot.core.operator.transform.function.BaseTransformFunction.getNullBitmap(BaseTransformFunction.java:785)
	at org.apache.pinot.core.operator.docvalsets.TransformBlockValSet.getNullBitmap(TransformBlockValSet.java:59)
	at org.apache.pinot.core.operator.streaming.StreamingSelectionOnlyOperator.getNextBlock(StreamingSelectionOnlyOperator.java:108)
	at org.apache.pinot.core.operator.streaming.StreamingSelectionOnlyOperator.getNextBlock(StreamingSelectionOnlyOperator.java:48)}
org.apache.pinot.query.service.dispatch.QueryDispatcher.runReducer(QueryDispatcher.java:454)
org.apache.pinot.query.service.dispatch.QueryDispatcher.submitAndReduce(QueryDispatcher.java:133)
org.apache.pinot.broker.requesthandler.MultiStageBrokerRequestHandler.handleRequest(MultiStageBrokerRequestHandler.java:255)
org.apache.pinot.broker.requesthandler.BaseBrokerRequestHandler.handleRequest(BaseBrokerRequestHandler.java:168)