You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@phoenix.apache.org by "Jesse Collins (JIRA)" <ji...@apache.org> on 2014/11/19 20:31:33 UTC

[jira] [Created] (PHOENIX-1469) Some queries fail when a nullable binary column is selected from a table with a secondary index, even if the secondary index doesn't include that column

Jesse Collins created PHOENIX-1469:
--------------------------------------

             Summary: Some queries fail when a nullable binary column is selected from a table with a secondary index, even if the secondary index doesn't include that column
                 Key: PHOENIX-1469
                 URL: https://issues.apache.org/jira/browse/PHOENIX-1469
             Project: Phoenix
          Issue Type: Bug
    Affects Versions: 4.1
            Reporter: Jesse Collins
            Priority: Minor


I recently added a secondary index to the readonlydb.read_only_auth_session table and some queries started to fail at runtime with the error below. My index (as checked in) has the parent_session_id column in an INCLUDE clause, but I found that even if I rebuild the index without that column I still get the error.



java.lang.Throwable: ( username: admin@701048957670893.com )
java.lang.IllegalArgumentException: Unsupported non nullable index type BINARY
    at org.apache.phoenix.util.IndexUtil.getIndexColumnDataType(IndexUtil.java:104)
    at org.apache.phoenix.util.IndexUtil.getIndexColumnDataType(IndexUtil.java:80)
    at org.apache.phoenix.compile.IndexStatementRewriter.visit(IndexStatementRewriter.java:99)
    at org.apache.phoenix.compile.IndexStatementRewriter.visit(IndexStatementRewriter.java:41)
    at org.apache.phoenix.parse.ColumnParseNode.accept(ColumnParseNode.java:50)
    at org.apache.phoenix.parse.ParseNodeRewriter.rewrite(ParseNodeRewriter.java:96)
    at org.apache.phoenix.compile.IndexStatementRewriter.translate(IndexStatementRewriter.java:74)
    at org.apache.phoenix.compile.IndexStatementRewriter.translate(IndexStatementRewriter.java:61)
    at org.apache.phoenix.optimize.QueryOptimizer.getApplicablePlans(QueryOptimizer.java:127)
    at org.apache.phoenix.optimize.QueryOptimizer.optimize(QueryOptimizer.java:81)
    at org.apache.phoenix.optimize.QueryOptimizer.optimize(QueryOptimizer.java:67)
    at org.apache.phoenix.jdbc.PhoenixStatement$1.call(PhoenixStatement.java:222)
    at org.apache.phoenix.jdbc.PhoenixStatement$1.call(PhoenixStatement.java:217)
    at org.apache.phoenix.call.CallRunner.run(CallRunner.java:53)
    at org.apache.phoenix.jdbc.PhoenixStatement.executeQuery(PhoenixStatement.java:216)
    at org.apache.phoenix.jdbc.PhoenixPreparedStatement.executeQuery(PhoenixPreparedStatement.java:183)
    at phoenix.connection.ProtectedPhoenixPreparedStatement.executeQuery(ProtectedPhoenixPreparedStatement.java:61)
   ...


Table definition:
CREATE TABLE IF NOT EXISTS TEST.AUTH_SESSION(
    RAW_SESSION_ID BINARY(64) NOT NULL,
    USERS_ID VARCHAR,
    CREATED_DATE TIME,
    LAST_MODIFIED_DATE TIME,
    NUM_SECONDS_VALID INTEGER,
    USER_TYPE VARCHAR,
    PARENT_SESSION_ID BINARY(64),
    SESSION_TYPE VARCHAR,
    PARENT_SESSION_ID_HEX VARCHAR
    CONSTRAINT PK PRIMARY KEY (
        RAW_SESSION_ID
    )
)


Index definition:

CREATE INDEX IF NOT EXISTS IE4AUTH_SESSION_PARENT 
ON TEST.AUTH_SESSION (PARENT_SESSION_ID_HEX)
INCLUDE (SESSION_TYPE)


SQL:
select RAW_SESSION_ID,
CREATED_DATE,
LAST_MODIFIED_DATE,
NUM_SECONDS_VALID,
PARENT_SESSION_ID,
SESSION_TYPE,
PARENT_SESSION_ID_HEX
from TEST.AUTH_SESSION
where USERS_ID = ?
and RAW_SESSION_ID != ?



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