Skip to content

Commit

Permalink
Review feedback changes
Browse files Browse the repository at this point in the history
  • Loading branch information
mkaruza committed Sep 20, 2024
1 parent 5ccad19 commit 689cec9
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/pgduckdb_types.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -987,9 +987,9 @@ InsertTupleIntoChunk(duckdb::DataChunk &output, duckdb::shared_ptr<PostgresScanG

bool valid_tuple = true;

/* First we are fetching all required columns oredered by column id
/* First we are fetching all required columns ordered by column id
* and than we need to write this tuple into output vector. Output column id list
* could be out of order so we need to match column values from first
* could be out of order so we need to match column values from ordered list.
*/

/* Read heap tuple with all required columns. */
Expand Down
17 changes: 17 additions & 0 deletions test/regression/expected/query_filter.out
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,15 @@ SELECT a, b FROM query_filter_output_column WHERE b = 't1';
2 | t1
(2 rows)

-- Column ids list used because both of fetched column are used after scan.
-- Swapped order of table columns.
SELECT b, a FROM query_filter_output_column WHERE b = 't1';
b | a
----+---
t1 | 1
t1 | 2
(2 rows)

-- Projection ids list will be used (column `b`is not needed after scan)
SELECT a, c FROM query_filter_output_column WHERE b = 't1';
a | c
Expand All @@ -75,4 +84,12 @@ SELECT a, c FROM query_filter_output_column WHERE b = 't1';
2 | 2
(2 rows)

-- All columns in tuple unordered
SELECT c, a, b FROM query_filter_output_column WHERE a = 2;
c | a | b
---+---+----
2 | 2 | t1
1 | 2 | t2
(2 rows)

DROP TABLE query_filter_output_column;
5 changes: 5 additions & 0 deletions test/regression/sql/query_filter.sql
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@ INSERT INTO query_filter_output_column VALUES (1, 't1', 1.0), (2, 't1', 2.0), (2
SELECT b FROM query_filter_output_column WHERE a = 2;
-- Column ids list used because both of fetched column are used after scan
SELECT a, b FROM query_filter_output_column WHERE b = 't1';
-- Column ids list used because both of fetched column are used after scan.
-- Swapped order of table columns.
SELECT b, a FROM query_filter_output_column WHERE b = 't1';
-- Projection ids list will be used (column `b`is not needed after scan)
SELECT a, c FROM query_filter_output_column WHERE b = 't1';
-- All columns in tuple unordered
SELECT c, a, b FROM query_filter_output_column WHERE a = 2;
DROP TABLE query_filter_output_column;

0 comments on commit 689cec9

Please sign in to comment.