public Queryable<T> where( Queryable<T> source, FunctionExpression<? extends Predicate1<T>> predicate) { RelNode child = toRel(source); RexNode node = translator.toRex(predicate, child); setRel(new FilterRel(translator.cluster, child, node)); return source; }
public <TResult> Queryable<TResult> select( Queryable<T> source, FunctionExpression<Function1<T, TResult>> selector) { RelNode child = toRel(source); List<RexNode> nodes = translator.toRexList(selector, child); setRel( new ProjectRel( translator.cluster, child, nodes.toArray(new RexNode[nodes.size()]), null, ProjectRelBase.Flags.Boxed)); return null; }
RelNode toRel(Queryable<T> queryable) { if (queryable instanceof QueryableDefaults.Replayable) { //noinspection unchecked ((QueryableDefaults.Replayable) queryable).replay(this); return rel; } if (queryable instanceof Table) { final OptiqPrepareImpl.RelOptTableImpl relOptTable = new OptiqPrepareImpl.RelOptTableImpl( null, ((Table) queryable).getRowType(), new String[0], (Table) queryable); if (queryable instanceof TranslatableTable) { return ((TranslatableTable) queryable).toRel(translator, relOptTable); } else { return new TableAccessRel(translator.cluster, relOptTable); } } return translator.translate(queryable.getExpression()); }