Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[fix](RF) fix 'Invalid value' error of RF of datetimev2 type for max value #32696

Merged
merged 1 commit into from
Mar 22, 2024
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
2 changes: 1 addition & 1 deletion be/src/exprs/runtime_filter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ Status create_literal(const TypeDescriptor& type, const void* data, vectorized::
break;
}
case TYPE_DATETIMEV2: {
create_texpr_literal_node<TYPE_DATETIMEV2>(data, &node);
create_texpr_literal_node<TYPE_DATETIMEV2>(data, &node, type.precision, type.scale);
break;
}
case TYPE_DATE: {
Expand Down
4 changes: 2 additions & 2 deletions be/src/exprs/runtime_filter.h
Original file line number Diff line number Diff line change
Expand Up @@ -512,11 +512,11 @@ Status create_texpr_literal_node(const void* data, TExprNode* node, int precisio
data);
TDateLiteral date_literal;
char convert_buffer[30];
origin_value->to_string(convert_buffer);
origin_value->to_string(convert_buffer, scale);
date_literal.__set_value(convert_buffer);
(*node).__set_date_literal(date_literal);
(*node).__set_node_type(TExprNodeType::DATE_LITERAL);
(*node).__set_type(create_type_desc(PrimitiveType::TYPE_DATETIMEV2));
(*node).__set_type(create_type_desc(PrimitiveType::TYPE_DATETIMEV2, precision, scale));
} else if constexpr (T == TYPE_DECIMALV2) {
auto origin_value = reinterpret_cast<const DecimalV2Value*>(data);
(*node).__set_node_type(TExprNodeType::DECIMAL_LITERAL);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -362,3 +362,17 @@
1 2022-01-01 1 2022-01-01
1 2022-01-01 1 2022-01-01

-- !datetime_rf_1_p1 --
2011-11-11 2011-11-11

-- !datetime_rf_1_p2 --
2011-11-11 2011-11-11

-- !datetime_rf_2_p1 --
2011-11-11T11:11:11.123455 2011-11-11T11:11:11.123455

-- !datetime_rf_2_p2 --
2011-11-11T11:11:11.123455 2011-11-11T11:11:11.123455

-- !datetime_rf_3 --

Original file line number Diff line number Diff line change
Expand Up @@ -221,4 +221,114 @@ suite("test_runtimefilter_on_datev2", "nereids_p0") {
qt_join1 """
SELECT * FROM ${dateTable} a, ${dateV2Table} b WHERE a.date = b.date;
"""

// bug fix
sql "set disable_join_reorder=true;"
sql "set enable_runtime_filter_prune=false;"
sql "set runtime_filter_type='MIN_MAX';"
sql "set runtime_filter_wait_time_ms=10000;"

// test date
sql "drop table if exists dt_rftest_l";
sql "drop table if exists dt_rftest_r";
sql """
CREATE TABLE `dt_rftest_l` (
`k1_date_l` DATEV2
)
DISTRIBUTED BY HASH(`k1_date_l`) buckets 16
PROPERTIES (
"replication_allocation" = "tag.location.default: 1"
);
"""
sql """
CREATE TABLE `dt_rftest_r` (
`k1_date_r` DATEV2
)
DISTRIBUTED BY HASH(`k1_date_r`) buckets 16
PROPERTIES (
"replication_allocation" = "tag.location.default: 1"
);
"""
sql """
insert into dt_rftest_l values
("2001-11-11 11:11:11.123455"),
("2011-11-11 11:11:11.123455"),
("9999-11-11 11:11:11.123456");
"""
sql """
insert into dt_rftest_r values("2011-11-11 11:11:11.123456");
"""
qt_datetime_rf_1_p1 """
select /*+SET_VAR(parallel_pipeline_task_num=1)*/ * from dt_rftest_l join dt_rftest_r on k1_date_l = k1_date_r order by 1, 2;
"""
qt_datetime_rf_1_p2 """
select /*+SET_VAR(parallel_pipeline_task_num=8)*/ * from dt_rftest_l join dt_rftest_r on k1_date_l = k1_date_r order by 1, 2;
"""

// test datetime
sql "drop table if exists dt_rftest_l";
sql "drop table if exists dt_rftest_r";
sql """
CREATE TABLE `dt_rftest_l` (
`k1_date_l` DATETIMEV2(6)
)
DISTRIBUTED BY HASH(`k1_date_l`) buckets 16
PROPERTIES (
"replication_allocation" = "tag.location.default: 1"
);
"""
sql """
CREATE TABLE `dt_rftest_r` (
`k1_date_r` DATETIMEV2(6)
)
DISTRIBUTED BY HASH(`k1_date_r`) buckets 16
PROPERTIES (
"replication_allocation" = "tag.location.default: 1"
);
"""
sql """
insert into dt_rftest_l values
("2001-11-11 11:11:11.123455"),
("2011-11-11 11:11:11.123455"),
("9999-11-11 11:11:11.123455");
"""
sql """
insert into dt_rftest_r values("2011-11-11 11:11:11.123455");
"""
// RF is different with parallel_pipeline_task_num=1 and parallel_pipeline_task_num=2
qt_datetime_rf_2_p1 """
select /*+SET_VAR(parallel_pipeline_task_num=1)*/ * from dt_rftest_l join dt_rftest_r on k1_date_l = k1_date_r order by 1, 2;
"""
qt_datetime_rf_2_p2 """
select /*+SET_VAR(parallel_pipeline_task_num=8)*/ * from dt_rftest_l join dt_rftest_r on k1_date_l = k1_date_r order by 1, 2;
"""

sql "drop table if exists dt_rftest_l";
sql "drop table if exists dt_rftest_r";
sql """
CREATE TABLE `dt_rftest_l` (
`k1_date` DATEV2
)
DISTRIBUTED BY HASH(`k1_date`)
PROPERTIES (
"replication_allocation" = "tag.location.default: 1"
);
"""
sql """
CREATE TABLE `dt_rftest_r` (
`k1_char` varchar(64)
)
DISTRIBUTED BY HASH(`k1_char`)
PROPERTIES (
"replication_allocation" = "tag.location.default: 1"
)
"""

sql """ insert into dt_rftest_l values
("9999-12-31 23:59:59");
"""
sql """ insert into dt_rftest_r values
("9999-12-31 23:59:59.999999");
"""
qt_datetime_rf_3 """ select * from dt_rftest_l join dt_rftest_r on k1_date = k1_char order by 1, 2"""
}
Loading