private void visit(TreeNode node) throws MetaException { if (shouldStop()) return; assert node != null && node.getLhs() != null && node.getRhs() != null; beginTreeNode(node); node.lhs.accept(this); midTreeNode(node); node.rhs.accept(this); endTreeNode(node); }
public void accept(TreeVisitor treeVisitor) throws MetaException { if (this.root != null) { this.root.accept(treeVisitor); } }
public static FilterParser getFilterParser(String filter) throws MetaException { FilterLexer lexer = new FilterLexer(new ANTLRNoCaseStringStream(filter)); CommonTokenStream tokens = new CommonTokenStream(lexer); FilterParser parser = new FilterParser(tokens); try { parser.filter(); } catch(RecognitionException re) { throw new MetaException("Error parsing partition filter; lexer error: " + lexer.errorMsg + "; exception " + re); } if (lexer.errorMsg != null) { throw new MetaException("Error parsing partition filter : " + lexer.errorMsg); } return parser; }
/** Generate the JDOQL filter for the given expression tree * @param table the table being queried * @param params the input map which is updated with the * the parameterized values. Keys are the parameter names and values * are the parameter values * @param filterBuilder the filter builder to append to. */ public void generateJDOFilterFragment(Configuration conf, Table table, Map<String, Object> params, FilterBuilder filterBuilder) throws MetaException { if (root == null) { return; } filterBuilder.append(" && ( "); root.generateJDOFilter(conf, table, params, filterBuilder); filterBuilder.append(" )"); }
@Override public void generateJDOFilter(Configuration conf, Table table, Map<String, Object> params, FilterBuilder filterBuilder) throws MetaException { if (table != null) { generateJDOFilterOverPartitions(conf, table, params, filterBuilder); } else { generateJDOFilterOverTables(params, filterBuilder); } }
public final void mKW_NOT() throws RecognitionException { try { int _type = KW_NOT; int _channel = DEFAULT_TOKEN_CHANNEL; // org/apache/hadoop/hive/metastore/parser/Filter.g:423:8: ( 'NOT' ) // org/apache/hadoop/hive/metastore/parser/Filter.g:423:10: 'NOT' { match("NOT"); } state.type = _type; state.channel = _channel; } finally { // do for sure before leaving } } // $ANTLR end "KW_NOT"
@Override protected void beginTreeNode(TreeNode node) throws MetaException { filterBuffer.append(" ("); }
@Override protected void accept(TreeVisitor visitor) throws MetaException { visitor.visit(this); }
@Override protected boolean shouldStop() { return filterBuffer.hasError(); }
private PartitionFilterGenerator(Table table, List<Object> params, List<String> joins, boolean dbHasJoinCastBug, String defaultPartName, DatabaseProduct dbType, String schema) { this.table = table; this.params = params; this.joins = joins; this.dbHasJoinCastBug = dbHasJoinCastBug; this.filterBuffer = new FilterBuilder(false); this.defaultPartName = defaultPartName; this.dbType = dbType; this.PARTITION_KEY_VALS = getFullyQualifiedName(schema, "PARTITION_KEY_VALS"); this.PARTITIONS = getFullyQualifiedName(schema, "PARTITIONS"); this.DBS = getFullyQualifiedName(schema, "DBS"); this.TBLS = getFullyQualifiedName(schema, "TBLS"); }
public final void mKW_OR() throws RecognitionException { try { int _type = KW_OR; int _channel = DEFAULT_TOKEN_CHANNEL; // org/apache/hadoop/hive/metastore/parser/Filter.g:425:7: ( 'OR' ) // org/apache/hadoop/hive/metastore/parser/Filter.g:425:9: 'OR' { match("OR"); } state.type = _type; state.channel = _channel; } finally { // do for sure before leaving } } // $ANTLR end "KW_OR"
@Override protected void endTreeNode(TreeNode node) throws MetaException { filterBuffer.append(") "); }
public final void mKW_DATE() throws RecognitionException { try { int _type = KW_DATE; int _channel = DEFAULT_TOKEN_CHANNEL; // org/apache/hadoop/hive/metastore/parser/Filter.g:427:9: ( 'date' ) // org/apache/hadoop/hive/metastore/parser/Filter.g:427:11: 'date' { match("date"); } state.type = _type; state.channel = _channel; } finally { // do for sure before leaving } } // $ANTLR end "KW_DATE"
public final void mKW_STRUCT() throws RecognitionException { try { int _type = KW_STRUCT; int _channel = DEFAULT_TOKEN_CHANNEL; // org/apache/hadoop/hive/metastore/parser/Filter.g:429:11: ( 'STRUCT' ) // org/apache/hadoop/hive/metastore/parser/Filter.g:429:13: 'STRUCT' { match("STRUCT"); } state.type = _type; state.channel = _channel; } finally { // do for sure before leaving } } // $ANTLR end "KW_STRUCT"
public final void mCOMMA() throws RecognitionException { try { int _type = COMMA; int _channel = DEFAULT_TOKEN_CHANNEL; // org/apache/hadoop/hive/metastore/parser/Filter.g:434:7: ( ',' ) // org/apache/hadoop/hive/metastore/parser/Filter.g:434:9: ',' { match(','); } state.type = _type; state.channel = _channel; } finally { // do for sure before leaving } } // $ANTLR end "COMMA"
public final void mEQUAL() throws RecognitionException { try { int _type = EQUAL; int _channel = DEFAULT_TOKEN_CHANNEL; // org/apache/hadoop/hive/metastore/parser/Filter.g:435:7: ( '=' ) // org/apache/hadoop/hive/metastore/parser/Filter.g:435:9: '=' { match('='); } state.type = _type; state.channel = _channel; } finally { // do for sure before leaving } } // $ANTLR end "EQUAL"
public final void mLESSTHANOREQUALTO() throws RecognitionException { try { int _type = LESSTHANOREQUALTO; int _channel = DEFAULT_TOKEN_CHANNEL; // org/apache/hadoop/hive/metastore/parser/Filter.g:437:19: ( '<=' ) // org/apache/hadoop/hive/metastore/parser/Filter.g:437:21: '<=' { match("<="); } state.type = _type; state.channel = _channel; } finally { // do for sure before leaving } } // $ANTLR end "LESSTHANOREQUALTO"
public final void mLESSTHAN() throws RecognitionException { try { int _type = LESSTHAN; int _channel = DEFAULT_TOKEN_CHANNEL; // org/apache/hadoop/hive/metastore/parser/Filter.g:438:10: ( '<' ) // org/apache/hadoop/hive/metastore/parser/Filter.g:438:12: '<' { match('<'); } state.type = _type; state.channel = _channel; } finally { // do for sure before leaving } } // $ANTLR end "LESSTHAN"
public final void mGREATERTHANOREQUALTO() throws RecognitionException { try { int _type = GREATERTHANOREQUALTO; int _channel = DEFAULT_TOKEN_CHANNEL; // org/apache/hadoop/hive/metastore/parser/Filter.g:439:22: ( '>=' ) // org/apache/hadoop/hive/metastore/parser/Filter.g:439:24: '>=' { match(">="); } state.type = _type; state.channel = _channel; } finally { // do for sure before leaving } } // $ANTLR end "GREATERTHANOREQUALTO"