Skip to content
Permalink
Browse files
IGNITE-16554 Add table name to serialized form (#687)
  • Loading branch information
korlov42 committed Feb 27, 2022
1 parent 87665a2 commit 151c9b61f7e17df0ef0218cffc70c713e4773a39
Showing 6 changed files with 15 additions and 10 deletions.
@@ -71,7 +71,8 @@ public static Matcher<String> containsTableScan(String schema, String tblName) {
* @return Matcher.
*/
public static Matcher<String> containsIndexScan(String schema, String tblName) {
return containsSubPlan("IgniteIndexScan(table=[[" + schema + ", " + tblName + "]]");
return matchesOnce(".*IgniteIndexScan\\(table=\\[\\[" + schema + ", " + tblName + "\\]\\],"
+ " tableId=\\[.*\\].*\\)");
}

/**
@@ -83,7 +84,8 @@ public static Matcher<String> containsIndexScan(String schema, String tblName) {
* @return Matcher.
*/
public static Matcher<String> containsIndexScan(String schema, String tblName, String idxName) {
return containsSubPlan("IgniteIndexScan(table=[[" + schema + ", " + tblName + "]], index=[" + idxName + ']');
return matchesOnce(".*IgniteIndexScan\\(table=\\[\\[" + schema + ", " + tblName + "\\]\\],"
+ " tableId=\\[.*\\], index=\\[" + idxName + "\\].*\\)");
}

/**
@@ -157,7 +157,9 @@ public RelOptTable getTableById(String tag) {
String tableId = getString(tag);
IgniteTable table = schemaManager.tableById(UUID.fromString(tableId));

return RelOptTableImpl.create(null, table.getRowType(Commons.typeFactory()), List.of(tableId),
List<String> tableName = getStringList("table");

return RelOptTableImpl.create(null, table.getRowType(Commons.typeFactory()), tableName,
table, null);
}

@@ -133,7 +133,7 @@ public RelNode copy(RelTraitSet traitSet, List<RelNode> inputs) {
@Override
public RelWriter explainTerms(RelWriter pw) {
return explainTerms0(pw
.itemIf("table", table.getQualifiedName(), pw.getDetailLevel() == EXPPLAN_ATTRIBUTES)
.item("table", table.getQualifiedName())
.itemIf("tableId", table.unwrap(IgniteTable.class).id().toString(),
pw.getDetailLevel() != EXPPLAN_ATTRIBUTES)
);
@@ -98,6 +98,7 @@ public void registerSchema(RelOptSchema schema) {
RelOptCluster cluster = RelOptCluster.create(DUMMY_PLANNER, DFLT_REX_BUILDER);

cluster.setMetadataProvider(IgniteMetadata.METADATA_PROVIDER);
cluster.setMetadataQuerySupplier(RelMetadataQueryEx::create);

CLUSTER = cluster;
}
@@ -59,6 +59,7 @@ void fromJson() {
+ " \"rels\" : [ {\n"
+ " \"id\" : \"0\",\n"
+ " \"relOp\" : \"IgniteTableScan\",\n"
+ " \"table\" : [\"PUBLIC\", \"TEST\"],\n"
+ " \"tableId\" : \"" + tableId + "\",\n"
+ " \"inputs\" : [ ]\n"
+ " } ]\n"
@@ -312,16 +312,11 @@ public static <T> List<T> select(List<T> src, int... idxs) {
}

protected static void createTable(IgniteSchema schema, String name, RelDataType type, IgniteDistribution distr) {
TestTable table = new TestTable(type) {
TestTable table = new TestTable(type, name) {
@Override
public IgniteDistribution distribution() {
return distr;
}

@Override
public String name() {
return name;
}
};

schema.addTable(name, table);
@@ -576,6 +571,10 @@ abstract static class TestTable implements InternalIgniteTable {
this(type, 100.0);
}

TestTable(RelDataType type, String name) {
this(name, type, 100.0);
}

TestTable(RelDataType type, double rowCnt) {
this(UUID.randomUUID().toString(), type, rowCnt);
}

0 comments on commit 151c9b6

Please sign in to comment.