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

Daniel Wong commented on PHOENIX-5290:
--------------------------------------

Quickly trying to catch up here.  There is a bunch of weirdness on separators 
in our key/single value row generation that likely should be abstracted out.  
We append separators somewhat blindly after writing each field when generating 
the row key.  Since row keys have length it is unnecessary to store the 
trailing key so we trim it.  If we were to have multiple variable length 
fields, (or nullable secondary indexes) we could in theory trim those as well.  
For example several empty String VARCHARs in a row.  Without looking in the 
code I cannot recall if there is a case where we trim all of them for storage 
but for querying it appears we will do so for something like the following code 
snippet i ran.  Here in my code the startkey has no trailing separators. 


{code:java}
String dataTableName = "T_" + generateUniqueName();
String dataTableDDL = "CREATE TABLE " + dataTableName + " (k1 INTEGER NOT NULL, 
s1 VARCHAR(64),\n" + "s2 VARCHAR(64),\n"
        + "s3 VARCHAR(64),\n" + "v1 INTEGER,\n" + "CONSTRAINT pk PRIMARY KEY 
(k1))";

conn.createStatement().execute(dataTableDDL);
conn.commit();

String indexDDL = "CREATE INDEX IF NOT EXISTS " + dataTableName+"_IDX" + " ON " 
+ dataTableName + " (s1 ,s2, s3)";

conn.createStatement().execute(indexDDL);
conn.commit();

String upsertDML = String.format("UPSERT INTO %s VALUES(?,?,?,?,?)", 
dataTableName);

int nRows = 0;
PreparedStatement ps = conn.prepareStatement(upsertDML);
ps.setInt(1,5);
    ps.setString(2, "a");
        ps.setString(3, "");
            ps.setString(4, "");
            ps.setInt(5, nRows);
            int result = ps.executeUpdate();
            assertEquals(1, result);
            nRows++;

conn.commit();

String sql = "SELECT s1,s2,s3 FROM " + dataTableName + " WHERE (s1,s2,s3) >= 
('a','','')  ORDER BY s1,s2,s3"; 
ResultSet rs = conn.createStatement().executeQuery(sql);
assertTrue(rs.next())
{code}

> HashJoinMoreIT is flapping
> --------------------------
>
>                 Key: PHOENIX-5290
>                 URL: https://issues.apache.org/jira/browse/PHOENIX-5290
>             Project: Phoenix
>          Issue Type: Bug
>    Affects Versions: 4.15.0, 4.14.1, 5.1.0
>            Reporter: Lars Hofhansl
>            Priority: Major
>             Fix For: 4.15.0, 5.1.0
>
>         Attachments: 5290-failure.txt, 5290-v2.txt, 5290-v3.txt, 5290.txt
>
>
> {code}
> [INFO] Running org.apache.phoenix.end2end.join.HashJoinMoreIT
> [ERROR] Tests run: 8, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 
> 91.509 s <<< FAILURE! - in org.apache.phoenix.end2end.join.HashJoinMoreIT
> [ERROR] testBug2961(org.apache.phoenix.end2end.join.HashJoinMoreIT)  Time 
> elapsed: 2.42 s  <<< ERROR!
> java.lang.IllegalArgumentException: 6 > 5
>         at 
> org.apache.phoenix.end2end.join.HashJoinMoreIT.testBug2961(HashJoinMoreIT.java:898)
> {code}



--
This message was sent by Atlassian JIRA
(v7.6.14#76016)

Reply via email to