Skip to content

Commit

Permalink
fix fold const be return type
Browse files Browse the repository at this point in the history
  • Loading branch information
LiBinfeng-01 committed Sep 23, 2024
1 parent 8c34bfe commit 8c20e23
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -176,14 +176,14 @@ private static Expression replace(
if (newChild != child) {
hasNewChildren = true;
}
if (!newChild.getDataType().equals(child.getDataType())) {
try {
try {
if (!newChild.getDataType().equals(child.getDataType())) {
newChildren.add(newChild.castTo(child.getDataType()));
} catch (Exception e) {
LOG.warn("expression of type {} cast to {} failed. ", newChild.getDataType(), child.getDataType());
} else {
newChildren.add(newChild);
}
} else {
} catch (Exception e) {
LOG.warn("expression {} cast to {} failed. ", newChild.toString(), child.toString());
newChildren.add(newChild);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,4 +58,29 @@ suite("fold_constant_by_be") {
sql("verbose select substring('123456', 1, 3)")
contains "varchar(3)"
}

sql "drop table if exists table_200_undef_partitions2_keys3_properties4_distributed_by53"
sql """create table table_200_undef_partitions2_keys3_properties4_distributed_by53 (
pk int,
col_char_255__undef_signed char(255) null ,
col_char_100__undef_signed char(100) null ,
col_char_255__undef_signed_not_null char(255) not null ,
col_char_100__undef_signed_not_null char(100) not null ,
col_varchar_255__undef_signed varchar(255) null ,
col_varchar_255__undef_signed_not_null varchar(255) not null ,
col_varchar_1000__undef_signed varchar(1000) null ,
col_varchar_1000__undef_signed_not_null varchar(1000) not null ,
col_varchar_1001__undef_signed varchar(1001) null ,
col_varchar_1001__undef_signed_not_null varchar(1001) not null
) engine=olap
DUPLICATE KEY(pk, col_char_255__undef_signed, col_char_100__undef_signed)
distributed by hash(pk) buckets 10
properties("replication_num" = "1");"""
explain {
sql("select LAST_VALUE(col_char_255__undef_signed_not_null, false) over (partition by " +
"concat('GkIPbzAZSu', col_char_100__undef_signed), mask('JrqFkEDqeA') " +
"order by pk rows between unbounded preceding and 6 following) AS col_alias26947 " +
"from table_200_undef_partitions2_keys3_properties4_distributed_by53;")
notContains("mask")
}
}

0 comments on commit 8c20e23

Please sign in to comment.