Add a new JDBC driver parameter - timeZoneID#16756
Conversation
There was a problem hiding this comment.
@v-jizhang Thanks for the contribution, changes look good. Some minor recommendations.
Also, please squash the commits.
There was a problem hiding this comment.
We can update the description to something like Timezone to be used for timestamp columns in query output
There was a problem hiding this comment.
Also changed timeZoneID to timeZoneId
There was a problem hiding this comment.
NIT: To follow camel case convention, I think we should name the class TimeZoneId
There was a problem hiding this comment.
We can modify the return type of this method to String and return TimeZone.getDefault().getID() when the parameter is not set.
There was a problem hiding this comment.
Suggestion: Since we are not using ZoneId, we can probably validate as follows: (NIT: also updated the parameter name timeZoneID to match with actual name in the exception message)
| if (timezone.isPresent()) { | |
| try { | |
| // Validate timezone and return it. | |
| ZoneId.of(timezone.get()); | |
| return timezone; | |
| } | |
| catch (DateTimeException e) { | |
| throw new SQLException("Specified TimeZoneID is not supported: " + timezone.get(), e); | |
| } | |
| } | |
| if (timezone.isPresent()) { | |
| List<String> timeZoneIds = Arrays.asList(TimeZone.getAvailableIDs()); | |
| if (!timeZoneIds.contains(timezone.get())) { | |
| throw new SQLException("Specified timeZoneID is not supported: " + timezone.get()); | |
| } | |
| return timezone.get(); | |
| } |
There was a problem hiding this comment.
This can be updated based on the changes to the method getTimeZoneID
09f5730 to
8e2256a
Compare
|
@yingsu00 or @tdcmeehan Could you please give the final pass and approve this PR? |
dddd0f9 to
1895e45
Compare
Cherry-pick of trinodb/trino#7252 Solves prestodb#16680 Co-authored-by: Shashikant Jaiswal <shashi@okera.com>
e5a8501 to
dad4504
Compare
|
@tdcmeehan could you please merge this PR, seems all checks have passed now. |
Cherry-pick of trinodb/trino#7252
Co-authored-by: Shashikant Jaiswal shashi@okera.com
Test plan - Added test TestPrestoDriver$testTimeZoneIdParameter
Solves #16680