Skip to content

Conversation

sanskritimbora
Copy link

@sanskritimbora sanskritimbora commented Sep 16, 2025

As a developer I want to be able to do query parameter/JDBC Statement binding for Date, Time and Timestamp date types using an iso formatted string. This will help enable the use of 3rd party tools that use ISO string formats for bindings.

Given An Anybase JDBC connection and query that uses parameterization of a Date, Time and/or Timestamp field
When setParameter is called with a valid ISO formatted string
Then Anybase accepts the request and returns appropriate success responses

Sample client use case:

    insertStatement.setString(1, "2025-08-14T15:53:00.000Z");
    insertStatement.setString(2, "2025-04-01");
    insertStatement.setString(3, "21:39:50");

@lidavidm
Copy link
Member

Can you create an issue for this, and properly name the PR? ("GH-NNN: Allow binding ISO timestamp strings to date/time types" or something)

@sanskritimbora
Copy link
Author

Yes, I have been waiting to receive approval to create a ticket on ASF for Arrow Project. I have sent an email to the dev mail - dev@arrow.apache.org. Once I create the issue I will add more details to the PR.

Is there anything more I can do to expedite this process of receiving access?

@lidavidm
Copy link
Member

We use GitHub issues. You should not need approval.

@lidavidm
Copy link
Member

(Note that we do NOT use JIRA.)

@kou
Copy link
Member

kou commented Sep 17, 2025

FYI: You can create a new issue from https://github.com/apache/arrow-java/issues/new/choose .

@sanskritimbora sanskritimbora changed the title Allow-ISO-String-Binding-for-Date-Time-TimeStamp [GH-853] Allow-ISO-String-Binding-for-Date-Time-TimeStamp Sep 17, 2025
@sanskritimbora sanskritimbora changed the title [GH-853] Allow-ISO-String-Binding-for-Date-Time-TimeStamp GH-853 Allow-ISO-String-Binding-for-Date-Time-TimeStamp Sep 17, 2025
@sanskritimbora
Copy link
Author

Fixes #852

@sanskritimbora
Copy link
Author

Thank you for the quick responses and the links, I have linked the PR to the issue created.

@sanskritimbora sanskritimbora changed the title GH-853 Allow-ISO-String-Binding-for-Date-Time-TimeStamp GH-853: Allow-ISO-String-Binding-for-Date-Time-TimeStamp Sep 17, 2025
@lidavidm
Copy link
Member

Can you fix the title?

Copy link
Member

@lidavidm lidavidm left a comment

Choose a reason for hiding this comment

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

Thanks for adding new tests!

TypedValue typedValue = TypedValue.create(ColumnMetaData.Rep.STRING.toString(), dateStr);
boolean result = converter.bindParameter(vector, typedValue, 0);
assertTrue(result);
assertEquals((int) LocalDate.parse(dateStr).toEpochDay(), vector.get(0));
Copy link
Member

Choose a reason for hiding this comment

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

Isn't this wrong? DateMilliVector is supposed to store millisecond timestamps representing dates (yes, this is a bad representation) so it should be toEpochDay() * 24 * 60 * 60 * 1000.

Copy link
Author

Choose a reason for hiding this comment

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

That is correct, I made the correction, thanks for pointing out :)

Copy link
Member

Choose a reason for hiding this comment

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

Hmm, so we only allow timestamps with the Z suffix - but we can bind to naive timestamp vectors too. And we don't allow timestamps without the suffix. (We could always relax that later, though.)

Copy link
Author

Choose a reason for hiding this comment

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

Yes, that's correct. Currently, we only accept timestamps with the Z suffix, but we can easily relax this restriction later to support naive timestamps if needed.

Copy link
Member

Choose a reason for hiding this comment

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

I think we shouldn't allow binding timestamps with timezones to columns that don't have timezones in principle. Although what happens the Z suffix is probably unambiguous in this case I think if we ever allow other timezones then it becomes a problem.

Copy link
Member

Choose a reason for hiding this comment

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

@jbonofre or @aiguofer any opinions on the behavior here?

@sanskritimbora sanskritimbora changed the title GH-853: Allow-ISO-String-Binding-for-Date-Time-TimeStamp GH-853: Allow ISO String Binding for Date, Time, and Timestamp Sep 18, 2025
Copy link
Member

@lidavidm lidavidm left a comment

Choose a reason for hiding this comment

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

I think that's the last question I have.

Copy link
Member

Choose a reason for hiding this comment

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

@jbonofre or @aiguofer any opinions on the behavior here?

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

Successfully merging this pull request may close these issues.

3 participants