@Test public void testSimplifyRemoveAlwaysFalseChildren() { Expression input = and(alwaysFalse(), equal("pcol", 1)); Expression expected = alwaysFalse(); Assert.assertEquals(expected.toString(), simplifyPartitionFilter(input, ImmutableSet.of("pcol")).toString()); input = or(alwaysFalse(), equal("pcol", 1)); expected = equal("pcol", 1); Assert.assertEquals(expected.toString(), simplifyPartitionFilter(input, ImmutableSet.of("pcol")).toString()); }
static Expression simplifyPartitionFilter(Expression expr, Set<String> partitionColumnNames) { try { Expression partitionPredicatesOnly = ExpressionVisitors.visit(expr, new RemoveNonPartitionPredicates(partitionColumnNames)); return ExpressionVisitors.visit(partitionPredicatesOnly, new RewriteUnsupportedOperators()); } catch (Exception e) { throw new RuntimeException("Error while processing expression: " + expr, e); } }
HiveExpressions { static Expression simplifyPartitionFilter(Expression expr, Set<String> partitionColumnNames) { try { Expression partitionPredicatesOnly = ExpressionVisitors.visit(expr, new RemoveNonPartitionPredicates(partitionColumnNames)); return ExpressionVisitors.visit(partitionPredicatesOnly, new RewriteUnsupportedOperators()); } catch (Exception e) { throw new RuntimeException("Error while processing expression: " + expr, e); } } }
HiveExpressions { static Expression simplifyPartitionFilter(Expression expr, Set<String> partitionColumnNames) { try { Expression partitionPredicatesOnly = ExpressionVisitors.visit(expr, new RemoveNonPartitionPredicates(partitionColumnNames)); return ExpressionVisitors.visit(partitionPredicatesOnly, new RewriteUnsupportedOperators()); } catch (Exception e) { throw new RuntimeException("Error while processing expression: " + expr, e); } } private  HiveExpressions(); }
HiveExpressions { static Expression simplifyPartitionFilter(Expression expr, Set<String> partitionColumnNames) { try { Expression partitionPredicatesOnly = ExpressionVisitors.visit(expr, new RemoveNonPartitionPredicates(partitionColumnNames)); return ExpressionVisitors.visit(partitionPredicatesOnly, new RewriteUnsupportedOperators()); } catch (Exception e) { throw new RuntimeException("Error while processing expression: " + expr, e); } } private  HiveExpressions();  }
HiveExpressions { static Expression simplifyPartitionFilter(Expression expr, Set<String> partitionColumnNames) { try { Expression partitionPredicatesOnly = ExpressionVisitors.visit(expr, new RemoveNonPartitionPredicates(partitionColumnNames)); return ExpressionVisitors.visit(partitionPredicatesOnly, new RewriteUnsupportedOperators()); } catch (Exception e) { throw new RuntimeException("Error while processing expression: " + expr, e); } } private  HiveExpressions();   }