@Override public void onMatch( RelOptRuleCall call ) { List<RelNode> rels = call.getRelList(); final UnionRel union = (UnionRel) rels.get( 0 ); final List<RelNode> inputs = rels.subList( 1, rels.size() ); if( !union.getVariablesStopped().isEmpty() ) { LOG.warn( "variables stopped not supported by this rule" ); return; } call.transformTo( new CascadingUnionRel( union.getCluster(), union.getCluster().traitSetOf( Cascading.CONVENTION ), inputs, union.all ) ); } }