Eric Lomore created PHOENIX-3502:
------------------------------------

             Summary: Support ARRAY DML in Calcite-Phoenix
                 Key: PHOENIX-3502
                 URL: https://issues.apache.org/jira/browse/PHOENIX-3502
             Project: Phoenix
          Issue Type: Improvement
            Reporter: Eric Lomore


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:
{code}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']" +
                ")";
{code}

Exception thrown:
{code}
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
{code}




--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to