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

Adds support to string coercions #18

Merged
merged 2 commits into from
Jan 14, 2025
Merged

Adds support to string coercions #18

merged 2 commits into from
Jan 14, 2025

Conversation

desaikd
Copy link
Collaborator

@desaikd desaikd commented Dec 24, 2024

Description

This PR adds support for text coercion in native trino similar to ion-hive-srede.

Example

For given RowType.rowType(field("foo", VARCHAR)) and Ion value as "{ foo: 31.50 }", the resulting value in native trino should be a string "31.50"

List of changes:

  • Adds coercionToStringValue which converts given Ion value into string representation. (We can not use IonSystem's iterate method to load an IonValue and use toString because the reader would already be at the next value, pointing to EOF)
  • Adds textCoercion configuration option for VARHCAR and CHAR types in the decoder.
  • Adds text coercion tests for scalar and container types in TestIonFormat.

return reader.timestampValue().toString();
case SYMBOL:
case STRING:
return reader.stringValue();
Copy link
Owner

Choose a reason for hiding this comment

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

Wouldn't this generate malformed Ion when used recursively?

@desaikd desaikd force-pushed the text-coercion-support branch 2 times, most recently from f16932a to c5b284f Compare January 13, 2025 22:35
@desaikd desaikd force-pushed the text-coercion-support branch from c5b284f to b3c8a5a Compare January 13, 2025 23:09
@desaikd desaikd merged commit 3f00aa9 into master Jan 14, 2025
56 checks passed
rmarrowstone pushed a commit that referenced this pull request Jan 14, 2025
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.

2 participants