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

[SPARK-44866][SQL] Add SnowflakeDialect to handle BOOLEAN type correctly #42545

Closed
wants to merge 5 commits into from

Conversation

hayssams
Copy link

@hayssams hayssams commented Aug 17, 2023

What changes were proposed in this pull request?

In Snowflake a BOOLEAN data type exist but not the BIT data type.
This PR adds SnowflakeDialect to override the default JdbcDialect and redefine the default mapping behaviour for the boolean type. Currently, it's mapped to BIT(1) type.

case BooleanType => Option(JdbcType("BIT(1)", java.sql.Types.BIT))

Why are the changes needed?

The BIT type does not exist in Snowflake. This cause the Spark Job to fail on table creation.

Does this PR introduce any user-facing change?

No

How was this patch tested?

Unit test and directly on Snowflake

Hayssam Saleh added 2 commits August 17, 2023 23:15
In snowflake, the BIT data type does not exist. A Boolean is a Boolean.
That's what this is about.
@hayssams hayssams changed the title Spark wrongly map the bOolean Type to BIT(1) in Snowflake Spark wrongly map the BOOLEAN Type to BIT(1) in Snowflake Aug 17, 2023
@github-actions github-actions bot added the SQL label Aug 17, 2023
@wangyum
Copy link
Member

wangyum commented Aug 18, 2023

Could you file a ticket? https://issues.apache.org/jira/browse/SPARK

@hayssams hayssams changed the title Spark wrongly map the BOOLEAN Type to BIT(1) in Snowflake SPARK-44866: Spark wrongly map the BOOLEAN Type to BIT(1) in Snowflake Aug 18, 2023
@hayssams
Copy link
Author

Juste created the ticket https://issues.apache.org/jira/browse/SPARK-44866

@dongjoon-hyun dongjoon-hyun changed the title SPARK-44866: Spark wrongly map the BOOLEAN Type to BIT(1) in Snowflake [SPARK-44866][SQL] Add SnowflakeDialect to handle BOOLEAN type correctly Sep 8, 2023
Copy link
Member

@dongjoon-hyun dongjoon-hyun left a comment

Choose a reason for hiding this comment

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

Thank you for making a PR, @hayssams .

Since this PR adds a new dialect, I need to ask if you are using this code without any other issues.

@hayssams
Copy link
Author

hayssams commented Sep 8, 2023 via email

@dongjoon-hyun
Copy link
Member

Thank you for the confirmation.

Copy link
Member

@dongjoon-hyun dongjoon-hyun left a comment

Choose a reason for hiding this comment

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

+1, LGTM for Apache Spark 4.0.0.

@dongjoon-hyun
Copy link
Member

Welcome to the Apache Spark community and congratulations for your first commit!
You are added to the Apache Spark contributor group and SPARK-44866 is assigned to you.

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

Successfully merging this pull request may close these issues.

3 participants