hive-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Reuben Kuhnert (JIRA)" <>
Subject [jira] [Commented] (HIVE-10190) CBO: AST mode checks for TABLESAMPLE with AST.toString().contains("TOK_TABLESPLITSAMPLE")
Date Mon, 13 Apr 2015 13:10:12 GMT


Reuben Kuhnert commented on HIVE-10190:

Ah I see, I misunderstood your comment. I thought what you were after was something more straightforward.
But you really just want:

(1) Some simple utility class that will perform traversal (rather than hand rolling code to
do so).
(2) Use the actual Tokens rather than their {{toString}} representations.

#2 Is easy to fix, I see what you're after now, I just misread it.
#1 Is less easy. It looks like there is a way to offload traversal to ANTLR, but after a lot
of searching, it looks like the only way to do this is to use 'Tree Pattern Matching' (,
which is certainly doable, but requires modifying the parser grammar in addition to applying
the pattern matcher class within the {{validateASTForUnsupportedTokens}}).If that's the correct
path here, then I can go ahead and get something put together. Just let me know what you think.

> CBO: AST mode checks for TABLESAMPLE with AST.toString().contains("TOK_TABLESPLITSAMPLE")
> -----------------------------------------------------------------------------------------
>                 Key: HIVE-10190
>                 URL:
>             Project: Hive
>          Issue Type: Bug
>          Components: CBO
>    Affects Versions: 1.2.0
>            Reporter: Gopal V
>            Assignee: Pengcheng Xiong
>            Priority: Trivial
>              Labels: perfomance
>         Attachments:, HIVE-10190.01.patch, HIVE-10190.02.patch,
> {code}
> public static boolean validateASTForUnsupportedTokens(ASTNode ast) {
>     String astTree = ast.toStringTree();
>     // if any of following tokens are present in AST, bail out
>     for (String token : tokens) {
>       if (astTree.contains(token)) {
>         return false;
>       }
>     }
>     return true;
>   }
> {code}
> This is an issue for a SQL query which is bigger in AST form than in text (~700kb).

This message was sent by Atlassian JIRA

View raw message