JDBC error on numeric conversion (because of DecimalType MIN_PRECISION)

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

JDBC error on numeric conversion (because of DecimalType MIN_PRECISION)

Flavio Pompermaier
Hi to all, 
I was doing a test against Postgres and I get an error because the jdbc connect tries to create a DecimalType with precision 0 (min = 1).
Should this DecimalType.MIN_PRECISION lowered to 0 or should NUMERIC type of jdbc tables mapped in some other way?

The Table was created with the following statement (the test fails on creating ord_qty filed):

CREATE TABLE orders(
    ord_no integer PRIMARY KEY,
    ord_date date,
    item_name character(35),
    item_grade character(1),
    ord_qty numeric,
    ord_amount numeric,
    CONSTRAINT unq_ordno_itname UNIQUE(ord_qty,ord_amount)
);

Best,
Flavio
--
Flavio Pompermaier
Development Department

OKKAM S.r.l.
Tel. +(39) 0461 041809
Reply | Threaded
Open this post in threaded view
|

Re: JDBC error on numeric conversion (because of DecimalType MIN_PRECISION)

Flavio Pompermaier
I think I hit the same problem of SPARK-26538 (https://github.com/apache/spark/pull/23456).
I've handled the case in the same manner in my PR for FLINK-17356 (https://github.com/apache/flink/pull/11906)

On Fri, Apr 24, 2020 at 4:28 PM Flavio Pompermaier <[hidden email]> wrote:
Hi to all, 
I was doing a test against Postgres and I get an error because the jdbc connect tries to create a DecimalType with precision 0 (min = 1).
Should this DecimalType.MIN_PRECISION lowered to 0 or should NUMERIC type of jdbc tables mapped in some other way?

The Table was created with the following statement (the test fails on creating ord_qty filed):

CREATE TABLE orders(
    ord_no integer PRIMARY KEY,
    ord_date date,
    item_name character(35),
    item_grade character(1),
    ord_qty numeric,
    ord_amount numeric,
    CONSTRAINT unq_ordno_itname UNIQUE(ord_qty,ord_amount)
);

Best,
Flavio
Reply | Threaded
Open this post in threaded view
|

Re: JDBC error on numeric conversion (because of DecimalType MIN_PRECISION)

Jark Wu-3
Thanks for creating the issue and preparing the PR. 


On Sat, 25 Apr 2020 at 03:44, Flavio Pompermaier <[hidden email]> wrote:
I think I hit the same problem of SPARK-26538 (https://github.com/apache/spark/pull/23456).
I've handled the case in the same manner in my PR for FLINK-17356 (https://github.com/apache/flink/pull/11906)

On Fri, Apr 24, 2020 at 4:28 PM Flavio Pompermaier <[hidden email]> wrote:
Hi to all, 
I was doing a test against Postgres and I get an error because the jdbc connect tries to create a DecimalType with precision 0 (min = 1).
Should this DecimalType.MIN_PRECISION lowered to 0 or should NUMERIC type of jdbc tables mapped in some other way?

The Table was created with the following statement (the test fails on creating ord_qty filed):

CREATE TABLE orders(
    ord_no integer PRIMARY KEY,
    ord_date date,
    item_name character(35),
    item_grade character(1),
    ord_qty numeric,
    ord_amount numeric,
    CONSTRAINT unq_ordno_itname UNIQUE(ord_qty,ord_amount)
);

Best,
Flavio