xiangfu0 opened a new pull request, #19263:
URL: https://github.com/apache/pinot/pull/19263

   ## Depends on
   
   - #19247
   
   This is intentionally a draft stacked follow-up to keep PostgreSQL parser 
compatibility separate from the core BYTES_ARRAY feature. Until #19247 merges, 
GitHub's diff against master also includes that parent PR. After #19247 lands, 
this branch will be rebased so only the PostgreSQL parser commit remains.
   
   ## Summary
   
   - Accept PostgreSQL hex bytea constants in both '\x0102'::bytea and 
CAST('\x0102' AS BYTEA) forms.
   - Normalize supported bytea constants to Pinot's existing binary-literal 
representation before either the single-stage or multi-stage engine plans the 
query.
   - Preserve the existing SQL-standard X'0102' form.
   - Cover scalar literals, BYTES array construction, ingested multi-value 
BYTES predicates, planner type inference, and runtime execution.
   
   ## Usage
   
   PostgreSQL infix-cast form:
   
   ~~~sql
   SELECT '\x0102'::bytea;
   ~~~
   
   Standard CAST spelling:
   
   ~~~sql
   SELECT CAST('\x0102' AS BYTEA);
   ~~~
   
   Construct and query a BYTES array:
   
   ~~~sql
   SELECT ARRAY['\x00'::bytea, '\x0102'::bytea, '\xFF'::bytea];
   
   SELECT id, byte_values
   FROM events
   WHERE ARRAYS_OVERLAP(
     byte_values,
     ARRAY['\x0102'::bytea, '\xCAFE'::bytea]
   );
   ~~~
   
   Result values remain hex strings, and an array result reports BYTES_ARRAY 
metadata.
   
   ## Compatibility scope
   
   This change supports quoted PostgreSQL hex-format bytea constants. Values 
must start with \x; upper- and lowercase hex are accepted, as is whitespace 
between complete byte pairs.
   
   It does not add a general expr::type cast operator, dynamic STRING-to-BYTES 
conversion, or PostgreSQL's historical octal escape-format bytea input. 
Normalizing only quoted constants keeps both query engines aligned and avoids 
per-row decoding.
   
   No Thrift or protobuf schema changes are introduced here. Supported 
constants normalize to the same scalar binary literals used by X'...' syntax.
   
   ## Validation
   
   - Parser/request/Thrift tests: 64/64 passed.
   - Single-stage literal-only broker tests: 9/9 passed.
   - Multi-stage bytea type-inference test: 1/1 passed.
   - BinaryTypes runtime/H2 queries: 4/4 passed across both optimizer variants.
   - BytesMvTypeTest: 14/14 passed for real Avro array<bytes> ingestion and 
both query engines.
   - Full integration-test reactor: 63/63 modules and 956 goals passed under 
JDK 25.
   - spotless:apply, checkstyle:check, license:format, and license:check passed 
for all five affected modules.


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

Reply via email to