korlov42 commented on a change in pull request #9119:
URL: https://github.com/apache/ignite/pull/9119#discussion_r715436866
##########
File path: modules/calcite/src/main/codegen/includes/parserImpls.ftl
##########
@@ -142,25 +146,55 @@ SqlNodeList TableElementList() :
}
}
+SqlNodeList TableSimpleColumnList() :
+{
+ final Span s;
+ final List<SqlNode> list = new ArrayList<SqlNode>();
+ SqlIdentifier id;
+}
+{
+ <LPAREN> { s = span(); }
+ id = SimpleIdentifier() {
+ list.add(SqlDdlNodes.column(s.add(id).end(this), id, null, null,
null));
Review comment:
why don't just use SqlIdentifier itself? It will allow to avoid
unnecessary branching in `IgniteSqlCreateTable#unparse`
##########
File path:
modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/TableDdlIntegrationTest.java
##########
@@ -275,6 +275,97 @@ public void createTableOnExistingCache() {
assertEquals(2, cache.size(CachePeekMode.PRIMARY));
}
+ /**
+ * Creates table as select.
+ */
+ @Test
+ public void createTableAsSelectSimpleCase() {
+ executeSql("create table my_table as select 1 as i, 'test' as s");
+ List<List<?>> res = executeSql("select i, s from my_table");
+
+ assertEquals(1, res.size());
+
+ List<?> row = res.get(0);
+
+ assertEquals(1, row.get(0));
+ assertEquals("test", row.get(1));
+ }
+
+ /**
+ * Creates table with specified columns as select.
+ */
+ @Test
+ public void createTableAsSelectWithColumns() {
Review comment:
let's add a few test to verify column names of just created tables
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]