if (tree.getRoot() == null) { return "";
/** * 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() + ")"; }
/** * 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 */ private static String generateSqlFilter(Table table, ExpressionTree tree, List<Object> params, List<String> joins, boolean dbHasJoinCastBug) throws MetaException { assert table != null; if (tree.getRoot() == null) { return ""; } PartitionFilterGenerator visitor = new PartitionFilterGenerator( table, params, joins, dbHasJoinCastBug); tree.accept(visitor); if (visitor.filterBuffer.hasError()) { LOG.info("Unable to push down SQL filter: " + visitor.filterBuffer.getErrorMessage()); return null; } // 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 "(" + visitor.filterBuffer.getFilter() + ")"; }
/** * 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 */ private static String generateSqlFilter(Table table, ExpressionTree tree, List<Object> params, List<String> joins, boolean dbHasJoinCastBug) throws MetaException { assert table != null; if (tree.getRoot() == null) { return ""; } PartitionFilterGenerator visitor = new PartitionFilterGenerator( table, params, joins, dbHasJoinCastBug); tree.accept(visitor); if (visitor.filterBuffer.hasError()) { LOG.info("Unable to push down SQL filter: " + visitor.filterBuffer.getErrorMessage()); return null; } // 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 "(" + visitor.filterBuffer.getFilter() + ")"; }