xiangfu0 commented on code in PR #19247:
URL: https://github.com/apache/pinot/pull/19247#discussion_r3857799603
##########
pinot-core/src/main/java/org/apache/pinot/core/operator/transform/function/ArrayLiteralTransformFunction.java:
##########
@@ -119,12 +135,26 @@ public
ArrayLiteralTransformFunction(List<ExpressionContext> literalContexts) {
_floatArrayLiteral = new float[0];
_doubleArrayLiteral = new double[0];
_stringArrayLiteral = new String[0];
+ _bytesArrayLiteral = new byte[0][];
return;
}
for (ExpressionContext literalContext : literalContexts) {
Preconditions.checkState(literalContext.getType() ==
ExpressionContext.Type.LITERAL,
"ArrayLiteralTransformFunction only takes literals as arguments,
found: %s", literalContext);
}
+ boolean containsBytes = false;
+ for (ExpressionContext literalContext : literalContexts) {
+ if (literalContext.getLiteral().getType() == DataType.BYTES) {
+ containsBytes = true;
+ break;
+ }
+ }
+ if (containsBytes) {
+ for (ExpressionContext literalContext : literalContexts) {
+ Preconditions.checkState(literalContext.getLiteral().getType() ==
DataType.BYTES,
+ "BYTES array literals only support non-null BYTES elements, found:
%s", literalContext);
+ }
+ }
Review Comment:
Fixed in 4a5a98b95a. Removed the BYTES-only whole-array homogeneous-element
precheck and its special-case unit assertion, so ArrayLiteralTransformFunction
now follows the same first-element dispatch convention as other array types.
The E2E invalid-element coverage remains in BytesMvTypeTest and passes on both
query engines.
##########
pinot-query-runtime/src/main/java/org/apache/pinot/query/runtime/operator/utils/TypeUtils.java:
##########
@@ -132,6 +132,14 @@ public static Object convert(Object value, ColumnDataType
storedType) {
// For ArrayAggregationFunction
return ArrayListUtils.toBytesArray((ObjectArrayList<ByteArray>)
value);
}
+ if (value instanceof byte[][]) {
Review Comment:
Fixed in 4a5a98b95a. This branch was hit because generic FunctionOperand
externalizes BYTES operands and the Object-returning array constructor produced
byte[][]. That exposed a missing normalization at OBJECT.toInternal(). I moved
byte[][] to ByteArray[] conversion there, removed the late TypeUtils fallback
and test, and kept literal and dynamic generic-dispatch tests proving TypeUtils
now receives deterministic ByteArray[]. Focused tests and all six
BytesMvTypeTest E2E cases pass.
--
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]