/** * Adds a intermediate node of either type(AND/OR). Pops last two nodes from * the stack and sets them as children of the new node and pushes itself * onto the stack. * @param andOr the operator type */ public void addIntermediateNode(LogicalOperator andOr) { TreeNode rhs = nodeStack.pop(); TreeNode lhs = nodeStack.pop(); TreeNode newNode = new TreeNode(lhs, andOr, rhs); nodeStack.push(newNode); root = newNode; }
if (lhs != null) { filterBuffer.append (" ("); lhs.generateJDOFilter(conf, table, params, filterBuffer); rhs.generateJDOFilter(conf, table, params, filterBuffer);
if (lhs != null) { filterBuffer.append (" ("); lhs.generateJDOFilter(conf, table, params, filterBuffer); rhs.generateJDOFilter(conf, table, params, filterBuffer);
filterBuffer.append(lhs.generateJDOFilter(table, params)); filterBuffer.append(rhs.generateJDOFilter(table, params));
/** * Generate the ANSI SQL92 filter for the given expression tree * @param table the table being queried * @param params the ordered parameters for the resulting expression * @param joins the joins necessary for the resulting expression * @return the string representation of the expression tree */ public static String generateSqlFilter(Table table, ExpressionTree tree, List<String> params, List<String> joins) throws MetaException { assert table != null; if (tree.getRoot() == null) { return ""; } PartitionFilterGenerator visitor = new PartitionFilterGenerator(table, params, joins); tree.getRoot().accept(visitor); // Some joins might be null (see processNode for LeafNode), clean them up. for (int i = 0; i < joins.size(); ++i) { if (joins.get(i) != null) continue; joins.remove(i--); } return "and (" + visitor.filterBuffer.toString() + ")"; }
public String generateJDOFilter(Table table, Map<String, String> params) throws MetaException { StringBuilder filterBuffer = new StringBuilder(); if ( lhs != null) { filterBuffer.append (" ("); filterBuffer.append(lhs.generateJDOFilter(table, params)); if (rhs != null) { if( andOr == LogicalOperator.AND ) { filterBuffer.append(" && "); } else { filterBuffer.append(" || "); } filterBuffer.append(rhs.generateJDOFilter(table, params)); } filterBuffer.append (") "); } return filterBuffer.toString(); }
/** 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(" )"); }
/** 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(" )"); }
/** 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 * @return the string representation of the expression tree * @throws MetaException */ public String generateJDOFilter(Table table, Map<String, Object> params) throws MetaException { if( root == null ) { return ""; } return root.generateJDOFilter(table, params); }
/** 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 * @return the string representation of the expression tree * @throws MetaException */ public String generateJDOFilter(Table table, Map<String, String> params) throws MetaException { if( root == null ) { return ""; } return root.generateJDOFilter(table, params); }
@Override protected void midTreeNode(TreeNode node) throws MetaException { filterBuffer.append((node.getAndOr() == LogicalOperator.AND) ? " and " : " or "); }
/** * Adds a intermediate node of either type(AND/OR). Pops last two nodes from * the stack and sets them as children of the new node and pushes itself * onto the stack. * @param andOr the operator type */ public void addIntermediateNode(LogicalOperator andOr) { TreeNode rhs = nodeStack.pop(); TreeNode lhs = nodeStack.pop(); TreeNode newNode = new TreeNode(lhs, andOr, rhs); nodeStack.push(newNode); root = newNode; }
/** * Adds a intermediate node of either type(AND/OR). Pops last two nodes from * the stack and sets them as children of the new node and pushes itself * onto the stack. * @param andOr the operator type */ public void addIntermediateNode(LogicalOperator andOr) { TreeNode rhs = nodeStack.pop(); TreeNode lhs = nodeStack.pop(); TreeNode newNode = new TreeNode(lhs, andOr, rhs); nodeStack.push(newNode); root = newNode; }
public void accept(TreeVisitor treeVisitor) throws MetaException { if (this.root != null) { this.root.accept(treeVisitor); } }
public void accept(TreeVisitor treeVisitor) throws MetaException { if (this.root != null) { this.root.accept(treeVisitor); } }
/** * Adds a intermediate node of either type(AND/OR). Pops last two nodes from * the stack and sets them as children of the new node and pushes itself * onto the stack. * @param andOr the operator type */ public void addIntermediateNode(LogicalOperator andOr) { TreeNode rhs = nodeStack.pop(); TreeNode lhs = nodeStack.pop(); TreeNode newNode = new TreeNode(lhs, andOr, rhs); nodeStack.push(newNode); root = newNode; }
/** * Adds a intermediate node of either type(AND/OR). Pops last two nodes from * the stack and sets them as children of the new node and pushes itself * onto the stack. * @param andOr the operator type */ public void addIntermediateNode(LogicalOperator andOr) { TreeNode rhs = nodeStack.pop(); TreeNode lhs = nodeStack.pop(); TreeNode newNode = new TreeNode(lhs, andOr, rhs); nodeStack.push(newNode); root = newNode; }
@Override protected void midTreeNode(TreeNode node) throws MetaException { filterBuffer.append((node.getAndOr() == LogicalOperator.AND) ? " and " : " or "); }
@Override public void visit(TreeNode node) throws MetaException { assert node != null && node.getLhs() != null && node.getRhs() != null; filterBuffer.append (" ("); node.getLhs().accept(this); filterBuffer.append((node.getAndOr() == LogicalOperator.AND) ? " and " : " or "); node.getRhs().accept(this); filterBuffer.append (") "); }