[ https://issues.apache.org/jira/browse/HIVE-15023?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15591060#comment-15591060 ]
Jesus Camacho Rodriguez commented on HIVE-15023: ------------------------------------------------ [~pxiong], this indeed solves some of the issues referred in HIVE-14866. I wrongly thought that one of the problems was that we were not setting the _outerQueryLimit_ variable for simple queries in SemanticAnalyzer, but we do; thanks for discovering that. To understand properly the fix: _outerQueryLimit=0_ was previously checked in TaskCompiler (L200), but apparently if SimpleFetchOptimizer kicks in, we never reach that line (we enter in L119-L137), thus you are proposing to bail out from SimpleFetchOptimizer if limit is 0, is that right? I think another possibility is to move the check in TaskCompiler in L200 and have it before L119; the advantage with this approach would be that we avoid dealing with the special case _limit=0_ in both places. What do you think? Would that work? > SimpleFetchOptimizer needs to optimize limit=0 > ---------------------------------------------- > > Key: HIVE-15023 > URL: https://issues.apache.org/jira/browse/HIVE-15023 > Project: Hive > Issue Type: Sub-task > Reporter: Pengcheng Xiong > Assignee: Pengcheng Xiong > Attachments: HIVE-15023.01.patch > > > on current master > {code} > hive> explain select key from src limit 0; > OK > STAGE DEPENDENCIES: > Stage-0 is a root stage > STAGE PLANS: > Stage: Stage-0 > Fetch Operator > limit: 0 > Processor Tree: > TableScan > alias: src > Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE > Column stats: NONE > Select Operator > expressions: key (type: string) > outputColumnNames: _col0 > Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE > Column stats: NONE > Limit > Number of rows: 0 > Statistics: Num rows: 0 Data size: 0 Basic stats: NONE Column > stats: NONE > ListSink > Time taken: 7.534 seconds, Fetched: 20 row(s) > {code} -- This message was sent by Atlassian JIRA (v6.3.4#6332)