This looks reminiscent of https://issues.apache.org/jira/browse/PHOENIX-4588 but I'm not certain if they're the same issue.

On 4/4/18 6:38 PM, spark receiver wrote:
Hi everyone,

I’m using phoenix 4.11 ,facing a strange issue when using upsert.


I’m joinning  2 tables to get  “flag“ column and upsert that column into the small table

The sql statement is :

upsert into mac_all_hour(clientmac,entityid,flag)
select a.CLIENTMAC,
        a.ENTITYID,
        cast(case
               when a.indoor_flag = '1' then 'U'
               when a.visit_flag  = '1' then 'V'
               when a.away_flag   = '1' then 'A'
             end as char(1)) as flag
   from mac_history a
  where exists (select 1
           from mac_all_hour b
          where a.clientmac = b.clientmac
            and a.entityid = b.entityid) limit 1000000000;


And the 2 tables definition is showing by the screen shot below:




The problem is that when do the upsert statement always fail with Error: java.lang.IndexOutOfBoundsException: index (8) must be less than size (6) (state=08000,code=101)



But once I remove upsert part ,only execute select statement ,all fine .



When removed case expression column ,it working just fine, I even checked the length of the case expression column  ,always char(1)

And after I added limit 10000000 at the end of the query ,the sql actually working





Regards,

Mason

Reply via email to