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

Correct numeric type mapping of Snowflake Connector #21755

Merged
merged 2 commits into from
May 17, 2024
Merged

Conversation

lxynov
Copy link
Member

@lxynov lxynov commented Apr 29, 2024

Description

Final part of #21012. Fixing #20977.

Without this commit, Snowflake session property JDBC_TREAT_DECIMAL_AS_INT is set to default value, which is TRUE. This will cause a problem when decimal values exceed Long.MAX_VALUE.

Reference: https://docs.snowflake.com/en/sql-reference/data-types-numeric, https://docs.snowflake.com/en/sql-reference/parameters#jdbc-treat-decimal-as-int

Additional context and related issues

Release notes

( ) This is not user-visible or is docs only, and no release notes are required.
( ) Release notes are required. Please propose a release note for me.
(x) Release notes are required, with the following suggested text:

# Snowflake Connector
* Correct numeric type mapping of Snowflake Connector. (https://github.com/trinodb/trino/issues/20977)

@cla-bot cla-bot bot added the cla-signed label Apr 29, 2024
@github-actions github-actions bot added the docs label Apr 29, 2024
@lxynov lxynov requested a review from ebyhr April 29, 2024 23:34
@ebyhr
Copy link
Member

ebyhr commented Apr 30, 2024

/test-with-secrets sha=71772a083bde0174b2977a996b45ef4d233327cf

Copy link

github-actions bot commented Apr 30, 2024

The CI workflow run with tests that require additional secrets finished as failure: https://github.com/trinodb/trino/actions/runs/8887484201

@ebyhr
Copy link
Member

ebyhr commented Apr 30, 2024

@lxynov
Copy link
Member Author

lxynov commented Apr 30, 2024

@ebyhr Updated.

@ebyhr
Copy link
Member

ebyhr commented Apr 30, 2024

/test-with-secrets sha=410c334554932a7b1a9a071a0c69115727495123

Copy link

The CI workflow run with tests that require additional secrets has been started: https://github.com/trinodb/trino/actions/runs/8902552225

docs/src/main/sphinx/connector/snowflake.md Outdated Show resolved Hide resolved
docs/src/main/sphinx/connector/snowflake.md Outdated Show resolved Hide resolved
| `timestampntz` | `timestamp` |

Complete list of [Snowflake data types](https://docs.snowflake.com/en/sql-reference/intro-summary-data-types.html).
Because Trino and Snowflake each support types that the other does not, this
Copy link
Member

Choose a reason for hiding this comment

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

cc: @mosabua

lxynov added 2 commits May 15, 2024 09:50
For fixed-point numbers:
 - All fixed-point numeric types are decimals (NUMBER in Snowflake).
 - INT , INTEGER , BIGINT , SMALLINT , TINYINT , BYTEINT are synonymous
   with NUMBER(38, 0).

For floating-point numbers:
 - FLOAT, FLOAT4, FLOAT8, DOUBLE, DOUBLE PRECISION, REAL are synonymous
   with each other. They're all 64-bit floating-point numbers.
@lxynov
Copy link
Member Author

lxynov commented May 15, 2024

Thanks @ebyhr . Comments addressed.

@ebyhr ebyhr merged commit 3f0df08 into trinodb:master May 17, 2024
21 checks passed
@mosabua
Copy link
Member

mosabua commented May 17, 2024

Nice!

@github-actions github-actions bot added this to the 449 milestone May 17, 2024
@lxynov lxynov deleted the sf-2 branch May 17, 2024 22:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

3 participants