-
Notifications
You must be signed in to change notification settings - Fork 826
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
Let ResultSet.getObject() return Float.NaN in case of numeric NaN #1304
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1304 +/- ##
============================================
+ Coverage 68.49% 68.52% +0.02%
- Complexity 3868 3873 +5
============================================
Files 178 178
Lines 16184 16185 +1
Branches 2639 2639
============================================
+ Hits 11086 11090 +4
+ Misses 3865 3864 -1
+ Partials 1233 1231 -2 |
Well, technically speaking PostgreSQL has @tseylerd , is there any strong reason you think |
@vlsi No. I think it's not very important. Which one is better? I don't know. But i know that anything is better than the exception. So if you prefer double let's make it double. |
@tseylerd hard to say which one is better. |
Ok, |
Good point, but I don't see a way around this?
Dave Cramer
…On Fri, 21 Sep 2018 at 14:40, Vladimir Sitnikov ***@***.***> wrote:
I don't have a preference.
Ok, ThreadLocalRandom.current().nextBoolean() ? Float.NaN : Double.NaN
then
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#1304 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AAYz9l1qUa_4EPKuaX6-DDznxMAuIbmAks5udTKjgaJpZM4W0fN9>
.
|
Let's just stick with Double.NaN for "extra precision". |
@tseylerd , could you please clarify expected release date? |
@vlsi We plan to release in November. But we can update the driver separately as soon as it comes out. |
Hi guys, wondering if someone can help me with this. I have currently got the |
@arahman5 according to the test case in this PR this should not be happening. Can you provide us with a small test case that reproduces the problem ? |
@davecramer yes sure. I load data from a table in a database by using the below code val DF = spark.read
.format("jdbc")
.option("url", "jdbc:postgresql:https://" + args(1) + ":" + args(2) + "/" + args(3))
.option("dbtable", "tablename")
.option("user", args(4))
.option("password", args(5))
.load() The schema of this table is as follows where the root
|-- id: long (nullable = true)
|-- file_id: long (nullable = true)
|-- name: string (nullable = true)
|-- time: timestamp (nullable = true)
|-- value: decimal(38,18) (nullable = true) I then execute the below piece of code and the code crashes with always the same error message that I previously mentioned. Calling the DF.createOrReplaceTempView("tablename")
val nonull = spark.sql("""select value from tablename
order by time desc
limit 1000""").show() What is even more strange is that, when I am running the below SQL query in pgadmin4 I get a result containing no select value from tablename where NOT value = 'NaN'
order by time desc
limit 1000 |
Digging further into the java code, it seems like the issue is coming from the The Why does the column need to be binary in order for the remaining of the code as shown in the image above to run? |
@arahman5 this is very hard to read. github allows you to send links to code which is much easier to read |
better question is why there is: and is only ever called with allowNaN false. |
Postgres numeric column can store NaN value which is not convertable to BigDecimal. getBigDecimal() throws exception in this case. But when we call getObject() to retrieve the data we expect any type of object as return value. So it's convenient to return Float.NaN in this case.
Related DataGrip issue: https://youtrack.jetbrains.com/issue/DBE-5141