saurabhd336 commented on code in PR #12532:
URL: https://github.com/apache/pinot/pull/12532#discussion_r1533278462
##########
pinot-core/src/main/java/org/apache/pinot/core/operator/transform/function/JsonExtractIndexTransformFunction.java:
##########
@@ -90,15 +90,12 @@ public void init(List<TransformFunction> arguments,
Map<String, ColumnContext> c
}
String resultsType = ((LiteralTransformFunction)
thirdArgument).getStringLiteral().toUpperCase();
boolean isSingleValue = !resultsType.endsWith("_ARRAY");
- // TODO: will support array type; the underlying
jsonIndexReader.getMatchingDocsMap supports the json path [*]
- if (!isSingleValue) {
- throw new IllegalArgumentException("jsonExtractIndex only supports
single value type");
- }
if (isSingleValue && inputJsonPath.contains("[*]")) {
- throw new IllegalArgumentException("[*] syntax in json path is
unsupported as json_extract_index"
- + "currently does not support returning array types");
+ throw new IllegalArgumentException(
+ "[*] syntax in json path is unsupported for singleValue field
json_extract_index");
}
- DataType dataType = DataType.valueOf(resultsType);
+ DataType dataType = isSingleValue ? DataType.valueOf(resultsType)
+ : DataType.valueOf(resultsType.substring(0, resultsType.length() - 6));
if (arguments.size() == 4) {
Review Comment:
The filter functionality has now been moved to a new PR
(https://github.com/apache/pinot/pull/12682)
As for the default value, for MV if nothing matches, I just return an empty
array.
--
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]