private static List<Integer> getInputChannels(Iterable<RowExpression> expressions) { TreeSet<Integer> channels = new TreeSet<>(); for (RowExpression expression : Expressions.subExpressions(expressions)) { if (expression instanceof InputReferenceExpression) { channels.add(((InputReferenceExpression) expression).getField()); } } return ImmutableList.copyOf(channels); }
private static boolean isConstantExpression(RowExpression expression) { List<RowExpression> rowExpressions = Expressions.subExpressions(ImmutableList.of(expression)); return rowExpressions.size() == 1 && Iterables.getOnlyElement(rowExpressions) instanceof ConstantExpression && ((ConstantExpression) Iterables.getOnlyElement(rowExpressions)).getValue() != null; }
private static boolean isIdentityExpression(RowExpression expression) { List<RowExpression> rowExpressions = Expressions.subExpressions(ImmutableList.of(expression)); return rowExpressions.size() == 1 && Iterables.getOnlyElement(rowExpressions) instanceof InputReferenceExpression; }