exasol / exasol-virtual-schema

Virtual Schema from Exasol to Exasol
MIT License
1 stars 2 forks source link

Some Double Literals Have Wrong Data Type #47

Closed exanm closed 3 years ago

exanm commented 3 years ago

The Exasol dialect should always add a CAST(... AS DOUBLE) for literal_double. Otherwise some numbers like 1E0 get parsed as DECIMAL.

This is the follow-up to exasol/virtual-schema-common-java/issues/209.

How to reproduce:

SELECT * FROM vs.t WHERE a = CAST(1 AS DOUBLE);

The pushdown request for this query will contain a literal_double, but the generated pushdown will contain WHERE a = 1E0 which gets parsed as DECIMAL.

jakobbraun commented 3 years ago

Currently, the virtual schemas do not provide correct types for literals at all. So this is just one single case of a huge missing feature. Closing.

exanm commented 3 years ago

This is not just about the returned data type, but about wrong queries leading to wrong result sets.

Here is an example showing different result sets for native and virtual queries:

CREATE TABLE native.t(a DECIMAL(36,0));
INSERT INTO native.t VALUES          (123456789012345678901234567890123456);
SELECT * FROM native.t WHERE a = CAST(123456789012345678901234567890123456 AS DOUBLE); -- returns 1 row
SELECT * FROM vs.t     WHERE a = CAST(123456789012345678901234567890123456 AS DOUBLE); -- returns 0 rows
exanm commented 3 years ago

As discussed with @redcatbear: This is not about JDBC types, but only about literals sent from the database to the adapter as literal_double structures.