Bing Jiang created PHOENIX-3038:
-----------------------------------

             Summary: phoenix table should take account of hbase namespace.
                 Key: PHOENIX-3038
                 URL: https://issues.apache.org/jira/browse/PHOENIX-3038
             Project: Phoenix
          Issue Type: Bug
            Reporter: Bing Jiang


If we execute sql (via sqlline) on table with hbase namespace defined, the 
table name should be within double quotations. However, in practice, we should 
integrate phoenix with other processing frameworks, such as MapReduce, Pig, or 
Spark. In these frameworks, it might be difficult to add a double quotation 
into its program or script. The following lists the exception if we execute pig 
script on Phoenix tables. Our table name is TEST:EVENTS_TRACKING, and TEST is 
the namespace.

{code}
register /var/gs/phoenix/lib/phoenix-pig-4.7.0-HBase-0.98.jar
register /var/gs/phoenix/phoenix-4.7.0-HBase-0.98-client.jar
ABC = LOAD 'hbase://table/TEST:EVENTS_TRACKING/IDBUCKET,ID' using 
org.apache.phoenix.pig.PhoenixHBaseLoader('172.22.80.1:2181/hbase');
ABC_GROUP = group ABC by IDBUCKET;
ABC_COUNT = foreach ABC_GROUP generate group, COUNT(ABC);
DUMP ABC_COUNT;
{code} 

It runs into the following exception.
{code}
2016-06-29 14:57:36,482 [JobControl] INFO  
org.apache.hadoop.mapreduce.lib.jobcontrol.ControlledJob - PigLatin:test.pig 
got an error while submitting
org.apache.pig.backend.executionengine.ExecException: ERROR 2118: 
org.apache.phoenix.exception.PhoenixParserException: ERROR 601 (42P00): Syntax 
error. Encountered ":" at line 1, column 35.
        at 
org.apache.pig.backend.hadoop.executionengine.mapReduceLayer.PigInputFormat.getSplits(PigInputFormat.java:279)
        at 
org.apache.hadoop.mapreduce.JobSubmitter.writeNewSplits(JobSubmitter.java:301)
        at 
org.apache.hadoop.mapreduce.JobSubmitter.writeSplits(JobSubmitter.java:318)
        at 
org.apache.hadoop.mapreduce.JobSubmitter.submitJobInternal(JobSubmitter.java:196)
        at org.apache.hadoop.mapreduce.Job$10.run(Job.java:1290)
        at org.apache.hadoop.mapreduce.Job$10.run(Job.java:1287)
        at java.security.AccessController.doPrivileged(Native Method)
        at javax.security.auth.Subject.doAs(Subject.java:422)
        at 
org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1657)
        at org.apache.hadoop.mapreduce.Job.submit(Job.java:1287)
        at 
org.apache.hadoop.mapreduce.lib.jobcontrol.ControlledJob.submit(ControlledJob.java:335)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:497)
        at 
org.apache.pig.backend.hadoop23.PigJobControl.submit(PigJobControl.java:128)
        at 
org.apache.pig.backend.hadoop23.PigJobControl.run(PigJobControl.java:194)
        at java.lang.Thread.run(Thread.java:745)
        at 
org.apache.pig.backend.hadoop.executionengine.mapReduceLayer.MapReduceLauncher$1.run(MapReduceLauncher.java:276)
Caused by: java.lang.RuntimeException: 
org.apache.phoenix.exception.PhoenixParserException: ERROR 601 (42P00): Syntax 
error. Encountered ":" at line 1, column 35.
        at 
org.apache.phoenix.mapreduce.PhoenixInputFormat.getQueryPlan(PhoenixInputFormat.java:134)
        at 
org.apache.phoenix.mapreduce.PhoenixInputFormat.getSplits(PhoenixInputFormat.java:82)
        at 
org.apache.pig.backend.hadoop.executionengine.mapReduceLayer.PigInputFormat.getSplits(PigInputFormat.java:265)
        ... 18 more
Caused by: org.apache.phoenix.exception.PhoenixParserException: ERROR 601 
(42P00): Syntax error. Encountered ":" at line 1, column 35.
        at 
org.apache.phoenix.exception.PhoenixParserException.newException(PhoenixParserException.java:33)
        at org.apache.phoenix.parse.SQLParser.parseStatement(SQLParser.java:111)
        at 
org.apache.phoenix.jdbc.PhoenixStatement$PhoenixStatementParser.parseStatement(PhoenixStatement.java:1133)
        at 
org.apache.phoenix.jdbc.PhoenixStatement.parseStatement(PhoenixStatement.java:1216)
        at 
org.apache.phoenix.jdbc.PhoenixStatement.compileQuery(PhoenixStatement.java:1226)
        at 
org.apache.phoenix.jdbc.PhoenixStatement.optimizeQuery(PhoenixStatement.java:1221)
        at 
org.apache.phoenix.mapreduce.PhoenixInputFormat.getQueryPlan(PhoenixInputFormat.java:122)
        ... 20 more
Caused by: NoViableAltException(25@[])
        at 
org.apache.phoenix.parse.PhoenixSQLParser.from_table_name(PhoenixSQLParser.java:9110)
        at 
org.apache.phoenix.parse.PhoenixSQLParser.table_factor(PhoenixSQLParser.java:5841)
        at 
org.apache.phoenix.parse.PhoenixSQLParser.table_ref(PhoenixSQLParser.java:5663)
        at 
org.apache.phoenix.parse.PhoenixSQLParser.table_list(PhoenixSQLParser.java:5599)
        at 
org.apache.phoenix.parse.PhoenixSQLParser.parseFrom(PhoenixSQLParser.java:5564)
        at 
org.apache.phoenix.parse.PhoenixSQLParser.single_select(PhoenixSQLParser.java:4359)
        at 
org.apache.phoenix.parse.PhoenixSQLParser.unioned_selects(PhoenixSQLParser.java:4461)
        at 
org.apache.phoenix.parse.PhoenixSQLParser.select_node(PhoenixSQLParser.java:4526)
        at 
org.apache.phoenix.parse.PhoenixSQLParser.oneStatement(PhoenixSQLParser.java:757)
        at 
org.apache.phoenix.parse.PhoenixSQLParser.statement(PhoenixSQLParser.java:499)
        at org.apache.phoenix.parse.SQLParser.parseStatement(SQLParser.java:108)
        ... 25 more
{code}




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

Reply via email to