use of org.apache.ignite.internal.sql.engine.exec.rel.ScanNode in project ignite-3 by apache.
the class LogicalRelImplementor method visit.
/**
* {@inheritDoc}
*/
@Override
public Node<RowT> visit(IgniteTableScan rel) {
RexNode condition = rel.condition();
List<RexNode> projects = rel.projects();
ImmutableBitSet requiredColumns = rel.requiredColumns();
InternalIgniteTable tbl = rel.getTable().unwrap(InternalIgniteTable.class);
assert tbl != null;
IgniteTypeFactory typeFactory = ctx.getTypeFactory();
RelDataType rowType = tbl.getRowType(typeFactory, requiredColumns);
Predicate<RowT> filters = condition == null ? null : expressionFactory.predicate(condition, rowType);
Function<RowT, RowT> prj = projects == null ? null : expressionFactory.project(projects, rowType);
ColocationGroup group = ctx.group(rel.sourceId());
if (!group.nodeIds().contains(ctx.localNodeId())) {
return new ScanNode<>(ctx, rowType, Collections.emptyList());
}
return new TableScanNode<>(ctx, rowType, tbl, group.partitions(ctx.localNodeId()), filters, prj, requiredColumns);
}
use of org.apache.ignite.internal.sql.engine.exec.rel.ScanNode in project ignite-3 by apache.
the class LogicalRelImplementor method visit.
/**
* {@inheritDoc}
*/
@Override
public Node<RowT> visit(IgniteIndexScan rel) {
// TODO: fix this
// RexNode condition = rel.condition();
// List<RexNode> projects = rel.projects();
InternalIgniteTable tbl = rel.getTable().unwrap(InternalIgniteTable.class);
IgniteTypeFactory typeFactory = ctx.getTypeFactory();
ImmutableBitSet requiredColumns = rel.requiredColumns();
// List<RexNode> lowerCond = rel.lowerBound();
// List<RexNode> upperCond = rel.upperBound();
RelDataType rowType = tbl.getRowType(typeFactory, requiredColumns);
// Predicate<Row> filters = condition == null ? null : expressionFactory.predicate(condition, rowType);
// Supplier<Row> lower = lowerCond == null ? null : expressionFactory.rowSource(lowerCond);
// Supplier<Row> upper = upperCond == null ? null : expressionFactory.rowSource(upperCond);
// Function<Row, Row> prj = projects == null ? null : expressionFactory.project(projects, rowType);
//
// IgniteIndex idx = tbl.getIndex(rel.indexName());
//
// ColocationGroup group = ctx.group(rel.sourceId());
Iterable<RowT> rowsIter = (Iterable<RowT>) List.of(new Object[] { 0, 0 }, // idx.scan(ctx, group, filters, lower, upper, prj, requiredColumns);
new Object[] { 1, 1 });
return new ScanNode<>(ctx, rowType, rowsIter);
}
use of org.apache.ignite.internal.sql.engine.exec.rel.ScanNode in project ignite-3 by apache.
the class LogicalRelImplementor method visit.
/**
* {@inheritDoc}
*/
@Override
public Node<RowT> visit(IgniteValues rel) {
List<RexLiteral> vals = Commons.flat(Commons.cast(rel.getTuples()));
RelDataType rowType = rel.getRowType();
return new ScanNode<>(ctx, rowType, expressionFactory.values(vals, rowType));
}
use of org.apache.ignite.internal.sql.engine.exec.rel.ScanNode in project ignite-3 by apache.
the class LogicalRelImplementor method visit.
/**
* {@inheritDoc}
*/
@Override
public Node<RowT> visit(IgniteTableFunctionScan rel) {
Supplier<Iterable<Object[]>> dataSupplier = expressionFactory.execute(rel.getCall());
RelDataType rowType = rel.getRowType();
RowFactory<RowT> rowFactory = ctx.rowHandler().factory(ctx.getTypeFactory(), rowType);
return new ScanNode<>(ctx, rowType, new TableFunctionScan<>(dataSupplier, rowFactory));
}
Aggregations