Skip to content

Commit 2f46c5f

Browse files
committed
Rebase
Signed-off-by: Lorenzo Stella <stellalo@amazon.de>
1 parent c5200d2 commit 2f46c5f

2 files changed

Lines changed: 17 additions & 37 deletions

File tree

api/src/test/java/org/opensearch/sql/api/UnifiedQueryPlannerTest.java

Lines changed: 2 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -20,41 +20,8 @@
2020
import org.opensearch.sql.common.setting.Settings;
2121
import org.opensearch.sql.executor.QueryType;
2222

23+
@RunWith(MockitoJUnitRunner.class)
2324
public class UnifiedQueryPlannerTest extends UnifiedQueryTestBase {
24-
// @RunWith(MockitoJUnitRunner.class)
25-
// public class UnifiedQueryPlannerTest {
26-
27-
// /** Test schema consists of a test table with id and name columns */
28-
// private final AbstractSchema testSchema =
29-
// new AbstractSchema() {
30-
// @Override
31-
// protected Map<String, Table> getTableMap() {
32-
// return Map.of(
33-
// "index",
34-
// new AbstractTable() {
35-
// @Override
36-
// public RelDataType getRowType(RelDataTypeFactory typeFactory) {
37-
// return typeFactory.createStructType(
38-
// List.of(
39-
// typeFactory.createSqlType(SqlTypeName.INTEGER),
40-
// typeFactory.createSqlType(SqlTypeName.VARCHAR)),
41-
// List.of("id", "name"));
42-
// }
43-
// },
44-
// "index2",
45-
// new AbstractTable() {
46-
// @Override
47-
// public RelDataType getRowType(RelDataTypeFactory typeFactory) {
48-
// return typeFactory.createStructType(
49-
// List.of(
50-
// typeFactory.createSqlType(SqlTypeName.INTEGER),
51-
// typeFactory.createSqlType(SqlTypeName.FLOAT)),
52-
// List.of("id", "value"));
53-
// }
54-
// }
55-
// );
56-
// }
57-
// };
5825

5926
/** Test catalog consists of test schema above */
6027
private final AbstractSchema testDeepSchema =
@@ -206,6 +173,6 @@ public void testJoinQuery() {
206173
.settings(testSettings)
207174
.build();
208175

209-
planner.plan("source = index | join on index.id = index2.id index2");
176+
planner.plan("source = employees | join on employees.id = payslips.id payslips");
210177
}
211178
}

api/src/test/java/org/opensearch/sql/api/UnifiedQueryTestBase.java

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
import org.opensearch.sql.executor.QueryType;
1818

1919
/** Base class for unified query tests providing common test schema and utilities. */
20-
@RunWith(MockitoJUnitRunner.class)
2120
public abstract class UnifiedQueryTestBase {
2221

2322
/** Test schema containing sample tables for testing */
@@ -32,7 +31,7 @@ public void setUp() {
3231
new AbstractSchema() {
3332
@Override
3433
protected Map<String, Table> getTableMap() {
35-
return Map.of("employees", createEmployeesTable());
34+
return Map.of("employees", createEmployeesTable(), "payslips", createPayslipsTable());
3635
}
3736
};
3837

@@ -58,4 +57,18 @@ public RelDataType getRowType(RelDataTypeFactory typeFactory) {
5857
}
5958
};
6059
}
60+
61+
protected Table createPayslipsTable() {
62+
return new AbstractTable() {
63+
@Override
64+
public RelDataType getRowType(RelDataTypeFactory typeFactory) {
65+
return typeFactory.createStructType(
66+
List.of(
67+
typeFactory.createSqlType(SqlTypeName.INTEGER),
68+
typeFactory.createSqlType(SqlTypeName.DATE),
69+
typeFactory.createSqlType(SqlTypeName.FLOAT)),
70+
List.of("id", "date", "salary"));
71+
}
72+
};
73+
}
6174
}

0 commit comments

Comments
 (0)