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

Improve Redshift #15365

Merged
merged 6 commits into from
Dec 12, 2022
Merged

Improve Redshift #15365

merged 6 commits into from
Dec 12, 2022

Conversation

dain
Copy link
Member

@dain dain commented Dec 11, 2022

Description

This PR contains many improvements for Redshift with a full test suite. Currently the test suite must be run manually.

I have run the test manually and they all pass.

Fixes #14697

This was co-authored by: @alexjo2144 @ebyhr @findepi @findinpath @grantatspothero @hashhar @jirassimok @kokosing @losipiuk @Praveen2112 @raunaqmorarka @skrzypo987 @ssheikin @wendigo

Release notes

( ) This is not user-visible or docs only and no release notes are required.
( ) Release notes are required, please propose a release note for me.
(x) Release notes are required, with the following suggested text:

# Redshift
* Add aggregation, join, and top N pushdown ({issue}`15365`)
* Implement DELETE ({issue}`15365`)
* Implement full type mapping ({issue}`15365`)
* Add schema, table and column name length checks ({issue}`15365`)

@dain dain requested a review from electrum December 11, 2022 23:18
@cla-bot cla-bot bot added the cla-signed label Dec 11, 2022
plugin/trino-redshift/README.md Outdated Show resolved Hide resolved
return new DriverConnectionFactory(new Driver(), config.getConnectionUrl(), getDriverProperties(), credentialProvider);
}

private static Properties getDriverProperties()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this related to adding tests?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes it is needed for the tests to run

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not limited to tests - this applies to the connection factory itself and is meant to improve performance.

Comment on lines +187 to +192
<excludes>
<exclude>**/TestRedshiftAutomaticJoinPushdown.java</exclude>
<exclude>**/TestRedshiftConnectorTest.java</exclude>
<exclude>**/TestRedshiftTableStatisticsReader.java</exclude>
<exclude>**/TestRedshiftTypeMapping.java</exclude>
</excludes>
Copy link
Member

@hashhar hashhar Dec 12, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no profile which includes it? How can I run the tests manually (outside of IDE)?

}

// Redshift avg function rounds down resulting decimal.
// To match Presto avg semantics, we extend scale by 1 and round result to target scale.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Presto -> Trino?

DecimalType type = (DecimalType) columnHandle.getColumnType();
verify(aggregateFunction.getOutputType().equals(type));

// When decimal type has maximum precision we can get result that is not matching Presto avg semantics.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Presto -> Trino

return new DriverConnectionFactory(new Driver(), config.getConnectionUrl(), getDriverProperties(), credentialProvider);
}

private static Properties getDriverProperties()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not limited to tests - this applies to the connection factory itself and is meant to improve performance.

@findepi
Copy link
Member

findepi commented Dec 19, 2022

@@ -23,12 +23,22 @@
<artifactId>trino-base-jdbc</artifactId>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change is backward incompatible change. It is changing semantics of Redshift connector. One could say that after this change it is a new different Redshift connector. Most of the existing production usages of Redshift will now require a migration to make Trino upgrade. Such migration is a binary step. Either user is adjusted to use 403 Redshift connector or 404. There is no middle ground, so rolling back such migration is also difficult.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's restore old one as redshift-legacy?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure if it is enough. I would prefer to rename the existing one to mark it is deprecated (legacy) and create a new one with unique name (redshift-v2?). Then after some time once legacy is removed I would rename the one to redshift)

@martint
Copy link
Member

martint commented Dec 19, 2022

Add this to each commit's message.

Done

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

Redshift connector deletes do not delete data
6 participants