Details
-
Sub-task
-
Status: Resolved
-
Major
-
Resolution: Fixed
-
None
-
None
-
None
Description
Array construction DML's don't currently work as expected.
Initially it seemed like a type matching issue, but once I forced the correct types, the validator still throws exceptions.
Example input query:
String ddl = "CREATE TABLE " + tableName + " (region_name VARCHAR PRIMARY KEY,varchars CHAR(5)[],integers INTEGER[],doubles DOUBLE[],bigints BIGINT[],chars CHAR(15)[],double1 DOUBLE,char1 CHAR(17),nullcheck INTEGER,chars2 CHAR(15)[])"; String dml = "UPSERT INTO " + tableName + "(region_name,varchars,integers,doubles,bigints,chars,double1,char1,nullcheck,chars2) VALUES('SF Bay Area'," + "ARRAY['2345','46345','23234']," + "ARRAY[2345,46345,23234,456]," + "ARRAY[23.45,46.345,23.234,45.6,5.78]," + "ARRAY[12,34,56,78,910]," + "ARRAY['a','bbbb','c','ddd','e']," + "23.45," + "'wert'," + "NULL," + "ARRAY['a','bbbb','c','ddd','e','foo']" + ")";
Exception thrown:
Caused by: org.apache.calcite.sql.validate.SqlValidatorException: Cannot assign to target field 'VARCHARS' of type CHAR(5) ARRAY from source field 'EXPR$1' of type CHAR(5) ARRAY at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:423) at org.apache.calcite.runtime.Resources$ExInstWithCause.ex(Resources.java:405) at org.apache.calcite.runtime.Resources$ExInst.ex(Resources.java:514) ... 53 more
Attachments
Issue Links
- is blocked by
-
CALCITE-1804 Cannot assign NOT NULL array to NULLABLE array
-
- Closed
-
-
CALCITE-1050 Avatica can't serialize java.sql.Array
-
- Closed
-
- is depended upon by
-
PHOENIX-3355 Register Phoenix built-in functions as Calcite functions
-
- Resolved
-