Added a new JDBC driver parameter - 'TimeZoneID'#7252
Added a new JDBC driver parameter - 'TimeZoneID'#7252Shashi-Jaiswal wants to merge 1 commit intotrinodb:masterfrom
Conversation
|
Thank you for your pull request and welcome to our community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file. In order for us to review and merge your code, please submit the signed CLA to cla@trino.io. For more information, see https://github.com/trinodb/cla. |
| { | ||
| public TimeZoneID() | ||
| { | ||
| super("TimeZoneID", NOT_REQUIRED, ALLOWED, STRING_CONVERTER); |
There was a problem hiding this comment.
"Timezone" to be consistent with CLI's --timezone
There was a problem hiding this comment.
Let's make it lowercase timezone to be consistent with other properties (all are lowercase except Kerberos and SSL)
| public Optional<String> getTimeZoneID() | ||
| throws SQLException | ||
| { | ||
| Optional<String> tzId = TIMEZONE_ID.getValue(properties); |
There was a problem hiding this comment.
avoid abbreviations, call it just timezone
| List<String> ids = Arrays.asList(java.util.TimeZone.getAvailableIDs()); | ||
| if (ids.contains(tzId.get())) { | ||
| return tzId; | ||
| } | ||
| throw new SQLException("Specified TimeZoneID is not supported"); |
There was a problem hiding this comment.
Use ZoneId for validation and then just return it
if (timezone.isPresent()) {
try {
return ZoneId.of(timezone.get());
}
catch (DateTimeException | ZoneRulesException e) {
throw new SQLException("Specified timezone is not supported: " + timezone.get(), e);
}
}There was a problem hiding this comment.
Also, we don't need to return Optional at all, since we can return ZoneId.systemDefault() here when parameter is not set.
|
For the test, see the test would be similar, just the initialization would go into connection string rather than using |
Cherry-pick of trinodb/trino#7252 Solves prestodb#16680 Co-authored-by: Shashikant Jaiswal <shashi@okera.com>
Cherry-pick of trinodb/trino#7252 Solves #16680 Co-authored-by: Shashikant Jaiswal <shashi@okera.com>
|
👋 @Shashi-Jaiswal - this PR is inactive and doesn't seem to be under development. If you'd like to continue work on this at any point in the future, feel free to re-open. |
Hello Team,
I have added a new JDBC driver parameter: TimeZoneID. This parameter may be specified as part of URI
or as part of properties passed to DriverManager. Both of the following examples are equivalent:
Could you please let me know where can I write tests for this change? And if there is anything else needed for this pull request to be merged?
Fixes #7158