Commit c128c19
Add first-class logical UUID type support
Adds UUID as a first-class Pinot data type backed by 16-byte BYTES
storage with canonical lowercase RFC 4122 string as the external
representation.
## Core type plumbing
- `FieldSpec.DataType.UUID(BYTES, 16, false, true)` — stored as BYTES,
fixed 16 bytes, not numeric, sortable
- `PinotDataType.UUID` — conversions to/from STRING/BYTES, numeric ops
throw as expected
- `DataSchema.ColumnDataType.UUID` — backed by BYTES internal, maps to
Calcite `SqlTypeName.UUID`
- `Schema.validate()` — UUID and BIG_DECIMAL enforce SV-only constraint
## UuidUtils (pinot-spi)
- Canonical conversions: `toBytes()`, `toUUID()`, `toString()`
- `UuidKey` inner class — stores UUID as two `long` fields for O(1)
hashCode/equals in hot groupby/join paths (avoids ByteArray allocation)
- `compare()` uses `Long.compareUnsigned` for correct byte-order UUID
comparison vs. `ByteArray.compare()` signed bytes
## Query engine
- Predicate evaluators — Eq/NotEq/In/NotIn handle UUID via
`BytesRaw*Evaluator` + `DataType.UUID`
- Group key generators — `NoDictionarySingleColumnGroupKeyGenerator`,
`NoDictionaryMultiColumnGroupKeyGenerator` updated
- MSQE hot-path: `UuidToIdMap`, `OneUuidKeyGroupIdGenerator`,
`UuidLookupTable`
- `RequestContextUtils.evaluateLiteralValue` — supports
CAST/TO_UUID/UUID_TO_BYTES/BYTES_TO_UUID/UUID_TO_STRING/IS_UUID
on predicate RHS literals; uses `BadQueryRequestException` for arity
errors
- `CastTransformFunction` — CAST(col AS UUID) per-row support
- Scalar functions: `IS_UUID`, `TO_UUID`, `UUID_TO_BYTES`,
`BYTES_TO_UUID`, `UUID_TO_STRING`
## Segment / realtime
- `MutableSegmentImpl` — UUID primary key normalization for upsert via
`normalizePrimaryKeyValue()`
- `MutableNoDictColumnStatistics.isSorted()` — uses `UuidUtils.compare`
(unsigned byte-order) instead of `ByteArray.compare` (signed) for UUID
- `BloomFilterCreator` — UUID stored as canonical string in bloom filter
- `RawValueBitmapInvertedIndexCreator` — UUID handled via stored BYTES
## Response encoding
- Arrow encoder — emits UUID string values in UUID columns
- JSON encoder — passes through UUID as string
## Input format
- Avro plugin — `logicalType: "uuid"` Avro schema field → UUID DataType;
Pinot UUID field → Avro `{"type":"string","logicalType":"uuid"}`
- Rejects Avro ARRAY<uuid> with a clear error (UUID is SV-only)
## Tests
- `UuidTypeTest`, `UuidTypeRealtimeTest` — full integration tests for
batch and realtime ingestion, predicate pushdown, group-by, CAST
- `UuidUpsertRealtimeTest` — upsert with UUID primary key
- Unit tests for UuidUtils, DataSchema, PinotDataType, RequestContextUtils,
response encoders, Avro utils, predicate evaluators
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>1 parent aa483d3 commit c128c19
116 files changed
Lines changed: 5104 additions & 294 deletions
File tree
- pinot-common/src
- main
- java/org/apache/pinot
- common
- function
- scalar
- uuid
- request/context
- predicate
- response/encoder
- utils
- sql/parsers/rewriter
- proto
- test/java/org/apache/pinot
- common
- function
- scalar
- uuid
- request/context
- response/encoder
- utils
- sql/parsers/rewriter
- pinot-core/src
- main/java/org/apache/pinot/core
- operator
- filter
- predicate
- transform/function
- query
- aggregation/groupby
- utils
- distinct/table
- pruner
- reduce
- filter
- test/java/org/apache/pinot/core
- common
- datablock
- datatable
- data/manager
- operator/transform/function
- query
- aggregation/groupby
- distinct/table
- pruner
- selection
- pinot-integration-test-base/src/test/java/org/apache/pinot/integration/tests
- pinot-integration-tests/src/test/java/org/apache/pinot/integration/tests/custom
- pinot-perf
- src/main/java/org/apache/pinot/perf
- pinot-plugins/pinot-input-format/pinot-avro-base/src
- main/java/org/apache/pinot/plugin/inputformat/avro
- test/java/org/apache/pinot/plugin/inputformat/avro
- pinot-query-planner/src
- main/java/org/apache/pinot/query
- parser
- planner
- logical
- physical/v2
- serde
- type
- test/java/org/apache/pinot/query
- parser
- planner
- logical
- serde
- type
- pinot-query-runtime/src
- main/java/org/apache/pinot/query/runtime
- function
- operator
- groupby
- join
- test/java/org/apache/pinot/query/runtime/operator
- pinot-segment-local
- src
- main/java/org/apache/pinot/segment/local
- indexsegment/mutable
- realtime
- converter/stats
- impl/dictionary
- segment
- creator/impl
- inv
- index
- column
- loader/columnminmaxvalue
- readers
- readers
- utils
- test/java/org/apache/pinot/segment/local
- indexsegment/mutable
- segment/index
- column
- creator
- inv
- utils
- pinot-segment-spi/src/main/java/org/apache/pinot/segment/spi/index/creator
- pinot-spi/src
- main/java/org/apache/pinot/spi
- data
- utils
- test/java/org/apache/pinot/spi
- data
- utils
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
187 | 187 | | |
188 | 188 | | |
189 | 189 | | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
190 | 240 | | |
191 | 241 | | |
Lines changed: 7 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
| 26 | + | |
26 | 27 | | |
27 | 28 | | |
28 | 29 | | |
| |||
52 | 53 | | |
53 | 54 | | |
54 | 55 | | |
| 56 | + | |
55 | 57 | | |
56 | 58 | | |
57 | 59 | | |
| |||
75 | 77 | | |
76 | 78 | | |
77 | 79 | | |
| 80 | + | |
78 | 81 | | |
79 | 82 | | |
80 | 83 | | |
| |||
103 | 106 | | |
104 | 107 | | |
105 | 108 | | |
| 109 | + | |
106 | 110 | | |
107 | 111 | | |
108 | 112 | | |
| |||
125 | 129 | | |
126 | 130 | | |
127 | 131 | | |
| 132 | + | |
128 | 133 | | |
129 | 134 | | |
130 | 135 | | |
| |||
197 | 202 | | |
198 | 203 | | |
199 | 204 | | |
| 205 | + | |
| 206 | + | |
200 | 207 | | |
201 | 208 | | |
202 | 209 | | |
| |||
Lines changed: 4 additions & 11 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
23 | | - | |
24 | 23 | | |
25 | 24 | | |
26 | 25 | | |
| |||
30 | 29 | | |
31 | 30 | | |
32 | 31 | | |
| 32 | + | |
33 | 33 | | |
34 | 34 | | |
35 | 35 | | |
| |||
442 | 442 | | |
443 | 443 | | |
444 | 444 | | |
445 | | - | |
446 | | - | |
447 | | - | |
448 | | - | |
449 | | - | |
450 | | - | |
| 445 | + | |
| 446 | + | |
451 | 447 | | |
452 | 448 | | |
453 | 449 | | |
| |||
459 | 455 | | |
460 | 456 | | |
461 | 457 | | |
462 | | - | |
463 | | - | |
464 | | - | |
465 | | - | |
| 458 | + | |
466 | 459 | | |
467 | 460 | | |
468 | 461 | | |
| |||
Lines changed: 105 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
Lines changed: 106 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
0 commit comments