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

PHOENIX-6881 Implement the applicable Date/Time features from JDBC 4.2 #1571

Closed
wants to merge 2 commits into from

Conversation

stoty
Copy link
Contributor

@stoty stoty commented Mar 3, 2023

No description provided.

Copy link
Contributor

@richardantal richardantal left a comment

Choose a reason for hiding this comment

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

LGTM

try {
rs.getObject(2, Long.class);
fail("We only implement byte[]");
} catch (SQLException e) {
Copy link
Contributor

Choose a reason for hiding this comment

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

We could assert on the errorCode or the error message containing Type mismatch when catching these expected Exceptions.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Makes sense.

if (x != null) {
if (connection.isApplyTimeZoneDisplacement()) {
x = DateUtil.applyInputDisplacement(x, cal.getTimeZone());
return DateUtil.applyInputDisplacement(x, cal.getTimeZone());
} else {
int nanos = x.getNanos();
x = new Timestamp(x.getTime());
x.setNanos(nanos);
Copy link
Contributor

Choose a reason for hiding this comment

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

It feels a bit inconsistent to the other process functions, but I see the reason why

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, handling nanos is awkward with java.sql.Timestamp.

public Object toObject(byte[] bytes, int offset, int length, PDataType actualType,
SortOrder sortOrder, Integer maxLength, Integer scale, Class jdbcType)
throws SQLException {
// FIXME according to the JDBC spec, we should support all these types:
Copy link
Contributor

Choose a reason for hiding this comment

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

Could you please create a follow up ticket for this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Opened PHOENIX-6915

@stoty stoty closed this Mar 21, 2023
@stoty
Copy link
Contributor Author

stoty commented Mar 21, 2023

Thank you, I have implemented your suggestion in the test before commit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants