Skip to content

Conversation

@zeroshade
Copy link
Member

fixes #3103

Adding new cases to arrFromVal to allow for handling time.Time and arrow.Timestamp and arrow.Time32/arrow.Time64 types. This only works when the parameter schema is provided by the FlightSQL server side when utilizing a prepared statement or otherwise.

If we don't have the parameter schema, then it will error as usual.

@zeroshade zeroshade requested a review from lidavidm July 7, 2025 22:04
@github-actions github-actions bot added this to the ADBC Libraries 20 milestone Jul 7, 2025
@lidavidm lidavidm changed the title fix(go/adbc/sqldriver): handle timestamp/time.Time values for input feat(go/adbc/sqldriver): handle timestamp/time.Time values for input Jul 8, 2025
buffers = append(buffers, memory.NewBufferBytes(buf))
case arrow.Time32:
if dt == nil || dt.ID() != arrow.TIME32 {
panic(errors.New("can only create array from arrow.Time32 with known type"))
Copy link
Member

Choose a reason for hiding this comment

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

Instead of panicking, I think we should propagate the error upwards

Copy link
Member

Choose a reason for hiding this comment

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

It might also be better to say something like "can only create array from ... when statement is prepared and server provides parameter schema"

Copy link
Member Author

Choose a reason for hiding this comment

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

We would only run into the issue when they try to execute with the passed in params, not when it is prepared. The issue is if they pass an arrow.Time32 when the server didn't provide a parameter schema, we don't know what type this should be (because of the time unit).

That said, it's easy enough to propagate the error upwards instead of panicking, which i'll do.

Copy link
Member

Choose a reason for hiding this comment

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

Right, I'm suggesting that the error message should say what they need to do

@zeroshade zeroshade merged commit 30e8856 into apache:main Jul 9, 2025
21 checks passed
@zeroshade zeroshade deleted the sqldriver-timestamps branch July 9, 2025 18:51
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.

Go SQL driver: unable to handle time.Time values

2 participants