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

Thejas M Nair commented on HIVE-10091:
--------------------------------------

I am able to reproduce this using a simpler query, by just having a condition 
on non partitioning column in where condition-


{code}
create table t1( i int) partitioned by (dt string);
select * from t1 where i > 0 and dt < '1';
FAILED: SemanticException MetaException(message:java.lang.NullPointerException)
{code}
In the logs 
{code}
015-03-26 11:31:43,641 INFO  [main]: ppd.OpProcFactory 
(OpProcFactory.java:logExpr(709)) - Pushdown Predicates of TS For Alias : t1
2015-03-26 11:31:43,641 INFO  [main]: ppd.OpProcFactory 
(OpProcFactory.java:logExpr(712)) -     (i > 0)
2015-03-26 11:31:43,641 INFO  [main]: ppd.OpProcFactory 
(OpProcFactory.java:logExpr(712)) -     (dt < '1')
2015-03-26 11:31:43,642 INFO  [main]: log.PerfLogger 
(PerfLogger.java:PerfLogBegin(121)) - <PERFLOG method=partition-retrieving 
from=org.apache.hadoop.hive.ql.optimizer.ppr.PartitionPruner>
2015-03-26 11:31:43,643 INFO  [main]: metastore.HiveMetaStore 
(HiveMetaStore.java:logInfo(743)) - 0: get_partitions_by_expr : db=default 
tbl=t1
2015-03-26 11:31:43,643 INFO  [main]: HiveMetaStore.audit 
(HiveMetaStore.java:logAuditEvent(356)) - ugi=thejas  ip=unknown-ip-addr      
cmd=get_partitions_by_expr : db=default tbl=t1
2015-03-26 11:31:43,643 INFO  [main]: metastore.PartFilterExprUtil 
(PartFilterExprUtil.java:makeExpressionTree(99)) - Unable to make the 
expression tree from expression string [(null and (dt < '1'))]Error parsing 
partition filter; lexer error: null; exception NoViableAltException(11@[])

{code}

The right fix for long term is to be able to correctly generate the expression 
tree for this query as well, and use it to just get the right partitions. I 
think this sort of query is common, and optimizing it would be useful for 
tables with large number of partitions. 

What ObjectStore does when the above parsing fails, is to get all partition 
names for the table from the RDBMS, evaluate the expr on the partition names to 
get a pruned set of partition names, and then again get the partitions with 
those names from RDBMS.
Looking into using similar approach in this case.







> Generate Hbase execution plan for partition filter conditions in HbaseStore 
> api calls - initial changes
> -------------------------------------------------------------------------------------------------------
>
>                 Key: HIVE-10091
>                 URL: https://issues.apache.org/jira/browse/HIVE-10091
>             Project: Hive
>          Issue Type: Sub-task
>          Components: Metastore
>            Reporter: Thejas M Nair
>            Assignee: Thejas M Nair
>             Fix For: hbase-metastore-branch
>
>         Attachments: HIVE-10091.1.patch, HIVE-10091.2.patch
>
>
> RawStore functions that support partition filtering are the following - 
> getPartitionsByExpr
> getPartitionsByFilter (takes filter string as argument, used from hcatalog)
> We need to generate a query execution plan in terms of Hbase scan api calls 
> for a given filter condition.
> NO PRECOMMIT TESTS



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

Reply via email to