Skip to content

Commit 557138a

Browse files
committed
optimize test code
1 parent 1e24105 commit 557138a

File tree

1 file changed

+74
-6
lines changed

1 file changed

+74
-6
lines changed

sqlrec-frontend/src/test/java/com/sqlrec/connectors/TestMilvusCalciteTable.java

Lines changed: 74 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -59,12 +59,80 @@ protected Map<String, Table> getTableMap() {
5959
new SqlTestCase("select * from t2 join t1 on 1=1 order by ip(t2.embedding, t1.embedding)", null).test(schema);
6060
new SqlTestCase("cache table tmp as select * from t2 join t1 on 1=1 order by ip(t2.embedding, t1.embedding)", null).test(schema);
6161
new SqlTestCase("select * from tmp", null).test(schema);
62-
new SqlTestCase("select * from t2 join t1 on 1=1 order by ip(t2.embedding, t1.embedding) limit 10", null).test(schema);
63-
new SqlTestCase("select t1.* from t2 join t1 on 1=1 order by ip(t2.embedding, t1.embedding) limit 10", null).test(schema);
64-
new SqlTestCase("select t2.ID, t1.id, t1.name from t2 join t1 on 1=1 order by ip(t2.embedding, t1.embedding)", null).test(schema);
65-
new SqlTestCase("select t2.ID, t1.id, t1.name from t2 join t1 on 1=1 order by ip(t2.embedding, t1.embedding) limit 10", null).test(schema);
66-
new SqlTestCase("select * from t2 join t1 on 1=1 where t2.name = t1.name order by ip(t2.embedding, t1.embedding) limit 10", null).test(schema);
67-
new SqlTestCase("select * from t2 join t1 on 1=1 where t1.id >= 1 order by ip(t2.embedding, t1.embedding) limit 10", null).test(schema);
62+
new SqlTestCase("select * from t2 join t1 on 1=1 order by ip(t2.embedding, t1.embedding) limit 10", null,
63+
"""
64+
LogicalSort(sort0=[$6], dir0=[ASC], fetch=[10])
65+
LogicalProject(ID=[$0], NAME=[$1], embedding=[$2], id0=[$3], embedding0=[$4], name0=[$5], EXPR$6=[ip($2, $4)])
66+
LogicalJoin(condition=[true], joinType=[inner])
67+
LogicalTableScan(table=[[default, t2]])
68+
LogicalTableScan(table=[[default, t1]])""",
69+
"""
70+
SqlrecEnumerableVectorJoin(condition=[true], joinType=[INNER], leftEmbeddingColIndex=[2], rightEmbeddingColName=[embedding], limit=[10], projects=[[0, 1, 2, 3, 4, 5, 6]])
71+
EnumerableTableScan(table=[[default, t2]])
72+
EnumerableTableScan(table=[[default, t1]])""",
73+
null).test(schema);
74+
new SqlTestCase("select t1.* from t2 join t1 on 1=1 order by ip(t2.embedding, t1.embedding) limit 10", null,
75+
"""
76+
LogicalSort(sort0=[$3], dir0=[ASC], fetch=[10])
77+
LogicalProject(id=[$3], embedding=[$4], name=[$5], EXPR$3=[ip($2, $4)])
78+
LogicalJoin(condition=[true], joinType=[inner])
79+
LogicalTableScan(table=[[default, t2]])
80+
LogicalTableScan(table=[[default, t1]])""",
81+
"""
82+
SqlrecEnumerableVectorJoin(condition=[true], joinType=[INNER], leftEmbeddingColIndex=[2], rightEmbeddingColName=[embedding], limit=[10], projects=[[3, 4, 5, 6]])
83+
EnumerableTableScan(table=[[default, t2]])
84+
EnumerableTableScan(table=[[default, t1]])""",
85+
null).test(schema);
86+
new SqlTestCase("select t2.ID, t1.id, t1.name from t2 join t1 on 1=1 order by ip(t2.embedding, t1.embedding)", null,
87+
"""
88+
LogicalSort(sort0=[$3], dir0=[ASC])
89+
LogicalProject(ID=[$0], id0=[$3], name=[$5], EXPR$3=[ip($2, $4)])
90+
LogicalJoin(condition=[true], joinType=[inner])
91+
LogicalTableScan(table=[[default, t2]])
92+
LogicalTableScan(table=[[default, t1]])""",
93+
"""
94+
SqlrecEnumerableVectorJoin(condition=[true], joinType=[INNER], leftEmbeddingColIndex=[2], rightEmbeddingColName=[embedding], projects=[[0, 3, 5, 6]])
95+
EnumerableTableScan(table=[[default, t2]])
96+
EnumerableTableScan(table=[[default, t1]])""",
97+
null).test(schema);
98+
new SqlTestCase("select t2.ID, t1.id, t1.name from t2 join t1 on 1=1 order by ip(t2.embedding, t1.embedding) limit 10", null,
99+
"""
100+
LogicalSort(sort0=[$3], dir0=[ASC], fetch=[10])
101+
LogicalProject(ID=[$0], id0=[$3], name=[$5], EXPR$3=[ip($2, $4)])
102+
LogicalJoin(condition=[true], joinType=[inner])
103+
LogicalTableScan(table=[[default, t2]])
104+
LogicalTableScan(table=[[default, t1]])""",
105+
"""
106+
SqlrecEnumerableVectorJoin(condition=[true], joinType=[INNER], leftEmbeddingColIndex=[2], rightEmbeddingColName=[embedding], limit=[10], projects=[[0, 3, 5, 6]])
107+
EnumerableTableScan(table=[[default, t2]])
108+
EnumerableTableScan(table=[[default, t1]])""",
109+
null).test(schema);
110+
new SqlTestCase("select * from t2 join t1 on 1=1 where t2.name = t1.name order by ip(t2.embedding, t1.embedding) limit 10", null,
111+
"""
112+
LogicalSort(sort0=[$6], dir0=[ASC], fetch=[10])
113+
LogicalProject(ID=[$0], NAME=[$1], embedding=[$2], id0=[$3], embedding0=[$4], name0=[$5], EXPR$6=[ip($2, $4)])
114+
LogicalFilter(condition=[=($1, $5)])
115+
LogicalJoin(condition=[true], joinType=[inner])
116+
LogicalTableScan(table=[[default, t2]])
117+
LogicalTableScan(table=[[default, t1]])""",
118+
"""
119+
SqlrecEnumerableVectorJoin(condition=[true], joinType=[INNER], filterCondition=[=($1, $5)], leftEmbeddingColIndex=[2], rightEmbeddingColName=[embedding], limit=[10], projects=[[0, 1, 2, 3, 4, 5, 6]])
120+
EnumerableTableScan(table=[[default, t2]])
121+
EnumerableTableScan(table=[[default, t1]])""",
122+
null).test(schema);
123+
new SqlTestCase("select * from t2 join t1 on 1=1 where t1.id >= 1 order by ip(t2.embedding, t1.embedding) limit 10", null,
124+
"""
125+
LogicalSort(sort0=[$6], dir0=[ASC], fetch=[10])
126+
LogicalProject(ID=[$0], NAME=[$1], embedding=[$2], id0=[$3], embedding0=[$4], name0=[$5], EXPR$6=[ip($2, $4)])
127+
LogicalFilter(condition=[>=($3, 1)])
128+
LogicalJoin(condition=[true], joinType=[inner])
129+
LogicalTableScan(table=[[default, t2]])
130+
LogicalTableScan(table=[[default, t1]])""",
131+
"""
132+
SqlrecEnumerableVectorJoin(condition=[true], joinType=[INNER], filterCondition=[>=($3, 1)], leftEmbeddingColIndex=[2], rightEmbeddingColName=[embedding], limit=[10], projects=[[0, 1, 2, 3, 4, 5, 6]])
133+
EnumerableTableScan(table=[[default, t2]])
134+
EnumerableTableScan(table=[[default, t1]])""",
135+
null).test(schema);
68136
}
69137

70138
public static class MyTable extends SqlRecTable implements ScannableTable {

0 commit comments

Comments
 (0)