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

Remove NOT NULL constraint from String types. #63

Merged
merged 1 commit into from
Apr 9, 2020

Conversation

morazow
Copy link
Contributor

@morazow morazow commented Mar 30, 2020

We create an Exasol table, if it did not exist, before saving the Spark
dataframe. The NOT NULL constraint was added to the create table DDL,
if the Spark schema field type is not nullable.

However, this can be problem in Exasol side. Because, Exasol puts null
if the string is empty for VARCHAR or CLOB column types. Therefore,
putting not null constraints fails when inserting empty strings.

This commit removes the NOT NULL constraints from string types even if
they are not nullable.

Fixes #60.

We create an Exasol table, if it did not exist, before saving the Spark
dataframe. The `NOT NULL` constraint was added to the create table DDL,
if the Spark schema field type is not nullable.

However, this can be problem in Exasol side. Because, Exasol puts `null`
if the string is empty for `VARCHAR` or `CLOB` column types. Therefore,
putting not null constraints fails when inserting empty strings.

This commit removes the `NOT NULL` constraints from string types even if
they are not nullable.

Fixes #60.
@morazow morazow requested a review from 3cham March 30, 2020 13:01
@codecov
Copy link

codecov bot commented Mar 30, 2020

Codecov Report

Merging #63 into master will not change coverage by %.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master      #63   +/-   ##
=======================================
  Coverage   84.43%   84.43%           
=======================================
  Files          11       11           
  Lines         469      469           
  Branches       58       58           
=======================================
  Hits          396      396           
  Misses         73       73           
Impacted Files Coverage Δ
src/main/scala/com/exasol/spark/util/Types.scala 81.39% <ø> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 5d86bdb...5a7a604. Read the comment docs.

@3cham
Copy link
Contributor

3cham commented Apr 1, 2020

LGTM :) thanks @morazow for working on this

@morazow morazow merged commit ac6bf9c into master Apr 9, 2020
@morazow morazow deleted the improvement/#60-remove-not-null-constraint branch August 6, 2020 12:17
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.

Spark not-nullable column converts to EXASOL column failed while saving
2 participants