use of org.apache.ignite.internal.sql.engine.schema.IgniteSchema in project ignite-3 by apache.
the class TableDmlPlannerTest method insertCachesTableScan.
/**
* InsertCachesTableScan.
* TODO Documentation https://issues.apache.org/jira/browse/IGNITE-15859
*
* @throws Exception If failed.
*/
@Test
public void insertCachesTableScan() throws Exception {
IgniteSchema schema = createSchema(createTable("TEST", IgniteDistributions.random(), "VAL", Integer.class));
String sql = "insert into test select 2 * val from test";
RelNode phys = physicalPlan(sql, schema, "LogicalIndexScanConverterRule");
assertNotNull(phys);
String invalidPlanMsg = "Invalid plan:\n" + RelOptUtil.toString(phys);
IgniteTableModify modifyNode = findFirstNode(phys, byClass(IgniteTableModify.class));
assertThat(invalidPlanMsg, modifyNode, notNullValue());
assertThat(invalidPlanMsg, modifyNode.getInput(), instanceOf(Spool.class));
Spool spool = (Spool) modifyNode.getInput();
assertThat(invalidPlanMsg, spool.readType, equalTo(Spool.Type.EAGER));
assertThat(invalidPlanMsg, findFirstNode(phys, byClass(IgniteTableScan.class)), notNullValue());
}
use of org.apache.ignite.internal.sql.engine.schema.IgniteSchema in project ignite-3 by apache.
the class TableDmlPlannerTest method updateNotCachesNonDependentIndexScan.
/**
* UpdateNotCachesNonDependentIndexScan.
* TODO Documentation https://issues.apache.org/jira/browse/IGNITE-15859
*
* @throws Exception If failed.
*/
@Test
public void updateNotCachesNonDependentIndexScan() throws Exception {
TestTable tbl = createTable("TEST", IgniteDistributions.random(), "VAL", Integer.class, "IDX_VAL", Integer.class);
tbl.addIndex(new IgniteIndex(RelCollations.of(1), "IDX", tbl));
IgniteSchema schema = createSchema(tbl);
String sql = "update test set val = 2 * val where idx_val between 2 and 10";
RelNode phys = physicalPlan(sql, schema, "LogicalTableScanConverterRule");
assertNotNull(phys);
String invalidPlanMsg = "Invalid plan:\n" + RelOptUtil.toString(phys);
assertThat(invalidPlanMsg, findFirstNode(phys, byClass(Spool.class)), nullValue());
assertThat(invalidPlanMsg, findFirstNode(phys, byClass(IgniteIndexScan.class)), notNullValue());
}
use of org.apache.ignite.internal.sql.engine.schema.IgniteSchema in project ignite-3 by apache.
the class TableDmlPlannerTest method updateNotCachesTableScan.
/**
* UpdateNotCachesTableScan.
* TODO Documentation https://issues.apache.org/jira/browse/IGNITE-15859
*
* @throws Exception If failed.
*/
@Test
public void updateNotCachesTableScan() throws Exception {
IgniteSchema schema = createSchema(createTable("TEST", IgniteDistributions.random(), "VAL", Integer.class));
String sql = "update test set val = 2 * val";
RelNode phys = physicalPlan(sql, schema, "LogicalIndexScanConverterRule");
assertNotNull(phys);
String invalidPlanMsg = "Invalid plan:\n" + RelOptUtil.toString(phys);
assertThat(invalidPlanMsg, findFirstNode(phys, byClass(Spool.class)), nullValue());
assertThat(invalidPlanMsg, findFirstNode(phys, byClass(IgniteTableScan.class)), notNullValue());
}
use of org.apache.ignite.internal.sql.engine.schema.IgniteSchema in project ignite-3 by apache.
the class TableDmlPlannerTest method updateCachesDependentIndexScan.
/**
* UpdateCachesDependentIndexScan.
* TODO Documentation https://issues.apache.org/jira/browse/IGNITE-15859
*
* @throws Exception If failed.
*/
@Test
public void updateCachesDependentIndexScan() throws Exception {
TestTable tbl = createTable("TEST", IgniteDistributions.random(), "VAL", Integer.class);
tbl.addIndex(new IgniteIndex(RelCollations.of(0), "IDX", tbl));
IgniteSchema schema = createSchema(tbl);
String sql = "update test set val = 2 * val where val between 2 and 10";
RelNode phys = physicalPlan(sql, schema, "LogicalTableScanConverterRule");
assertNotNull(phys);
String invalidPlanMsg = "Invalid plan:\n" + RelOptUtil.toString(phys);
IgniteTableModify modifyNode = findFirstNode(phys, byClass(IgniteTableModify.class));
assertThat(invalidPlanMsg, modifyNode, notNullValue());
assertThat(invalidPlanMsg, modifyNode.getInput(), instanceOf(Spool.class));
Spool spool = (Spool) modifyNode.getInput();
assertThat(invalidPlanMsg, spool.readType, equalTo(Spool.Type.EAGER));
assertThat(invalidPlanMsg, findFirstNode(phys, byClass(IgniteIndexScan.class)), notNullValue());
}
use of org.apache.ignite.internal.sql.engine.schema.IgniteSchema in project ignite-3 by apache.
the class TableFunctionPlannerTest method setup.
/**
* Setup.
* TODO Documentation https://issues.apache.org/jira/browse/IGNITE-15859
*/
@BeforeAll
public void setup() {
publicSchema = new IgniteSchema("PUBLIC");
IgniteTypeFactory f = new IgniteTypeFactory(IgniteTypeSystem.INSTANCE);
RelDataType type = new RelDataTypeFactory.Builder(f).add("ID", f.createJavaType(Integer.class)).add("NAME", f.createJavaType(String.class)).add("SALARY", f.createJavaType(Double.class)).build();
createTable(publicSchema, "RANDOM_TBL", type, IgniteDistributions.random());
createTable(publicSchema, "BROADCAST_TBL", type, IgniteDistributions.broadcast());
}
Aggregations