You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
API: ExpressionUtil throws ClassCastException when sanitizing bound IN/NOT_IN predicates聽#18411
Since #15224 (1.11.0), ExpressionUtil casts each element of BoundSetPredicate.literalSet() to Literal<?> when it sanitizes a bound IN or NOT_IN predicate. The set holds raw values (Long, String, ...), not literals, so any bound set predicate with two or more values throws ClassCastException.
ExpressionUtil.sanitize(Expression) and toSanitizedString(Expression) throw when they are given a bound expression. The overloads that take a StructType bind the expression first, catch the exception, and sanitize the unbound expression instead. SnapshotScan builds the scan report filter with sanitize(StructType, Expression, boolean), so a single IN in the filter turns off type-aware sanitizing for the whole filter:
Schemaschema =
newSchema(
Types.NestedField.required(1, "id", Types.LongType.get()),
Types.NestedField.required(2, "ts", Types.TimestampType.withoutZone()));
longninetyMinutesAgo =
DateTimeUtil.microsFromTimestamptz(OffsetDateTime.now().minusMinutes(90));
Expressionfilter =
Expressions.and(
Expressions.greaterThan("ts", ninetyMinutesAgo), Expressions.in("id", 1L, 2L));
ExpressionUtil.toSanitizedString(schema.asStruct(), filter, true);
// expected: (ts > (timestamp-1-hours-ago) AND id IN ((1-digit-int), (1-digit-int)))// actual: (ts > (16-digit-int) AND id IN ((1-digit-int), (1-digit-int)))
Without the IN, the same ts predicate is reported as (timestamp-1-hours-ago).
Activity