private ImmutableList<Row> createRows(Compiler compiler, ImmutableList<ImmutableList<RexLiteral>> tuples) { final List<RexNode> nodes = new ArrayList<>(); for (ImmutableList<RexLiteral> tuple : tuples) { nodes.addAll(tuple); } final Scalar scalar = compiler.compile(nodes, null); final Object[] values = new Object[nodes.size()]; final Context context = compiler.createContext(); scalar.execute(context, values); final ImmutableList.Builder<Row> rows = ImmutableList.builder(); Object[] subValues = new Object[fieldCount]; for (int i = 0; i < values.length; i += fieldCount) { System.arraycopy(values, i, subValues, 0, fieldCount); rows.add(Row.asCopy(subValues)); } return rows.build(); }
private ImmutableList<Row> createRows(Compiler compiler, ImmutableList<ImmutableList<RexLiteral>> tuples) { final List<RexNode> nodes = new ArrayList<>(); for (ImmutableList<RexLiteral> tuple : tuples) { nodes.addAll(tuple); } final Scalar scalar = compiler.compile(nodes, null); final Object[] values = new Object[nodes.size()]; final Context context = compiler.createContext(); scalar.execute(context, values); final ImmutableList.Builder<Row> rows = ImmutableList.builder(); Object[] subValues = new Object[fieldCount]; for (int i = 0; i < values.length; i += fieldCount) { System.arraycopy(values, i, subValues, 0, fieldCount); rows.add(Row.asCopy(subValues)); } return rows.build(); }
@Override public Row apply(Row row) { final Object[] inValues = row.getValues(); for (int i = 0; i < rejectedProjects.size(); i++) { values[i] = inValues[rejectedProjects.get(i)]; } return Row.asCopy(values); } });
public Node implement(final InterpreterImplementor implementor) { return () -> { final Sink sink = implementor.relSinks.get(EnumerableBindable.this).get(0); final Enumerable<Object[]> enumerable = bind(implementor.dataContext); final Enumerator<Object[]> enumerator = enumerable.enumerator(); while (enumerator.moveNext()) { sink.send(Row.asCopy(enumerator.current())); } }; }
@Override public Row apply(Row row) { final Object[] inValues = row.getValues(); for (int i = 0; i < rejectedProjects.size(); i++) { values[i] = inValues[rejectedProjects.get(i)]; } return Row.asCopy(values); } });
public Node implement(final InterpreterImplementor implementor) { return () -> { final Sink sink = implementor.relSinks.get(EnumerableBindable.this).get(0); final Enumerable<Object[]> enumerable = bind(implementor.dataContext); final Enumerator<Object[]> enumerator = enumerable.enumerator(); while (enumerator.moveNext()) { sink.send(Row.asCopy(enumerator.current())); } }; }
public void run() throws InterruptedException { List<Row> rightList = null; final int leftCount = rel.getLeft().getRowType().getFieldCount(); final int rightCount = rel.getRight().getRowType().getFieldCount(); context.values = new Object[rel.getRowType().getFieldCount()]; Row left; Row right; while ((left = leftSource.receive()) != null) { System.arraycopy(left.getValues(), 0, context.values, 0, leftCount); if (rightList == null) { rightList = new ArrayList<>(); while ((right = rightSource.receive()) != null) { rightList.add(right); } } for (Row right2 : rightList) { System.arraycopy(right2.getValues(), 0, context.values, leftCount, rightCount); final Boolean execute = (Boolean) condition.execute(context); if (execute != null && execute) { sink.send(Row.asCopy(context.values)); } } } } }
public void run() throws InterruptedException { List<Row> rightList = null; final int leftCount = rel.getLeft().getRowType().getFieldCount(); final int rightCount = rel.getRight().getRowType().getFieldCount(); context.values = new Object[rel.getRowType().getFieldCount()]; Row left; Row right; while ((left = leftSource.receive()) != null) { System.arraycopy(left.getValues(), 0, context.values, 0, leftCount); if (rightList == null) { rightList = new ArrayList<>(); while ((right = rightSource.receive()) != null) { rightList.add(right); } } for (Row right2 : rightList) { System.arraycopy(right2.getValues(), 0, context.values, leftCount, rightCount); final Boolean execute = (Boolean) condition.execute(context); if (execute != null && execute) { sink.send(Row.asCopy(context.values)); } } } } }