You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pinot.apache.org by "Jackie-Jiang (via GitHub)" <gi...@apache.org> on 2026/04/24 20:52:21 UTC

[PR] Add multi-value BIG_DECIMAL support (with MV BYTES improvements) [pinot]

Jackie-Jiang opened a new pull request, #18326:
URL: https://github.com/apache/pinot/pull/18326

   ## Summary
   
   Adds end-to-end multi-value BIG_DECIMAL support across the engine, and fills in the missing pieces for multi-value BYTES so the two MV types are symmetric.
   
   ### MV BIG_DECIMAL (end-to-end)
   - **Schema/type system**: `DataSchema.ColumnDataType.BIG_DECIMAL_ARRAY` (null placeholder, null bitmap, convert/format/toExternal paths); `PinotDataType.BIG_DECIMAL_ARRAY`.
   - **Segment creation/storage**: MV stats (`BigDecimalColumnPreIndexStatsCollector`), dictionary (`SegmentDictionaryCreator`), raw fwd index (`MultiValueVarByteRawIndexCreator`, `VarByteChunk*` writers/readers), `ForwardIndexCreator#putBigDecimalMV` / `ForwardIndexReader#getBigDecimalMV`, `MutableForwardIndex`, `ColumnReader`.
   - **Runtime**: `RowBasedBlockValSet`, `DataFetcher`, `DataBlockCache`, `ProjectionBlockValSet`, `TransformBlockValSet`, `DataBlockValSet`, `FilteredDataBlockValSet`, `FilteredRowBasedBlockValSet`, `RowBasedBlockValueFetcher` all wire `getBigDecimalValuesMV`.
   - **Transform functions**: `CastTransformFunction`, `ArrayLiteralTransformFunction`, `GenerateArrayTransformFunction`, `IdentifierTransformFunction`, `LiteralTransformFunction`, `ArrayLengthTransformFunction`, `ScalarTransformFunctionWrapper`, `BaseTransformFunction`.
   - **Aggregation**: new ARRAY_AGG variants (`ArrayAggBigDecimalFunction`, `ArrayAggDistinctBigDecimalFunction`, `BaseArrayAggBigDecimalFunction`); `BaseDistinctAggregateAggregationFunction` BIG_DECIMAL SV+MV; `NonScanBasedAggregationOperator` dictionary path.
   - **Data block / data table**: `DataBlock#getBigDecimalArray`, `DataTable#getBigDecimalArray`, `DataBlockBuilder`, `BaseDataTableBuilder`, `DataTableImplV4`, `DataBlockEquals`, `BaseDataBlock`; `ObjectSerDeUtils` serializer.
   - **MSE wiring**: `RelToPlanNodeConverter`, `PRelToPlanNodeConverter`, `RexExpressionUtils`, proto serde. `TypeUtils.convert` applies a backward-compat downcast `BIG_DECIMAL_ARRAY → DOUBLE_ARRAY` at the MSE boundary until the wire protocol rev supports BIG_DECIMAL_ARRAY natively (TODO noted in code).
   - **Response encoders**: `ArrowResponseEncoder`, `JsonResponseEncoder`.
   - **Integration test**: new `BigDecimalTypeTest` covering SV and MV, dictionary and raw variants.
   
   ### MV BYTES (parity with MV BIG_DECIMAL)
   - `ForwardIndexHandler` and `InvertedIndexAndDictionaryBasedForwardIndexCreator` BYTES_ARRAY paths.
   - `ObjectSerDeUtils` BYTES_ARRAY.
   - New ARRAY_AGG variants (`ArrayAggBytesFunction`, `ArrayAggDistinctBytesFunction`, `BaseArrayAggBytesFunction`).
   - `BaseDistinctAggregateAggregationFunction` BYTES MV.
   - New `BytesMvTypeTest` covering dictionary and raw variants.
   
   ### ExprMinMax refactor
   - `ExprMinMaxWrapperValSet` now stores `ColumnDataType` and dispatches on stored type; callers take only `BlockValSet`. Removed the redundant `isSingleValue` plumbing (derivable from the stored type).
   - Fixed `ExprMinMaxObject#getField` BYTES_ARRAY case (was incorrectly routed through `getStringArray`).
   - `ExprMinMaxMeasuringValSetWrapper` gains BYTES support.
   - `ParentExprMinMaxAggregationFunction` simplified.
   
   ### DataSchema consistency
   - `BYTES_ARRAY` is now symmetric with `BYTES` across `convert` (`ByteArray[] → byte[][]`), `toExternal` (`ByteArray[] → byte[][]`), and `format` (expects `byte[][]`), mirroring the SV path. Previously `format` expected `ByteArray[]`, which would have raised a `ClassCastException` after `convert`.
   
   ### Misc
   - `ArrayListUtils.toBytesArray` now has a zero-copy fast path matching `toStringArray`; new `toBigDecimalArray` helper.
   - `TypeUtils.convert`: handle empty `ObjectArrayList` in the DOUBLE_ARRAY backward-compat downcast; add `assert value instanceof <expected>` on fallthrough branches; explicit BYTES case.
   - Normalized case ordering in switches touched by this change so `BIG_DECIMAL` sits immediately after `DOUBLE` (affects `SegmentDictionaryCreator`, `ForwardIndexHandler`, `InvertedIndexAndDictionaryBasedForwardIndexCreator`, `AggregationResultsBlock`, `ArrowResponseEncoder`, `PinotDataType`).
   - `expressions.proto`: add `BIG_DECIMAL_ARRAY` enum value.
   - `ArrayLengthScalarFunction`, `ArraysOverlapScalarFunction`: `byte[][]` / `BigDecimal[]` overloads.
   
   ## Test plan
   
   - [ ] `BigDecimalTypeTest` (SV + MV, dictionary + raw, SSE + MSE)
   - [ ] `BytesMvTypeTest` (MV, dictionary + raw, SSE + MSE)
   - [ ] `ExprMinMaxTest` (BYTES + BYTES_ARRAY)
   - [ ] `DistinctCountAggregationFunctionTest` (BIG_DECIMAL SV + MV)
   - [ ] `ArrayAggFunctionTest` (BIG_DECIMAL + BYTES)
   - [ ] `DataBlockBuilderTest` (BIG_DECIMAL_ARRAY)
   - [ ] `DataTableSerDeTest` (BIG_DECIMAL_ARRAY, BYTES_ARRAY)
   - [ ] `ArrayListUtilsTest`
   - [ ] `MultiValueVarByteRawIndexCreatorTest` (BIG_DECIMAL)
   - [ ] Full integration test suite (`OfflineClusterIntegrationTest`, `BrokerRequestIntegrationTest`, etc.)
   
   ## Backward compatibility
   
   - Wire protocol still emits `DOUBLE_ARRAY` for MV BIG_DECIMAL at the MSE plan boundary so mixed-version brokers/servers do not encounter the new enum value. A runtime downcast (`BigDecimal[] → double[]`) in `TypeUtils.convert` preserves correctness with documented precision loss; a TODO in `RelToPlanNodeConverter#resolveDecimal` tracks removing this shim in a future release once all roles understand `BIG_DECIMAL_ARRAY`.
   - DataTable BYTES_ARRAY serialization unified on `ByteArray[]` (consistent with SV BYTES and `DataBlock#getBytesArray`); no on-wire format change.


-- 
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


Re: [PR] Support MV BIG_DECIMAL and BYTES [pinot]

Posted by "Copilot (via GitHub)" <gi...@apache.org>.
Copilot commented on code in PR #18326:
URL: https://github.com/apache/pinot/pull/18326#discussion_r3141022515


##########
pinot-core/src/main/java/org/apache/pinot/core/common/datablock/DataBlockBuilder.java:
##########
@@ -458,6 +479,21 @@ private static void serializeColumnData(List<Object[]> columns, DataSchema dataS
         });
         break;
       }
+      case BYTES_ARRAY: {
+        ByteArray[] nullPlaceholder = (ByteArray[]) storedType.getNullPlaceholder();
+        interruptableLoop(0, numRows, interruptableLoopStep, (start, end) -> {
+          for (int rowId = 0; rowId < numRows; rowId++) {
+            Object value = column[rowId];
+            if (value == null) {
+              nullBitmap.add(rowId);
+              setColumn(fixedSize, varSize, nullPlaceholder);
+            } else {
+              setColumn(fixedSize, varSize, (ByteArray[]) value);
+            }
+          }

Review Comment:
   Same chunking issue as BIG_DECIMAL_ARRAY: the BYTES_ARRAY branch ignores interruptableLoop's (start,end) and loops rowId from 0..numRows, which will duplicate writes when numRows > interruptableLoopStep. Use rowId from start to end.



##########
pinot-core/src/main/java/org/apache/pinot/core/common/datablock/DataBlockBuilder.java:
##########
@@ -443,6 +449,21 @@ private static void serializeColumnData(List<Object[]> columns, DataSchema dataS
         });
         break;
       }
+      case BIG_DECIMAL_ARRAY: {
+        BigDecimal[] nullPlaceholder = (BigDecimal[]) storedType.getNullPlaceholder();
+        interruptableLoop(0, numRows, interruptableLoopStep, (start, end) -> {
+          for (int rowId = 0; rowId < numRows; rowId++) {
+            Object value = column[rowId];
+            if (value == null) {
+              nullBitmap.add(rowId);
+              setColumn(fixedSize, varSize, nullPlaceholder);
+            } else {
+              setColumn(fixedSize, varSize, (BigDecimal[]) value);
+            }
+          }

Review Comment:
   In the BIG_DECIMAL_ARRAY branch, the interruptableLoop callback ignores the provided (start,end) and loops rowId from 0..numRows. This will re-serialize the full column for every chunk when numRows > interruptableLoopStep, corrupting the buffers / causing BufferOverflow. Iterate rowId from start to end (like the primitive cases above).



##########
pinot-core/src/test/java/org/apache/pinot/core/common/datablock/DataBlockTestUtils.java:
##########
@@ -129,6 +129,22 @@ public static Object[] getRandomRow(DataSchema dataSchema, int nullPercentile) {
           }
           row[colId] = timestampArray;
           break;
+        case STRING_ARRAY:
+          length = RANDOM.nextInt(ARRAY_SIZE);
+          String[] stringArray = new String[length];
+          for (int i = 0; i < length; i++) {
+            stringArray[i] = RandomStringUtils.random(RANDOM.nextInt(20));
+          }
+          row[colId] = stringArray;
+          break;
+        case BYTES_ARRAY:
+          length = RANDOM.nextInt(ARRAY_SIZE);
+          ByteArray[] bytesArray = new ByteArray[length];
+          for (int i = 0; i < length; i++) {
+            bytesArray[i] = new ByteArray(RandomStringUtils.random(RANDOM.nextInt(20)).getBytes());
+          }

Review Comment:
   Test utility uses String.getBytes() without specifying a charset when building ByteArray values. This is platform-default dependent and can make tests flaky across environments; prefer StandardCharsets.UTF_8 (or reuse the charset used elsewhere in the test suite).



##########
pinot-query-planner/src/main/java/org/apache/pinot/query/planner/logical/RexExpressionUtils.java:
##########
@@ -148,16 +147,6 @@ public static RexLiteral toRexLiteral(RelBuilder builder, RexExpression.Literal
         ByteString byteString = new ByteString(bytes);
         return rexBuilder.makeBinaryLiteral(byteString);
       }
-      case BOOLEAN_ARRAY:
-      case BYTES_ARRAY:
-      case DOUBLE_ARRAY:
-      case FLOAT_ARRAY:
-      case INT_ARRAY:
-      case LONG_ARRAY:
-      case STRING_ARRAY:
-      case TIMESTAMP_ARRAY:
-      case OBJECT:
-      case UNKNOWN:
       default:
         throw new IllegalStateException("Unsupported ColumnDataType: " + literal.getDataType());

Review Comment:
   RexExpressionUtils.toRexLiteral() no longer handles ColumnDataType.JSON (it will now hit the default branch and throw). JSON literals were previously treated similarly to STRING; if JSON literals can appear in RexExpression.Literal (e.g., from proto conversion), this is a regression. Consider adding a JSON case (likely mapping to rexBuilder.makeLiteral(String)).



-- 
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


Re: [PR] Support MV BIG_DECIMAL and BYTES [pinot]

Posted by "Jackie-Jiang (via GitHub)" <gi...@apache.org>.
Jackie-Jiang merged PR #18326:
URL: https://github.com/apache/pinot/pull/18326


-- 
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


Re: [PR] Support MV BIG_DECIMAL and BYTES [pinot]

Posted by "xiangfu0 (via GitHub)" <gi...@apache.org>.
xiangfu0 commented on code in PR #18326:
URL: https://github.com/apache/pinot/pull/18326#discussion_r3141658353


##########
pinot-common/src/main/java/org/apache/pinot/common/datatable/DataTableImplV4.java:
##########
@@ -308,6 +308,19 @@ public double[] getDoubleArray(int rowId, int colId) {
     return doubles;
   }
 
+  @Override
+  public BigDecimal[] getBigDecimalArray(int rowId, int colId) {
+    int length = positionOffsetInVariableBufferAndGetLength(rowId, colId);
+    BigDecimal[] bigDecimals = new BigDecimal[length];
+    for (int i = 0; i < length; i++) {
+      int byteLength = _variableSizeData.getInt();

Review Comment:
   shall we extract the common code: 
   ```
         int byteLength = _variableSizeData.getInt();
         byte[] value = new byte[byteLength];
         _variableSizeData.get(value);
   ```
   into  a getBytes method, so that the future logical types like uuid can reuse it.



-- 
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


Re: [PR] Add multi-value BIG_DECIMAL support (with MV BYTES improvements) [pinot]

Posted by "codecov-commenter (via GitHub)" <gi...@apache.org>.
codecov-commenter commented on PR #18326:
URL: https://github.com/apache/pinot/pull/18326#issuecomment-4316662384

   ## [Codecov](https://app.codecov.io/gh/apache/pinot/pull/18326?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) Report
   :white_check_mark: All modified and coverable lines are covered by tests.
   :white_check_mark: Project coverage is 0.00%. Comparing base ([`673828c`](https://app.codecov.io/gh/apache/pinot/commit/673828c7c2effcff254a36ac81614b431d798dd3?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)) to head ([`acd050a`](https://app.codecov.io/gh/apache/pinot/commit/acd050a4dfb45cd472e33df4cf0f76511edff343?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)).
   :warning: Report is 14 commits behind head on master.
   > :exclamation:  There is a different number of reports uploaded between BASE (673828c) and HEAD (acd050a). Click for more details.
   > 
   > <details><summary>HEAD has 36 uploads less than BASE</summary>
   >
   >| Flag | BASE (673828c) | HEAD (acd050a) |
   >|------|------|------|
   >|java-21|5|1|
   >|unittests1|2|0|
   >|unittests|4|0|
   >|temurin|10|1|
   >|java-11|5|0|
   >|unittests2|2|0|
   >|integration|6|1|
   >|integration2|2|1|
   >|integration1|2|0|
   >|custom-integration1|2|0|
   ></details>
   
   <details><summary>Additional details and impacted files</summary>
   
   
   
   ```diff
   @@              Coverage Diff              @@
   ##             master   #18326       +/-   ##
   =============================================
   - Coverage     63.61%    0.00%   -63.62%     
   =============================================
     Files          3246        3     -3243     
     Lines        197510        6   -197504     
     Branches      30578        0    -30578     
   =============================================
   - Hits         125648        0   -125648     
   + Misses        61819        6    -61813     
   + Partials      10043        0    -10043     
   ```
   
   | [Flag](https://app.codecov.io/gh/apache/pinot/pull/18326/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Coverage Δ | |
   |---|---|---|
   | [custom-integration1](https://app.codecov.io/gh/apache/pinot/pull/18326/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `?` | |
   | [integration](https://app.codecov.io/gh/apache/pinot/pull/18326/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `0.00% <ø> (-100.00%)` | :arrow_down: |
   | [integration1](https://app.codecov.io/gh/apache/pinot/pull/18326/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `?` | |
   | [integration2](https://app.codecov.io/gh/apache/pinot/pull/18326/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `0.00% <ø> (ø)` | |
   | [java-11](https://app.codecov.io/gh/apache/pinot/pull/18326/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `?` | |
   | [java-21](https://app.codecov.io/gh/apache/pinot/pull/18326/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `0.00% <ø> (-63.58%)` | :arrow_down: |
   | [temurin](https://app.codecov.io/gh/apache/pinot/pull/18326/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `0.00% <ø> (-63.62%)` | :arrow_down: |
   | [unittests](https://app.codecov.io/gh/apache/pinot/pull/18326/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `?` | |
   | [unittests1](https://app.codecov.io/gh/apache/pinot/pull/18326/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `?` | |
   | [unittests2](https://app.codecov.io/gh/apache/pinot/pull/18326/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `?` | |
   
   Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#carryforward-flags-in-the-pull-request-comment) to find out more.
   </details>
   
   [:umbrella: View full report in Codecov by Sentry](https://app.codecov.io/gh/apache/pinot/pull/18326?dropdown=coverage&src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).   
   :loudspeaker: Have feedback on the report? [Share it here](https://about.codecov.io/codecov-pr-comment-feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
   <details><summary> :rocket: New features to boost your workflow: </summary>
   
   - :package: [JS Bundle Analysis](https://docs.codecov.com/docs/javascript-bundle-analysis): Save yourself from yourself by tracking and limiting bundle sizes in JS merges.
   </details>


-- 
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


Re: [PR] Support MV BIG_DECIMAL and BYTES [pinot]

Posted by "Jackie-Jiang (via GitHub)" <gi...@apache.org>.
Jackie-Jiang commented on code in PR #18326:
URL: https://github.com/apache/pinot/pull/18326#discussion_r3141666301


##########
pinot-common/src/main/java/org/apache/pinot/common/datatable/DataTableImplV4.java:
##########
@@ -308,6 +308,19 @@ public double[] getDoubleArray(int rowId, int colId) {
     return doubles;
   }
 
+  @Override
+  public BigDecimal[] getBigDecimalArray(int rowId, int colId) {
+    int length = positionOffsetInVariableBufferAndGetLength(rowId, colId);
+    BigDecimal[] bigDecimals = new BigDecimal[length];
+    for (int i = 0; i < length; i++) {
+      int byteLength = _variableSizeData.getInt();

Review Comment:
   UUID (similar to BOOLEAN and TIMESTAMP) won't need an extra method as it will be a logical type, not a stored type. UUID should be the same as BYTES. If we want to optimize it, it should be always 16 bytes, which also won't share this method



-- 
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


Re: [PR] Support MV BIG_DECIMAL and BYTES [pinot]

Posted by "xiangfu0 (via GitHub)" <gi...@apache.org>.
xiangfu0 commented on code in PR #18326:
URL: https://github.com/apache/pinot/pull/18326#discussion_r3141639824


##########
pinot-common/src/main/java/org/apache/pinot/common/utils/DataSchema.java:
##########
@@ -654,14 +668,16 @@ public Serializable convertAndFormat(Object value) {
           return (float[]) value;
         case DOUBLE_ARRAY:
           return toDoubleArray(value);
-        case STRING_ARRAY:
-          return (String[]) value;
+        case BIG_DECIMAL_ARRAY:
+          return formatBigDecimalArray((BigDecimal[]) value);
         case BOOLEAN_ARRAY:
           return toBooleanArray((int[]) value);
         case TIMESTAMP_ARRAY:
           return formatTimestampArray((long[]) value);
+        case STRING_ARRAY:
+          return (String[]) value;
         case BYTES_ARRAY:
-          return (byte[][]) value;

Review Comment:
   so we won't have byte[][] type at all?



-- 
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


Re: [PR] Support MV BIG_DECIMAL and BYTES [pinot]

Posted by "xiangfu0 (via GitHub)" <gi...@apache.org>.
xiangfu0 commented on code in PR #18326:
URL: https://github.com/apache/pinot/pull/18326#discussion_r3141916969


##########
pinot-query-planner/src/main/java/org/apache/pinot/query/planner/logical/RelToPlanNodeConverter.java:
##########
@@ -1005,6 +1006,8 @@ private static ColumnDataType resolveDecimal(RelDataType relDataType, boolean is
       } else if (precision <= 38) {
         return isArray ? ColumnDataType.LONG_ARRAY : ColumnDataType.LONG;
       } else {
+        // TODO: Modify it to return ColumnDataType.BIG_DECIMAL_ARRAY after `1.6.0` release

Review Comment:
   This only avoids the new enum on plan exchange. The PR also adds `BIG_DECIMAL_ARRAY` result writers for selection/group-by/aggregation `DataTable`s, so a 1.6 server can still send `BIG_DECIMAL_ARRAY` in the `DataSchema` to a 1.5 broker. Older brokers deserialize types with `ColumnDataType.valueOf(name)`, so they will fail on the unknown enum. We need the same compatibility shim on the server->broker result path too, not just here.



-- 
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


Re: [PR] Support MV BIG_DECIMAL and BYTES [pinot]

Posted by "xiangfu0 (via GitHub)" <gi...@apache.org>.
xiangfu0 commented on PR #18326:
URL: https://github.com/apache/pinot/pull/18326#issuecomment-4349885046

   Opened the matching docs update PR: https://github.com/pinot-contrib/pinot-docs/pull/777


-- 
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


Re: [PR] Support MV BIG_DECIMAL and BYTES [pinot]

Posted by "Jackie-Jiang (via GitHub)" <gi...@apache.org>.
Jackie-Jiang commented on code in PR #18326:
URL: https://github.com/apache/pinot/pull/18326#discussion_r3141146027


##########
pinot-query-planner/src/main/java/org/apache/pinot/query/planner/logical/RexExpressionUtils.java:
##########
@@ -148,16 +147,6 @@ public static RexLiteral toRexLiteral(RelBuilder builder, RexExpression.Literal
         ByteString byteString = new ByteString(bytes);
         return rexBuilder.makeBinaryLiteral(byteString);
       }
-      case BOOLEAN_ARRAY:
-      case BYTES_ARRAY:
-      case DOUBLE_ARRAY:
-      case FLOAT_ARRAY:
-      case INT_ARRAY:
-      case LONG_ARRAY:
-      case STRING_ARRAY:
-      case TIMESTAMP_ARRAY:
-      case OBJECT:
-      case UNKNOWN:
       default:
         throw new IllegalStateException("Unsupported ColumnDataType: " + literal.getDataType());

Review Comment:
   JSON is not a valid literal type



-- 
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


Re: [PR] Support MV BIG_DECIMAL and BYTES [pinot]

Posted by "Jackie-Jiang (via GitHub)" <gi...@apache.org>.
Jackie-Jiang commented on code in PR #18326:
URL: https://github.com/apache/pinot/pull/18326#discussion_r3141667817


##########
pinot-common/src/main/java/org/apache/pinot/common/utils/DataSchema.java:
##########
@@ -654,14 +668,16 @@ public Serializable convertAndFormat(Object value) {
           return (float[]) value;
         case DOUBLE_ARRAY:
           return toDoubleArray(value);
-        case STRING_ARRAY:
-          return (String[]) value;
+        case BIG_DECIMAL_ARRAY:
+          return formatBigDecimalArray((BigDecimal[]) value);
         case BOOLEAN_ARRAY:
           return toBooleanArray((int[]) value);
         case TIMESTAMP_ARRAY:
           return formatTimestampArray((long[]) value);
+        case STRING_ARRAY:
+          return (String[]) value;
         case BYTES_ARRAY:
-          return (byte[][]) value;

Review Comment:
   We have internal format (ByteArray) and external format (byte[]), where internal format is used for comparison and hash lookup. Here we are converting internal format into external format



-- 
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


Re: [PR] Support MV BIG_DECIMAL and BYTES [pinot]

Posted by "Jackie-Jiang (via GitHub)" <gi...@apache.org>.
Jackie-Jiang commented on code in PR #18326:
URL: https://github.com/apache/pinot/pull/18326#discussion_r3142453185


##########
pinot-query-planner/src/main/java/org/apache/pinot/query/planner/logical/RelToPlanNodeConverter.java:
##########
@@ -1005,6 +1006,8 @@ private static ColumnDataType resolveDecimal(RelDataType relDataType, boolean is
       } else if (precision <= 38) {
         return isArray ? ColumnDataType.LONG_ARRAY : ColumnDataType.LONG;
       } else {
+        // TODO: Modify it to return ColumnDataType.BIG_DECIMAL_ARRAY after `1.6.0` release

Review Comment:
   No existing function can generate `BIG_DECIMAL_ARRAY` (as it is newly added), and no existing data can have `BIG_DECIMAL_ARRAY` column (not supported), so it should be fine for all current use cases.
   
   The reason why I kept this part backward compatible is that Calcite does support Decimal ARRAY, and we still use `DOUBLE_ARRAY` to handle it for backward compatibility



-- 
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