Skip to content

Commit 3c4580a

Browse files
chore(query): revert 17516 (#17539)
* Revert "fix(query): tpcds q69 fail (#17516)" This reverts commit bc601ac. * exclude format plan * update typos.toml --------- Co-authored-by: coldWater <[email protected]>
1 parent 335cdff commit 3c4580a

File tree

6 files changed

+17
-128
lines changed

6 files changed

+17
-128
lines changed

.typos.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
"Ser" = "Ser"
1414
"flate" = "flate"
1515
"Tke" = "Tke"
16+
"typ" = "typ"
1617

1718
[files]
1819
extend-exclude = [

src/query/sql/src/planner/optimizer/decorrelate/decorrelate.rs

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -342,16 +342,6 @@ impl SubqueryRewriter {
342342
&mut left_conditions,
343343
&mut right_conditions,
344344
)?;
345-
let mut is_null_equal = Vec::new();
346-
for (i, (l, r)) in left_conditions
347-
.iter()
348-
.zip(right_conditions.iter())
349-
.enumerate()
350-
{
351-
if l.data_type()?.is_nullable() || r.data_type()?.is_nullable() {
352-
is_null_equal.push(i);
353-
}
354-
}
355345

356346
let marker_index = if let Some(idx) = subquery.projection_index {
357347
idx
@@ -366,7 +356,7 @@ impl SubqueryRewriter {
366356
equi_conditions: JoinEquiCondition::new_conditions(
367357
right_conditions,
368358
left_conditions,
369-
is_null_equal,
359+
vec![],
370360
),
371361
non_equi_conditions: vec![],
372362
join_type: JoinType::RightMark,

src/query/sql/src/planner/optimizer/decorrelate/subquery_rewriter.rs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -376,12 +376,7 @@ impl SubqueryRewriter {
376376
span: subquery.span,
377377
func_name: "not".to_string(),
378378
params: vec![],
379-
arguments: vec![ScalarExpr::FunctionCall(FunctionCall {
380-
span: subquery.span,
381-
func_name: "is_true".to_string(),
382-
params: vec![],
383-
arguments: vec![column_ref],
384-
})],
379+
arguments: vec![column_ref],
385380
})
386381
} else {
387382
column_ref

src/query/sql/src/planner/optimizer/rule/rewrite/push_down_filter_join/mark_join_to_semi_join.rs

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -37,19 +37,22 @@ pub fn convert_mark_to_semi_join(s_expr: &SExpr) -> Result<(SExpr, bool)> {
3737

3838
// remove mark index filter
3939
for (idx, predicate) in filter.predicates.iter().enumerate() {
40-
if !predicate.used_columns().contains(&mark_index) {
41-
continue;
42-
}
43-
44-
if let ScalarExpr::BoundColumnRef(col) = predicate {
45-
if col.column.index == mark_index {
40+
match predicate {
41+
ScalarExpr::BoundColumnRef(col) if col.column.index == mark_index => {
4642
find_mark_index = true;
4743
filter.predicates.remove(idx);
4844
break;
4945
}
46+
ScalarExpr::FunctionCall(func) if func.func_name == "not" => {
47+
// Check if the argument is mark index, if so, we won't convert it to semi join
48+
if let ScalarExpr::BoundColumnRef(col) = &func.arguments[0] {
49+
if col.column.index == mark_index {
50+
return Ok((s_expr.clone(), false));
51+
}
52+
}
53+
}
54+
_ => (),
5055
}
51-
// Check if the predicate used mark, if so, we won't convert it to semi join
52-
return Ok((s_expr.clone(), false));
5356
}
5457

5558
if !find_mark_index {

src/query/storages/orc/src/copy_into_table/processors/decoder.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ impl StripeDecoderForCopy {
107107
} = expr
108108
{
109109
if let Some(display_name) = display_name.strip_prefix("#!") {
110-
let typs = match field.data_type() {
110+
let types = match field.data_type() {
111111
DataType::Nullable(box DataType::Array(box DataType::Nullable(
112112
box DataType::Tuple(v),
113113
))) => v,
@@ -138,7 +138,7 @@ impl StripeDecoderForCopy {
138138
let mut v2 = vec![];
139139
for (i, p) in positions.iter().enumerate() {
140140
if *p < 0 {
141-
v2.push(ColumnBuilder::repeat_default(&typs[i], len).build());
141+
v2.push(ColumnBuilder::repeat_default(&types[i], len).build());
142142
} else {
143143
v2.push(v[*p as usize].clone());
144144
}

tests/sqllogictests/suites/tpcds/queries.test

Lines changed: 1 addition & 101 deletions
Original file line numberDiff line numberDiff line change
@@ -11306,6 +11306,7 @@ Adams John Marion Oak Ridge 206733 32377.89 1224.72 72590.31
1130611306

1130711307

1130811308
# Q69
11309+
onlyif todo
1130911310
query I
1131011311
SELECT cd_gender,
1131111312
cd_marital_status,
@@ -11359,107 +11360,6 @@ ORDER BY cd_gender,
1135911360
cd_credit_rating
1136011361
LIMIT 100;
1136111362
----
11362-
F D 2 yr Degree 1 2500 1 Low Risk 1
11363-
F D 2 yr Degree 1 4500 1 Good 1
11364-
F D 2 yr Degree 2 4500 2 Low Risk 2
11365-
F D 2 yr Degree 1 9000 1 Good 1
11366-
F D 2 yr Degree 1 9500 1 Good 1
11367-
F D 4 yr Degree 1 1000 1 Low Risk 1
11368-
F D 4 yr Degree 1 1500 1 Low Risk 1
11369-
F D 4 yr Degree 1 1500 1 Unknown 1
11370-
F D 4 yr Degree 1 2000 1 Good 1
11371-
F D 4 yr Degree 1 2500 1 Unknown 1
11372-
F D 4 yr Degree 1 4000 1 Unknown 1
11373-
F D 4 yr Degree 1 5500 1 Good 1
11374-
F D 4 yr Degree 1 7000 1 Good 1
11375-
F D 4 yr Degree 1 7000 1 High Risk 1
11376-
F D 4 yr Degree 1 8000 1 High Risk 1
11377-
F D 4 yr Degree 1 8500 1 Unknown 1
11378-
F D Advanced Degree 1 1000 1 Good 1
11379-
F D Advanced Degree 1 3500 1 Good 1
11380-
F D Advanced Degree 1 3500 1 High Risk 1
11381-
F D Advanced Degree 1 4000 1 Good 1
11382-
F D Advanced Degree 1 4000 1 High Risk 1
11383-
F D Advanced Degree 1 5000 1 High Risk 1
11384-
F D Advanced Degree 1 5500 1 Good 1
11385-
F D Advanced Degree 1 5500 1 Low Risk 1
11386-
F D Advanced Degree 1 6500 1 Low Risk 1
11387-
F D Advanced Degree 1 7000 1 High Risk 1
11388-
F D Advanced Degree 1 8000 1 Low Risk 1
11389-
F D Advanced Degree 1 8500 1 High Risk 1
11390-
F D Advanced Degree 1 9500 1 Low Risk 1
11391-
F D Advanced Degree 1 9500 1 Unknown 1
11392-
F D Advanced Degree 1 10000 1 Low Risk 1
11393-
F D College 1 1500 1 Low Risk 1
11394-
F D College 1 2500 1 Good 1
11395-
F D College 1 4000 1 High Risk 1
11396-
F D College 1 6000 1 Good 1
11397-
F D College 1 6000 1 High Risk 1
11398-
F D College 1 9000 1 High Risk 1
11399-
F D Primary 1 3000 1 High Risk 1
11400-
F D Primary 1 4000 1 Low Risk 1
11401-
F D Primary 1 4000 1 Unknown 1
11402-
F D Primary 1 4500 1 Unknown 1
11403-
F D Primary 1 5000 1 High Risk 1
11404-
F D Primary 1 5000 1 Unknown 1
11405-
F D Primary 1 6000 1 Good 1
11406-
F D Primary 1 6000 1 Unknown 1
11407-
F D Primary 1 8500 1 Unknown 1
11408-
F D Primary 1 9000 1 Unknown 1
11409-
F D Primary 1 9500 1 High Risk 1
11410-
F D Primary 1 9500 1 Unknown 1
11411-
F D Primary 1 10000 1 Good 1
11412-
F D Primary 2 10000 2 Low Risk 2
11413-
F D Secondary 1 500 1 Low Risk 1
11414-
F D Secondary 1 1000 1 High Risk 1
11415-
F D Secondary 1 3000 1 Good 1
11416-
F D Secondary 1 3500 1 Good 1
11417-
F D Secondary 1 6000 1 Low Risk 1
11418-
F D Secondary 1 6500 1 Unknown 1
11419-
F D Secondary 1 8500 1 High Risk 1
11420-
F D Secondary 1 10000 1 Low Risk 1
11421-
F D Unknown 1 1500 1 High Risk 1
11422-
F D Unknown 1 3000 1 Good 1
11423-
F D Unknown 1 3000 1 High Risk 1
11424-
F D Unknown 1 6000 1 Good 1
11425-
F D Unknown 1 6500 1 High Risk 1
11426-
F D Unknown 2 8000 2 Low Risk 2
11427-
F D Unknown 1 10000 1 Unknown 1
11428-
F M 2 yr Degree 1 2500 1 Low Risk 1
11429-
F M 2 yr Degree 3 4000 3 Unknown 3
11430-
F M 2 yr Degree 1 4500 1 Low Risk 1
11431-
F M 2 yr Degree 1 8500 1 High Risk 1
11432-
F M 4 yr Degree 1 1000 1 Good 1
11433-
F M 4 yr Degree 1 1500 1 Good 1
11434-
F M 4 yr Degree 1 4000 1 Low Risk 1
11435-
F M 4 yr Degree 1 4000 1 Unknown 1
11436-
F M 4 yr Degree 1 5000 1 Unknown 1
11437-
F M 4 yr Degree 1 5500 1 Low Risk 1
11438-
F M 4 yr Degree 1 6000 1 Good 1
11439-
F M 4 yr Degree 1 8000 1 High Risk 1
11440-
F M Advanced Degree 1 500 1 Low Risk 1
11441-
F M Advanced Degree 1 500 1 Unknown 1
11442-
F M Advanced Degree 1 2500 1 Good 1
11443-
F M Advanced Degree 1 3500 1 High Risk 1
11444-
F M Advanced Degree 2 5500 2 Unknown 2
11445-
F M Advanced Degree 1 6500 1 Good 1
11446-
F M Advanced Degree 1 6500 1 Unknown 1
11447-
F M Advanced Degree 1 8000 1 Low Risk 1
11448-
F M Advanced Degree 1 9500 1 Good 1
11449-
F M Advanced Degree 1 10000 1 Low Risk 1
11450-
F M College 1 1000 1 Unknown 1
11451-
F M College 1 3000 1 Good 1
11452-
F M College 2 5000 2 High Risk 2
11453-
F M College 1 6000 1 Low Risk 1
11454-
F M College 1 7000 1 High Risk 1
11455-
F M College 1 8000 1 Good 1
11456-
F M College 1 9000 1 Good 1
11457-
F M College 2 9000 2 High Risk 2
11458-
F M College 1 10000 1 High Risk 1
11459-
F M Primary 1 1000 1 Low Risk 1
11460-
F M Primary 1 1500 1 High Risk 1
11461-
F M Primary 1 7000 1 Good 1
11462-
1146311363

1146411364

1146511365
# Q70

0 commit comments

Comments
 (0)