…s no common type
visitIn and visitBetween call leastRestrictive directly instead of going through the
CoercionUtils path that comparison operators use. leastRestrictive returns no common
type when temporal operands are represented differently — e.g. a standard Calcite
TIMESTAMP field against EXPR_DATE UDT bounds/values (`ts between date('...') and
date('...')`, `ts in (DATE '...', ...)`) — so both predicates rejected such queries
with "expression types are incompatible" even though comparisons coerce the same mix.
Both now fall back to CoercionUtils.widenArguments (the comparison-operator path) when
leastRestrictive yields null, scoped to all-temporal operands so genuinely incompatible
mixes (e.g. `age between '35' and 38.5`) still raise SemanticCheckException. Enables the
previously-undiscovered testDateBetween (was missing its @test annotation) and adds
testDateIn plus a CoercionUtils unit test covering the plain-TIMESTAMP + EXPR_DATE mix.
Signed-off-by: Lantao Jin <ltjin@amazon.com>
Description
visitInandvisitBetweencallleastRestrictivedirectly instead of going through theCoercionUtilspath that comparison operators use.leastRestrictivereturns no common type when temporal operands are represented differently — e.g. a standard CalciteTIMESTAMPfield againstEXPR_DATEUDT bounds/values (ts between date('...') and date('...'),ts in (DATE '...', ...)) — so both predicates rejected such queries with "expression types are incompatible" even though comparisons coerce the same mix.Both now fall back to
CoercionUtils.widenArguments(the comparison-operator path) whenleastRestrictiveyieldsnull, scoped to all-temporal operands so genuinely incompatible mixes (e.g.age between '35' and 38.5) still raiseSemanticCheckException. Enables the previously-undiscoveredtestDateBetween(was missing its @test annotation) and addstestDateInplus aCoercionUtilsunit test covering the plain-TIMESTAMP + EXPR_DATE mix.Related Issues
Resolves #[Issue number to be closed when this PR is merged]
Check List
--signoffor-s.By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.