Skip to content

Conversation

@aiguofer
Copy link
Contributor

@aiguofer aiguofer commented Sep 7, 2025

What's Changed

Turns out AvaticaSite.get does not account for TIMESTAMP_WITH_TIMEZONE types so we add support on an override function.

Closes #818.
Closes #839.

@aiguofer
Copy link
Contributor Author

aiguofer commented Sep 7, 2025

I added an initial basic test with no assertions. This test ensures all methods succeed and prints out the results of each.

This is a good starting point to add more tests and ensure we get the right values under all circumstances, including changing the timezone property on the driver (this is handled by Avatica) as well as changing the default JVM timezone.

ImmutableList.of(
Field.nullable("no_tz", new ArrowType.Timestamp(TimeUnit.MILLISECOND, null)),
Field.nullable("utc", new ArrowType.Timestamp(TimeUnit.MILLISECOND, "UTC")),
Field.nullable("utc+1", new ArrowType.Timestamp(TimeUnit.MILLISECOND, "GMT+1:00")),
Copy link
Member

Choose a reason for hiding this comment

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

Shouldn't the zone just be "+01:00"?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

good question!! I couldn't really find a standard set of values. It seems Arrow doesn't really care at all and just keeps it as a string w/o any checks and it's up to the consumer to do something with it. I just used a value that worked with Java.

Copy link
Member

Choose a reason for hiding this comment

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

I suppose the library does not validate it, but it is supposed to be either a timezone name or just an offset: https://github.com/apache/arrow/blob/37faf3e79512c2c036b004d80770bb522af035f1/format/Schema.fbs#L385-L395

There is Etc/GMT-1

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oof... that complicates things even more since Java doesn't recognize just an offset, it wants it preceded by GMT.

Seems like we also need:

  • logic to validate the offset/timezone values provided when creating an Arrow type
  • logic to convert the string value of the arrow timezone to a Java Timezone or Offset object

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@lidavidm I updated the offsets to GMT+1 and GMT-1 for now, which seems to work correctly. I will create a separate issue for validation.

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.

Just one last question, thanks

Cursor.Accessor accessor;
try {
accessor = accessorList.get(columnIndex - 1);
} catch (IndexOutOfBoundsException var3) {
Copy link
Member

Choose a reason for hiding this comment

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

Nit but why var3 and not e, exc, etc.? (This wasn't copied from a decompiler was it?)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ohhh I copy pasted this from navigating to the decompiled class in AvaticaResultSet... I'll change it :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@lidavidm btw, this has been fixed already

Copy link
Member

Choose a reason for hiding this comment

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

Thanks for the ping, sorry, I was out at back to back conferences and I'm still getting back into things 😅

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.

Let's take this as a first step towards a more thoroughly tested/implemented driver. Thanks!

@lidavidm
Copy link
Member

lidavidm commented Oct 6, 2025

It seems checkstyle is unhappy - perhaps compile locally? (The parallelism in CI makes the log really annoying to read...)

Turns out AvaticaSite.get does not account for TIMESTAMP_WITH_TIMEZONE
types so we add support on an override function.
@aiguofer aiguofer force-pushed the fix_support_for_timestamp_with_timezone branch from d34df0f to 0702685 Compare October 6, 2025 17:37
@aiguofer
Copy link
Contributor Author

aiguofer commented Oct 6, 2025

@lidavidm found the issues, just small docstring problems that have now been fixed.

@lidavidm lidavidm merged commit d31d9b0 into apache:main Oct 7, 2025
19 of 24 checks passed
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