private Collection<String> getSinglePartitionExprs(final String filterExpression) { Collection<String> result = com.google.common.collect.Lists.newArrayList(); if (!Strings.isNullOrEmpty(filterExpression)) { try { result = (Collection<String>) new PartitionParser(new StringReader(filterExpression)).filter() .jjtAccept(new PartitionKeyParserEval(), null); } catch (Throwable ignored) { // } } if (result != null) { result = result.stream().filter(s -> !(s.startsWith("batchid=") || s.startsWith("dateCreated="))).collect( Collectors.toList()); } return result; } }
final public void eval() throws ParseException { if (getToken(2).kind == BETWEEN || getToken(3).kind == BETWEEN) { BetweenEval(); } else if (getToken(2).kind == IN || getToken(3).kind == IN) { InEval(); } else if (getToken(2).kind == LIKE || getToken(3).kind == LIKE) { LikeEval(); } else { switch ((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) { case INT: case FLOAT: case BOOLEAN: case VARIABLE: case QUOTE: case SQUOTE: { CompareEval(); break; } default: jj_la1[6] = jj_gen; jj_consume_token(-1); throw new ParseException(); } } }
/** Reinitialise. */ public void ReInit(java.io.InputStream stream) { ReInit(stream, null); }
try { if (parser == null) { parser = new PartitionParser(new StringReader(partitionExpression)); } else { parser.ReInit(new StringReader(partitionExpression)); return (Boolean) parser.filter().jjtAccept(new PartitionParserEval(context), null); } else { return false;
final public void expr() throws ParseException { switch ((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) { case LPAREN: { jj_consume_token(LPAREN); expr(); jj_consume_token(RPAREN); switch ((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) { case AND: case OR: { switch ((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) { case AND: { jj_consume_token(AND); ASTAND jjtn001 = new ASTAND(JJTAND); boolean jjtc001 = true; jjtree.openNodeScope(jjtn001); try { expr(); } catch (Throwable jjte001) { if (jjtc001) { jj_consume_token(OR); ASTOR jjtn002 = new ASTOR(JJTOR); boolean jjtc002 = true; jjtree.openNodeScope(jjtn002); try { expr(); } catch (Throwable jjte002) { if (jjtc002) { jj_consume_token(-1);
jjtree.openNodeScope(jjtn001); try { switch ((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) { case NOT: { jj_consume_token(NOT); not = true; break; eval(); } catch (Throwable jjte001) { if (jjtc001) {
try { if (parser == null) { parser = new PartitionParser(new StringReader(partitionExpression)); } else { parser.ReInit(new StringReader(partitionExpression)); return (Boolean) parser.filter().jjtAccept(new PartitionParserEval(context), null); } else { return false;
final public void expr() throws ParseException { switch ((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) { case LPAREN: { jj_consume_token(LPAREN); expr(); jj_consume_token(RPAREN); switch ((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) { case AND: case OR: { switch ((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) { case AND: { jj_consume_token(AND); ASTAND jjtn001 = new ASTAND(JJTAND); boolean jjtc001 = true; jjtree.openNodeScope(jjtn001); try { expr(); } catch (Throwable jjte001) { if (jjtc001) { jj_consume_token(OR); ASTOR jjtn002 = new ASTOR(JJTOR); boolean jjtc002 = true; jjtree.openNodeScope(jjtn002); try { expr(); } catch (Throwable jjte002) { if (jjtc002) { jj_consume_token(-1);
jjtree.openNodeScope(jjtn001); try { switch ((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) { case NOT: { jj_consume_token(NOT); not = true; break; eval(); } catch (Throwable jjte001) { if (jjtc001) {
public static void main(String args[]) throws ParseException { PartitionParser parser = new PartitionParser(new java.io.StringReader(args[0])); SimpleNode root = parser.filter(); root.dump(""); System.out .println(root.jjtAccept(new com.netflix.metacat.common.server.partition.visitor.PartitionParserEval(), null)); }
final public void eval() throws ParseException { if (getToken(2).kind == BETWEEN || getToken(3).kind == BETWEEN) { BetweenEval(); } else if (getToken(2).kind == IN || getToken(3).kind == IN) { InEval(); } else if (getToken(2).kind == LIKE || getToken(3).kind == LIKE) { LikeEval(); } else { switch ((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) { case INT: case FLOAT: case BOOLEAN: case VARIABLE: case QUOTE: case SQUOTE: { CompareEval(); break; } default: jj_la1[6] = jj_gen; jj_consume_token(-1); throw new ParseException(); } } }
/** Reinitialise. */ public void ReInit(java.io.InputStream stream) { ReInit(stream, null); }
private Collection<String> getSinglePartitionExprs(@Nullable final String filterExpression) { Collection<String> result = Lists.newArrayList(); if (!Strings.isNullOrEmpty(filterExpression)) { try { result = (Collection<String>) new PartitionParser( new StringReader(filterExpression)).filter().jjtAccept(new PartitionKeyParserEval(), null ); } catch (Throwable ignored) { // } } if (result != null) { result = result.stream().filter(s -> !(s.startsWith("batchid=") || s.startsWith("dateCreated="))).collect( Collectors.toList()); } return result; }
public static void main(String args[]) throws ParseException { PartitionParser parser = new PartitionParser(new java.io.StringReader(args[0])); SimpleNode root = parser.filter(); root.dump(""); System.out .println(root.jjtAccept(new com.netflix.metacat.common.server.partition.visitor.PartitionParserEval(), null)); }
private Collection<String> getSinglePartitionExprs(@Nullable final String filterExpression) { Collection<String> result = Lists.newArrayList(); if (!Strings.isNullOrEmpty(filterExpression)) { try { result = (Collection<String>) new PartitionParser( new StringReader(filterExpression)).filter().jjtAccept(new PartitionKeyParserEval(), null ); } catch (Throwable ignored) { // } } if (result != null) { result = result.stream().filter(s -> !(s.startsWith("batchid=") || s.startsWith("dateCreated="))).collect( Collectors.toList()); } return result; }
private String getDateCreatedSqlCriteria(final String filterExpression) { final StringBuilder result = new StringBuilder(); Collection<String> values = Lists.newArrayList(); if (!Strings.isNullOrEmpty(filterExpression)) { try { values = (Collection<String>) new PartitionParser( new StringReader(filterExpression)).filter().jjtAccept(new PartitionParamParserEval(), null ); } catch (Throwable ignored) { // } } for (String value : values) { if (result.length() != 0) { result.append(" and "); } result.append(value.replace("dateCreated", "p.CREATE_TIME")); } return result.toString(); }
private String getDateCreatedSqlCriteria(final String filterExpression) { final StringBuilder result = new StringBuilder(); Collection<String> values = com.google.common.collect.Lists.newArrayList(); if (!Strings.isNullOrEmpty(filterExpression)) { try { values = (Collection<String>) new PartitionParser(new StringReader(filterExpression)).filter() .jjtAccept(new PartitionParamParserEval(), null); } catch (Throwable ignored) { // } } for (String value : values) { if (result.length() != 0) { result.append(" and "); } result.append(value.replace("dateCreated", "to_seconds(p.date_created)")); } return result.toString(); }
private String getDateCreatedSqlCriteria(final String filterExpression) { final StringBuilder result = new StringBuilder(); Collection<String> values = Lists.newArrayList(); if (!Strings.isNullOrEmpty(filterExpression)) { try { values = (Collection<String>) new PartitionParser( new StringReader(filterExpression)).filter().jjtAccept(new PartitionParamParserEval(), null ); } catch (Throwable ignored) { // } } for (String value : values) { if (result.length() != 0) { result.append(" and "); } result.append(value.replace("dateCreated", "p.CREATE_TIME")); } return result.toString(); }