Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -529,16 +529,16 @@ value, new ExpressionRewriteContext(expressionAnalyzer.getCascadesContext())
optimizedRowConstructor.add(value);
}

private static Expression castValue(Expression value, DataType targetType) {
private static Alias castValue(Expression value, DataType targetType) {
if (value instanceof Alias) {
Expression oldChild = value.child(0);
Expression newChild = TypeCoercionUtils.castUnbound(oldChild, targetType);
return oldChild == newChild ? value : value.withChildren(newChild);
return (Alias) (oldChild == newChild ? value : value.withChildren(newChild));
} else if (value instanceof UnboundAlias) {
UnboundAlias unboundAlias = (UnboundAlias) value;
return new Alias(TypeCoercionUtils.castUnbound(unboundAlias.child(), targetType));
} else {
return TypeCoercionUtils.castUnbound(value, targetType);
return new Alias(TypeCoercionUtils.castUnbound(value, targetType));
}
}

Expand Down
5 changes: 5 additions & 0 deletions regression-test/suites/insert_p0/insert.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -149,4 +149,9 @@ suite("insert") {
def rows1 = sql """select count() from source;"""
def rows2 = sql """select count() from dest;"""
assertTrue(rows1 == rows2);

test {
sql("insert into dest values(now(), 0xff, 0xaa)")
exception "Unknown column '0xff' in 'table list' in UNBOUND_OLAP_TABLE_SINK clause"
}
}
Loading