-
Notifications
You must be signed in to change notification settings - Fork 0
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
[DRAFT] [JDBC] Fix ResultSet.getTime()
#192
[DRAFT] [JDBC] Fix ResultSet.getTime()
#192
Conversation
Result.Set.getTime()
ResultSet.getTime()
ResultSet.getTime()
ResultSet.getTime()
Codecov Report
@@ Coverage Diff @@
## integ-fix-resultset-get-time #192 +/- ##
==================================================================
- Coverage 98.32% 95.83% -2.49%
Complexity 3552 3552
==================================================================
Files 346 356 +10
Lines 8756 9414 +658
Branches 554 673 +119
==================================================================
+ Hits 8609 9022 +413
- Misses 142 334 +192
- Partials 5 58 +53
Flags with carried forward coverage won't be shown. Click here to find out more.
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
Signed-off-by: Margarit Hakobyan <[email protected]>
Signed-off-by: Margarit Hakobyan <[email protected]>
Signed-off-by: Margarit Hakobyan <[email protected]>
Signed-off-by: Margarit Hakobyan <[email protected]>
Signed-off-by: Margarit Hakobyan <[email protected]>
Signed-off-by: Margarit Hakobyan <[email protected]>
8f8eebb
to
8d15c35
Compare
log.debug(() -> logEntry("getTime (%d, %s)", columnIndex, | ||
cal == null ? "null" : "Calendar TZ= " + cal.getTimeZone())); | ||
checkCursorOperationPossible(); | ||
Time value = getTimeX(columnIndex, cal); |
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.
this will get called with or without debug. Can we put this in the log.debug() statement below?
log.debug(() -> logExit("getTime", getTimeX(columnIndex, cal)));
cal == null ? "null" : "Calendar TZ= " + cal.getTimeZone())); | ||
checkCursorOperationPossible(); | ||
Time value = getTimeX(getColumnIndex(columnLabel), cal); | ||
log.debug(() -> logExit("getTime", value)); |
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.
same here?
public Time asTime(String value) throws SQLException { | ||
return localTimetoSqlTime(toLocalTime(value)); | ||
} | ||
if (value.length() > 10) { |
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.
instead of checking for length, can we try..catch an error from DateTimeFormatter
if the pattern doesn't match?
related: opensearch-project/sql-jdbc#20 |
Signed-off-by: Margarit Hakobyan <[email protected]>
checkCursorOperationPossible(); | ||
log.debug(() -> { | ||
try { | ||
return logExit("getTime", getTimeX(columnIndex, cal)); |
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.
Whoops. This is not right. I misunderstood, and thought getTimeX was only needed for debug calls... but we certainly don't want this. We should only call getTimeX once. Please revert this back to what you had before.
checkCursorOperationPossible(); | ||
log.debug(() -> { | ||
try { | ||
return logExit("getTime", getTimeX(getColumnIndex(columnLabel), cal)); |
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.
same here. We really should only call getTimeX once.
Signed-off-by: Margarit Hakobyan <[email protected]>
ResultSet.getTime()
ResultSet.getTime()
} catch (DateTimeParseException exception) { | ||
time = Time.valueOf(value); | ||
} |
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 it can fallback to catch
block? Won't it throw an exception from there if value
is not convertable to Time
?
An upstream PR in |
Signed-off-by: Margarit Hakobyan [email protected]
Description
ResultSet.getTime() returns non-null value reflecting the retrieved time instead of null.
PR in
sql-jdbc
repo https://github.com/Bit-Quill/sql-jdbc/pull/1/filesIssues Resolved
opensearch-project/sql-jdbc#20
Check List
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.