-
Notifications
You must be signed in to change notification settings - Fork 392
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
[#1154] fix(trino-connector): Fix the issue with joins causing errors in PostgreSQL. #1177
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
61 changes: 61 additions & 0 deletions
61
...on-test/src/test/resources/trino-queries/catalogs/jdbc-postgresql/00003_join_pushdown.sql
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,61 @@ | ||
CREATE SCHEMA "test.jdbc-postgresql".gt_db1; | ||
|
||
use "test.jdbc-postgresql".gt_db1; | ||
|
||
CREATE TABLE "test.jdbc-postgresql".gt_db1.employee_performance ( | ||
employee_id integer, | ||
evaluation_date date, | ||
rating integer | ||
) | ||
COMMENT 'comment'; | ||
|
||
CREATE TABLE "test.jdbc-postgresql".gt_db1.employees ( | ||
employee_id integer, | ||
department_id integer, | ||
job_title varchar(100), | ||
given_name varchar(100), | ||
family_name varchar(100), | ||
birth_date date, | ||
hire_date date | ||
) | ||
COMMENT 'comment'; | ||
|
||
INSERT INTO "test.jdbc-postgresql".gt_db1.employee_performance (employee_id, evaluation_date, rating) VALUES | ||
(1, DATE '2018-02-24', 4), | ||
(1, DATE '2016-12-25', 7), | ||
(1, DATE '2023-04-07', 4), | ||
(3, DATE '2012-11-08', 7), | ||
(3, DATE '2019-09-15', 2), | ||
(3, DATE '2017-06-21', 8), | ||
(3, DATE '2019-07-16', 4), | ||
(3, DATE '2015-10-06', 4), | ||
(3, DATE '2021-01-05', 6), | ||
(3, DATE '2014-10-24', 4); | ||
|
||
INSERT INTO "test.jdbc-postgresql".gt_db1.employees (employee_id, department_id, job_title, given_name, family_name, birth_date, hire_date) VALUES | ||
(1, 1, 'Manager', 'Gregory', 'Smith', DATE '1968-04-15', DATE '2014-06-04'), | ||
(2, 1, 'Sales Assistant', 'Owen', 'Rivers', DATE '1988-08-13', DATE '2021-02-05'), | ||
(3, 1, 'Programmer', 'Avram', 'Lawrence', DATE '1969-11-21', DATE '2010-09-29'), | ||
(4, 1, 'Sales Assistant', 'Burton', 'Everett', DATE '2001-12-07', DATE '2016-06-25'), | ||
(5, 1, 'Sales Assistant', 'Cedric', 'Barlow', DATE '1972-02-02', DATE '2012-08-15'), | ||
(6, 2, 'Sales Assistant', 'Jasper', 'Mack', DATE '2002-03-29', DATE '2020-09-13'), | ||
(7, 1, 'Sales Assistant', 'Felicia', 'Robinson', DATE '1973-08-21', DATE '2023-05-14'), | ||
(8, 3, 'Sales Assistant', 'Mason', 'Steele', DATE '1964-05-19', DATE '2019-02-06'), | ||
(9, 3, 'Programmer', 'Bernard', 'Cameron', DATE '1995-08-27', DATE '2018-07-12'), | ||
(10, 2, 'Programmer', 'Chelsea', 'Wade', DATE '2007-01-29', DATE '2016-04-16'); | ||
|
||
SELECT | ||
given_name, | ||
family_name, | ||
rating | ||
FROM "test.jdbc-postgresql".gt_db1.employee_performance AS p | ||
JOIN "test.jdbc-postgresql".gt_db1.employees AS e | ||
ON p.employee_id = e.employee_id | ||
ORDER BY | ||
rating DESC | ||
LIMIT 10; | ||
|
||
drop table "test.jdbc-postgresql".gt_db1.employee_performance; | ||
drop table "test.jdbc-postgresql".gt_db1.employees; | ||
|
||
drop schema "test.jdbc-postgresql".gt_db1; |
28 changes: 28 additions & 0 deletions
28
...on-test/src/test/resources/trino-queries/catalogs/jdbc-postgresql/00003_join_pushdown.txt
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,28 @@ | ||
CREATE SCHEMA | ||
|
||
USE | ||
|
||
CREATE TABLE | ||
|
||
CREATE TABLE | ||
|
||
INSERT: 10 rows | ||
|
||
INSERT: 10 rows | ||
|
||
"Avram","Lawrence","8" | ||
"Avram","Lawrence","7" | ||
"Gregory","Smith","7" | ||
"Avram","Lawrence","6" | ||
"Avram","Lawrence","4" | ||
"Avram","Lawrence","4" | ||
"Gregory","Smith","4" | ||
"Gregory","Smith","4" | ||
"Avram","Lawrence","4" | ||
"Avram","Lawrence","2" | ||
|
||
DROP TABLE | ||
|
||
DROP TABLE | ||
|
||
DROP SCHEMA |
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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When will we use a non-null dynamicFilter?
Can you explain the real cause of the problem more clearly?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the current implementation of
dynamicFilter
, it includesColumnHandle
, and this columnhandle is currentlyGravitinoColumnHandle
. When it's passed to the following internal connector, such as PG, it will throw an error. The PG connector only acceptsJDBCColumnHandle
. Here, we pass DynamicFilter.EMPTY, which can temporarily solve this problem.