/** * Return the boxed literal at the given position * @param expr the parent node * @param type the type of the expression * @param position the child position to check * @return the boxed literal if found otherwise null */ private static Object getLiteral(Configuration conf, ExprNodeGenericFuncDesc expr, BoxType boxType, int position) { List<ExprNodeDesc> children = expr.getChildren(); ExprNodeDesc child = children.get(position); return getLiteral(conf, child, boxType); }
case BETWEEN: builder.between(columnName, boxType.type, getLiteral(conf, expression, boxType, variable + 1), getLiteral(conf, expression, boxType, variable + 2)); break;
case BETWEEN: builder.between(columnName, type, getLiteral(conf, expression, type, variable + 1), getLiteral(conf, expression, type, variable + 2)); break;
/** * Return the boxed literal at the given position * @param expr the parent node * @param type the type of the expression * @param position the child position to check * @return the boxed literal if found otherwise null */ private static Object getLiteral(Configuration conf, ExprNodeGenericFuncDesc expr, PredicateLeaf.Type type, int position) { List<ExprNodeDesc> children = expr.getChildren(); ExprNodeDesc child = children.get(position); return getLiteral(conf, child, type); }
/** * Find the child that is the literal. * @param expr the parent node to check * @param boxType the type of the expression * @return the literal boxed if found or null */ private static Object findLiteral(Configuration conf, ExprNodeGenericFuncDesc expr, final BoxType boxType) { List<ExprNodeDesc> children = expr.getChildren(); if (children.size() != 2) { return null; } Object result = null; for(ExprNodeDesc child: children) { Object currentResult = getLiteral(conf, child, boxType); if (currentResult != null) { // Both children in the expression should not be literal if (result != null) { return null; } result = currentResult; } } return result; }
/** * Find the child that is the literal. * @param expr the parent node to check * @param type the type of the expression * @return the literal boxed if found or null */ private static Object findLiteral(Configuration conf, ExprNodeGenericFuncDesc expr, PredicateLeaf.Type type) { List<ExprNodeDesc> children = expr.getChildren(); if (children.size() != 2) { return null; } Object result = null; for(ExprNodeDesc child: children) { Object currentResult = getLiteral(conf, child, type); if (currentResult != null) { // Both children in the expression should not be literal if (result != null) { return null; } result = currentResult; } } return result; }