phoenix-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From spark receiver <spark.recei...@gmail.com>
Subject Please help with the "upsert into select case ... " statement error.
Date Wed, 04 Apr 2018 22:38:17 GMT
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
Mime
View raw message