Kousuke Saruta created SPARK-34333:
--------------------------------------

             Summary: Fix PostgresDialect to handle money types properly
                 Key: SPARK-34333
                 URL: https://issues.apache.org/jira/browse/SPARK-34333
             Project: Spark
          Issue Type: Bug
          Components: SQL
    Affects Versions: 3.2.0
            Reporter: Kousuke Saruta
            Assignee: Kousuke Saruta


In the current master, PostgresDialect supports money and money[] types.
But those types seems not to be able to handle those types properly. 

Error of money type.
{code}
[info]   org.apache.spark.SparkException: Job aborted due to stage failure: 
Task 0 in stage 0.0 failed 1 times, most recent failure: Lost task 0.0 in stage 
0.0 (TID 0) (192.168.1.204 executor driver): org.postgresql.util.PSQLException: 
Bad value for type double : 1,000.00
[info]  at org.postgresql.jdbc.PgResultSet.toDouble(PgResultSet.java:3104)
[info]  at org.postgresql.jdbc.PgResultSet.getDouble(PgResultSet.java:2432)
[info]  at 
org.apache.spark.sql.execution.datasources.jdbc.JdbcUtils$.$anonfun$makeGetter$5(JdbcUtils.scala:418)
{code}

Error of money[] type.
{code}
[info]   org.apache.spark.SparkException: Job aborted due to stage failure: 
Task 0 in stage 0.0 failed 1 times, most recent failure: Lost task 0.0 in stage 
0.0 (TID 0) (192.168.1.204 executor driver): org.postgresql.util.PSQLException: 
Bad value for type double : $2,000.00
[info]  at org.postgresql.jdbc.PgResultSet.toDouble(PgResultSet.java:3104)
[info]  at 
org.postgresql.jdbc.ArrayDecoding$5.parseValue(ArrayDecoding.java:235)
[info]  at 
org.postgresql.jdbc.ArrayDecoding$AbstractObjectStringArrayDecoder.populateFromString(ArrayDecoding.java:122)
[info]  at 
org.postgresql.jdbc.ArrayDecoding.readStringArray(ArrayDecoding.java:764)
[info]  at org.postgresql.jdbc.PgArray.buildArray(PgArray.java:310)
[info]  at org.postgresql.jdbc.PgArray.getArrayImpl(PgArray.java:171)
[info]  at org.postgresql.jdbc.PgArray.getArray(PgArray.java:111)
{code}

These errors seem to related to the following issues.
https://github.com/pgjdbc/pgjdbc/issues/100
https://github.com/pgjdbc/pgjdbc/issues/1405



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@spark.apache.org
For additional commands, e-mail: issues-h...@spark.apache.org

Reply via email to