-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
rowexec: fix column mapping for index join
Index join code has been recently merged into the join reader processor. However, the setup of the joiner base has been done slightly incorrectly: the join reader core returns the whole rows from the table (i.e. all columns from the "right") and ignores columns coming from the input (from the "left"), but previously we were incorrectly passing in non-empty types for the left side - this would result in an incorrectly setup ProcOutputHelper. This could result in a crash when a row doesn't pass the filter and the verbose logging is enabled. This had a limited impact though because the output rows matched with the indexed vars referring to the columns of that row. Release note: None
- Loading branch information
1 parent
5f902d0
commit ed5383e
Showing
2 changed files
with
46 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
# Regression test for incorrect post-processing setup in the join reader when | ||
# performing an index join (#54226). | ||
|
||
statement ok | ||
SET CLUSTER SETTING sql.stats.automatic_collection.enabled = false; | ||
CREATE TABLE lineitem | ||
( | ||
l_orderkey int PRIMARY KEY, | ||
l_extendedprice float NOT NULL, | ||
l_shipdate date NOT NULL, | ||
INDEX l_sd (l_shipdate ASC) | ||
); | ||
INSERT INTO lineitem VALUES (1, 200, '1994-01-01'); | ||
ALTER TABLE lineitem INJECT STATISTICS '[ | ||
{ | ||
"columns": ["l_orderkey"], | ||
"created_at": "2018-01-01 1:00:00.00000+00:00", | ||
"row_count": 6001215, | ||
"distinct_count": 1500000 | ||
}, | ||
{ | ||
"columns": ["l_extendedprice"], | ||
"created_at": "2018-01-01 1:00:00.00000+00:00", | ||
"row_count": 6001215, | ||
"distinct_count": 1000000 | ||
}, | ||
{ | ||
"columns": ["l_shipdate"], | ||
"created_at": "2018-01-01 1:00:00.00000+00:00", | ||
"row_count": 6001215, | ||
"distinct_count": 2500 | ||
} | ||
]'; | ||
SELECT crdb_internal.set_vmodule('processorsbase=4') | ||
|
||
query R | ||
SELECT sum(l_extendedprice) FROM lineitem WHERE l_shipdate >= DATE '1994-01-01' AND l_shipdate < DATE '1994-01-01' + INTERVAL '1' YEAR AND l_extendedprice < 100 | ||
---- | ||
NULL |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters