[ 
https://issues.apache.org/jira/browse/PHOENIX-2169?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14706068#comment-14706068
 ] 

Josh Mahonin commented on PHOENIX-2169:
---------------------------------------

Including comments from [~johngouf] posted to phoenix-users:

Query:
{code}
UPSERT INTO READINGS
SELECT R.SMID, R.DT, R.US, R.GEN, R.USEST, R.GENEST, RM.LAT, RM.LON, RM.ZIP, 
RM.FEEDER
FROM READINGS AS R
JOIN
    (SELECT SMID,LAT,LON,ZIP,FEEDER
     FROM READINGS_META) AS RM
ON R.SMID = RM.SMID
{code}

Stacktrace:
{noformat}
Error: ERROR 201 (22000): Illegal data. ERROR 201 (22000): Illegal data. 
Expected length of at least 70 bytes, but had 25 (state=22000,code=201)
java.sql.SQLException: ERROR 201 (22000): Illegal data. ERROR 201 (22000): 
Illegal data. Expected length of at least 70 bytes, but had 25
        at 
org.apache.phoenix.exception.SQLExceptionCode$Factory$1.newException(SQLExceptionCode.java:388)
        at 
org.apache.phoenix.exception.SQLExceptionInfo.buildException(SQLExceptionInfo.java:145)
        at 
org.apache.phoenix.util.ServerUtil.parseRemoteException(ServerUtil.java:131)
        at 
org.apache.phoenix.util.ServerUtil.parseServerExceptionOrNull(ServerUtil.java:115)
        at 
org.apache.phoenix.util.ServerUtil.parseServerException(ServerUtil.java:104)
        at 
org.apache.phoenix.iterate.BaseResultIterators.getIterators(BaseResultIterators.java:553)
        at 
org.apache.phoenix.iterate.RoundRobinResultIterator.getIterators(RoundRobinResultIterator.java:176)
        at 
org.apache.phoenix.iterate.RoundRobinResultIterator.next(RoundRobinResultIterator.java:91)
        at 
org.apache.phoenix.iterate.DelegateResultIterator.next(DelegateResultIterator.java:44)
        at 
org.apache.phoenix.compile.UpsertCompiler$2.execute(UpsertCompiler.java:685)
        at 
org.apache.phoenix.jdbc.PhoenixStatement$2.call(PhoenixStatement.java:314)
        at 
org.apache.phoenix.jdbc.PhoenixStatement$2.call(PhoenixStatement.java:306)
        at org.apache.phoenix.call.CallRunner.run(CallRunner.java:53)
        at 
org.apache.phoenix.jdbc.PhoenixStatement.executeMutation(PhoenixStatement.java:304)
        at 
org.apache.phoenix.jdbc.PhoenixStatement.execute(PhoenixStatement.java:1374)
        at sqlline.Commands.execute(Commands.java:822)
        at sqlline.Commands.sql(Commands.java:732)
        at sqlline.SqlLine.dispatch(SqlLine.java:808)
        at sqlline.SqlLine.begin(SqlLine.java:681)
        at sqlline.SqlLine.start(SqlLine.java:398)
        at sqlline.SqlLine.main(SqlLine.java:292)
{noformat}

> Illegal data error on UPSERT SELECT and JOIN with salted tables
> ---------------------------------------------------------------
>
>                 Key: PHOENIX-2169
>                 URL: https://issues.apache.org/jira/browse/PHOENIX-2169
>             Project: Phoenix
>          Issue Type: Bug
>    Affects Versions: 4.5.0
>            Reporter: Josh Mahonin
>
> I have an issue where I get periodic failures (~50%) for an UPSERT SELECT 
> query involving a JOIN on salted tables. Unfortunately I haven't been able to 
> create a reproducible test case yet, though I'll keep trying. I believe this 
> same behaviour existed in 4.3.1 as well, so I don't think it's a regression.
> The upsert query itself looks something like this:
> {code}
> UPSERT INTO a(tid, ds, etp, eid, ts, atp, rel, tp, tpid, dt, pro) 
> SELECT c.tid, 
>        c.ds, 
>        c.etp, 
>        c.eid, 
>        c.dh, 
>        0, 
>        c.rel, 
>        c.tp, 
>        c.tpid, 
>        current_time(), 
>        1.0 / s.th 
> FROM   e_c c 
> join   e_s s 
> ON     s.tid = c.tid 
> AND    s.ds = c.ds 
> AND    s.etp = c.etp 
> AND    s.eid = c.eid 
> WHERE  c.tid = 'FOO';
> {code}
> Without the upsert, the query always returns the right data, but with the 
> upsert, it ends up with failures like:
> Error: ERROR 201 (22000): Illegal data. ERROR 201 (22000): Illegal data. 
> Expected length of at least 109 bytes, but had 19 (state=22000,code=201)
> The explain plan looks like:
> {code}
> UPSERT SELECT
> CLIENT 16-CHUNK PARALLEL 16-WAY RANGE SCAN OVER E_C [0,'FOO']
>       SERVER FILTER BY FIRST KEY ONLY
>       PARALLEL INNER-JOIN TABLE 0
>           CLIENT 16-CHUNK PARALLEL 16-WAY FULL SCAN OVER E_S
>       DYNAMIC SERVER FILTER BY (C.TID, C.DS, C.ETP, C.EID) IN ((S.TID, S.DS, 
> S.ETP, S.EID))
> {code}
> I'm using SALT_BUCKETS=16 for both tables in the join, and this is a dev 
> environment, so only 1 region server. Note that without salted tables, I have 
> no issue with this query.
> The number of rows in E_C is around 23K, and the number of rows in E_S is 62.



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

Reply via email to