/** * Makes expression tree out of expr. * @param filter Filter. * @return Expression tree. Null if there was an error. */ private static ExpressionTree makeExpressionTree(String filter) throws MetaException { // TODO: ExprNodeDesc is an expression tree, we could just use that and be rid of Filter.g. if (filter == null || filter.isEmpty()) { return ExpressionTree.EMPTY_TREE; } LOG.debug("Filter specified is " + filter); ExpressionTree tree = null; try { tree = getFilterParser(filter).tree; } catch (MetaException ex) { LOG.info("Unable to make the expression tree from expression string [" + filter + "]" + ex.getMessage()); // Don't log the stack, this is normal. } if (tree == null) { return null; } // We suspect that LIKE pushdown into JDO is invalid; see HIVE-5134. Check for like here. LikeChecker lc = new LikeChecker(); tree.accept(lc); return lc.hasLike() ? null : tree; }
tree.accept(visitor); if (visitor.filterBuffer.hasError()) { LOG.info("Unable to push down SQL filter: " + visitor.filterBuffer.getErrorMessage());
/** * Makes expression tree out of expr. * @param filter Filter. * @return Expression tree. Null if there was an error. */ private static ExpressionTree makeExpressionTree(String filter) throws MetaException { // TODO: ExprNodeDesc is an expression tree, we could just use that and be rid of Filter.g. if (filter == null || filter.isEmpty()) { return ExpressionTree.EMPTY_TREE; } LOG.debug("Filter specified is " + filter); ExpressionTree tree = null; try { tree = getFilterParser(filter).tree; } catch (MetaException ex) { LOG.info("Unable to make the expression tree from expression string [" + filter + "]" + ex.getMessage()); // Don't log the stack, this is normal. } if (tree == null) { return null; } // We suspect that LIKE pushdown into JDO is invalid; see HIVE-5134. Check for like here. LikeChecker lc = new LikeChecker(); tree.accept(lc); return lc.hasLike() ? null : tree; }
/** * Makes expression tree out of expr. * @param filter Filter. * @return Expression tree. Null if there was an error. */ private ExpressionTree makeExpressionTree(String filter) throws MetaException { // TODO: ExprNodeDesc is an expression tree, we could just use that and be rid of Filter.g. if (filter == null || filter.isEmpty()) { return ExpressionTree.EMPTY_TREE; } LOG.debug("Filter specified is " + filter); ExpressionTree tree = null; try { tree = getFilterParser(filter).tree; } catch (MetaException ex) { LOG.info("Unable to make the expression tree from expression string [" + filter + "]" + ex.getMessage()); // Don't log the stack, this is normal. } if (tree == null) { return null; } // We suspect that LIKE pushdown into JDO is invalid; see HIVE-5134. Check for like here. LikeChecker lc = new LikeChecker(); tree.accept(lc); return lc.hasLike() ? null : tree; }
/** * 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() + ")"; }
/** * Makes expression tree out of expr. * @param filter Filter. * @return Expression tree. Null if there was an error. */ private ExpressionTree makeExpressionTree(String filter) throws MetaException { // TODO: ExprNodeDesc is an expression tree, we could just use that and be rid of Filter.g. if (filter == null || filter.isEmpty()) { return ExpressionTree.EMPTY_TREE; } LOG.debug("Filter specified is " + filter); ExpressionTree tree = null; try { tree = getFilterParser(filter).tree; } catch (MetaException ex) { LOG.info("Unable to make the expression tree from expression string [" + filter + "]" + ex.getMessage()); // Don't log the stack, this is normal. } if (tree == null) { return null; } // We suspect that LIKE pushdown into JDO is invalid; see HIVE-5134. Check for like here. LikeChecker lc = new LikeChecker(); tree.accept(lc); return lc.hasLike() ? null : tree; }