61yao commented on code in PR #10386:
URL: https://github.com/apache/pinot/pull/10386#discussion_r1153776806
##########
pinot-core/src/main/java/org/apache/pinot/core/operator/transform/function/BaseTransformFunction.java:
##########
@@ -617,4 +1261,50 @@ public byte[][][] transformToBytesValuesMV(ValueBlock
valueBlock) {
}
return _bytesValuesMV;
}
+
+ @Override
+ public Pair<byte[][][], RoaringBitmap>
transformToBytesValuesMVWithNull(ValueBlock valueBlock) {
+ int length = valueBlock.getNumDocs();
+ if (_bytesValuesMV == null) {
+ _bytesValuesMV = new byte[length][][];
+ }
+ RoaringBitmap bitmap;
+ DataType resultDataType = getResultMetadata().getDataType();
+ switch (resultDataType) {
+ case UNKNOWN:
+ bitmap = new RoaringBitmap();
+ bitmap.add(0L, length);
+ for (int i = 0; i < length; i++) {
+ _bytesValuesMV[i] = (byte[][])
DataSchema.ColumnDataType.BYTES_ARRAY.getNullPlaceholder();
+ }
+ break;
+ case STRING:
+ Pair<String[][], RoaringBitmap> stringResult =
transformToStringValuesMVWithNull(valueBlock);
+ bitmap = stringResult.getRight();
+ ArrayCopyUtils.copy(stringResult.getLeft(), _bytesValuesMV, length);
+ break;
+ case BYTES:
+ _bytesValuesMV = transformToBytesValuesMV(valueBlock);
+ bitmap = getNullBitmap(valueBlock);
+ break;
+ default:
+ throw new IllegalStateException(String.format("Cannot read MV %s as
bytes", resultDataType));
+ }
+ return ImmutablePair.of(_bytesValuesMV, bitmap);
+ }
+
+ @Override
+ public @Nullable RoaringBitmap getNullBitmap(ValueBlock valueBlock) {
+ if (_arguments == null) {
Review Comment:
yeah. added a TODO. this PR only demos the right usage of null. so not every
transform func is initiated.
##########
pinot-core/src/main/java/org/apache/pinot/core/operator/transform/function/BaseTransformFunction.java:
##########
@@ -617,4 +1261,50 @@ public byte[][][] transformToBytesValuesMV(ValueBlock
valueBlock) {
}
return _bytesValuesMV;
}
+
+ @Override
+ public Pair<byte[][][], RoaringBitmap>
transformToBytesValuesMVWithNull(ValueBlock valueBlock) {
+ int length = valueBlock.getNumDocs();
+ if (_bytesValuesMV == null) {
+ _bytesValuesMV = new byte[length][][];
+ }
+ RoaringBitmap bitmap;
+ DataType resultDataType = getResultMetadata().getDataType();
+ switch (resultDataType) {
+ case UNKNOWN:
+ bitmap = new RoaringBitmap();
+ bitmap.add(0L, length);
+ for (int i = 0; i < length; i++) {
+ _bytesValuesMV[i] = (byte[][])
DataSchema.ColumnDataType.BYTES_ARRAY.getNullPlaceholder();
+ }
+ break;
+ case STRING:
+ Pair<String[][], RoaringBitmap> stringResult =
transformToStringValuesMVWithNull(valueBlock);
+ bitmap = stringResult.getRight();
+ ArrayCopyUtils.copy(stringResult.getLeft(), _bytesValuesMV, length);
+ break;
+ case BYTES:
+ _bytesValuesMV = transformToBytesValuesMV(valueBlock);
+ bitmap = getNullBitmap(valueBlock);
+ break;
+ default:
+ throw new IllegalStateException(String.format("Cannot read MV %s as
bytes", resultDataType));
+ }
+ return ImmutablePair.of(_bytesValuesMV, bitmap);
+ }
+
+ @Override
+ public @Nullable RoaringBitmap getNullBitmap(ValueBlock valueBlock) {
+ if (_arguments == null) {
+ return null;
+ }
+ RoaringBitmap bitmap = new RoaringBitmap();
+ for (TransformFunction arg : _arguments) {
+ RoaringBitmap argBitmap = arg.getNullBitmap(valueBlock);
+ if (argBitmap != null) {
+ bitmap.or(argBitmap);
+ }
+ }
+ return bitmap;
Review Comment:
done
--
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]