fix: allow LIST/VALUES aggregates to accept DATE/TIMESTAMP/IP/BINARY field types - #5669
fix: allow LIST/VALUES aggregates to accept DATE/TIMESTAMP/IP/BINARY field types#5669waterWang wants to merge 1 commit into
Conversation
…P/BINARY field types The typesMatch() method in PPLTypeChecker was returning false when one operand was a UDT (AbstractExprRelDataType) and the other was a plain RelDataType. This caused LIST and VALUES aggregate functions to reject DATE/TIMESTAMP/IP/BINARY fields from database-sourced tables, even though these types were listed in the allowed signatures. The fix falls back to SqlTypeName comparison when the UDT-vs-plain mismatch occurs, so a TIMESTAMP field from a table matches the TIMESTAMP_UDT in the allowed SCALAR_TYPES list. Fixes opensearch-project/OpenSearch#22581
PR Reviewer Guide 🔍Here are some key observations to aid the review process:
|
PR Code Suggestions ✨Explore these optional code suggestions:
|
dai-chen
left a comment
There was a problem hiding this comment.
Please add IT to verify.
Description
This PR fixes a type-matching bug in the PPL aggregate function validation that caused LIST and VALUES aggregate functions to reject DATE, TIMESTAMP, IP, and BINARY field types, even though these types were explicitly listed in the allowed signatures.
Root Cause
The
typesMatch()method inPPLTypeChecker.javawas returningfalsewhen one operand was a UDT (viaAbstractExprRelDataType) and the other was a plainRelDataType. Database-sourced fields (e.g., TIMESTAMP from a table) arrive as plainRelDataType, but the allowedSCALAR_TYPESlist inPPLOperandTypes.javauses UDT variants for temporal/special types (e.g.,TIMESTAMP_UDT,DATE_UDT,IP_UDT,BINARY_UDT).This caused the validation to fail with:
Fix
Changed
typesMatch()to fall back toSqlTypeNamecomparison when one operand is a UDT and the other is a plainRelDataType, instead of returningfalse.Related Issues
Fixes opensearch-project/OpenSearch#22581