-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
Avoid writing NaN and Infinity with json format table #24558
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you add a test?
@@ -123,7 +123,16 @@ else if (REAL.equals(type)) { | |||
return (generator, block, position) -> generator.writeNumber(REAL.getFloat(block, position)); | |||
} | |||
else if (DOUBLE.equals(type)) { | |||
return (generator, block, position) -> generator.writeNumber(DOUBLE.getDouble(block, position)); | |||
return (generator, block, position) -> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about REAL type?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'NaN' and 'Infinity' getting casted as Double it seems. It goes through double datatype.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think so. Please try CREATE TABLE test_nan WITH (format = 'json') AS SELECT real 'NaN' a;
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
okay
360d7a0
to
a0b1253
Compare
a0b1253
to
bc3afbe
Compare
fixes #20395 #20395
This pr will fix inserting NaN and Infinity into table as Json Format.
In hive, if we insert NaN or Infinity in json format table, it would store that as NULL, which readable from Trino. We can go that path also if we want to create table to be successful.
@ebyhr @hashhar
Description
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.
( ) Release notes are required, with the following suggested text: