[GitHub] [ignite-3] lowka commented on a diff in pull request #1521: IGNITE-18254: Sql. Extend SQL grammar with ALTER ZONE statement

2023-01-19 Thread GitBox


lowka commented on code in PR #1521:
URL: https://github.com/apache/ignite-3/pull/1521#discussion_r1081445505


##
modules/sql-engine/src/main/codegen/config.fmpp:
##
@@ -594,7 +598,8 @@ data: {
 # Return type of method implementation should be 'SqlNode'.
 # Example: "SqlShowDatabases()", "SqlShowTables()".
 statementParserMethods: [
-  "SqlAlterTable()"
+  "SqlAlterTable()",
+  "SqlAlterZone()"

Review Comment:
   Changed AlterZone* to extends SqlDdl (since AlterTable* extends SqlDdl).



-- 
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: notifications-unsubscr...@ignite.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[GitHub] [ignite-3] lowka commented on a diff in pull request #1521: IGNITE-18254: Sql. Extend SQL grammar with ALTER ZONE statement

2023-01-19 Thread GitBox


lowka commented on code in PR #1521:
URL: https://github.com/apache/ignite-3/pull/1521#discussion_r1081445505


##
modules/sql-engine/src/main/codegen/config.fmpp:
##
@@ -594,7 +598,8 @@ data: {
 # Return type of method implementation should be 'SqlNode'.
 # Example: "SqlShowDatabases()", "SqlShowTables()".
 statementParserMethods: [
-  "SqlAlterTable()"
+  "SqlAlterTable()",
+  "SqlAlterZone()"

Review Comment:
   AlterZone* now extends SqlDdl as AlterTable*.



-- 
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: notifications-unsubscr...@ignite.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[GitHub] [ignite-3] lowka commented on a diff in pull request #1521: IGNITE-18254: Sql. Extend SQL grammar with ALTER ZONE statement

2023-01-19 Thread GitBox


lowka commented on code in PR #1521:
URL: https://github.com/apache/ignite-3/pull/1521#discussion_r1081440348


##
modules/sql-engine/src/main/codegen/includes/parserImpls.ftl:
##
@@ -532,3 +532,96 @@ SqlDrop SqlDropZone(Span s, boolean replace) :
 return new IgniteSqlDropZone(s.end(this), ifExists, zoneId);
 }
 }
+
+SqlNode SqlAlterZone() :
+{
+final Span s;
+final SqlIdentifier zoneId;
+final SqlIdentifier newZoneId;
+SqlNodeList optionList = null;
+}
+{
+ { s = span(); }
+ zoneId = CompoundIdentifier()
+(
+newZoneId = CompoundIdentifier() {

Review Comment:
   Fixed



##
modules/sql-engine/src/main/codegen/includes/parserImpls.ftl:
##
@@ -532,3 +532,96 @@ SqlDrop SqlDropZone(Span s, boolean replace) :
 return new IgniteSqlDropZone(s.end(this), ifExists, zoneId);
 }
 }
+
+SqlNode SqlAlterZone() :
+{
+final Span s;
+final SqlIdentifier zoneId;
+final SqlIdentifier newZoneId;
+SqlNodeList optionList = null;
+}
+{
+ { s = span(); }
+ zoneId = CompoundIdentifier()
+(
+newZoneId = CompoundIdentifier() {
+return new IgniteSqlAlterZoneRenameTo(s.end(this), zoneId, newZoneId);
+  }
+  |
+   { s.add(this); } optionList = AlterZoneOptions() {
+return new IgniteSqlAlterZoneWith(s.end(this), zoneId, optionList);
+  }
+)
+}
+
+SqlNodeList AlterZoneOptions() :
+{
+  List list = new ArrayList();
+  final Span s = Span.of();
+}
+{
+  AlterZoneOption(list)
+  (
+   { s.add(this); } AlterZoneOption(list)
+  )+

Review Comment:
   fixed



-- 
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: notifications-unsubscr...@ignite.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[GitHub] [ignite-3] lowka commented on a diff in pull request #1521: IGNITE-18254: Sql. Extend SQL grammar with ALTER ZONE statement

2023-01-19 Thread GitBox


lowka commented on code in PR #1521:
URL: https://github.com/apache/ignite-3/pull/1521#discussion_r1081438594


##
modules/sql-engine/src/main/codegen/config.fmpp:
##
@@ -29,6 +29,7 @@ data: {
 imports: [
   "org.apache.calcite.sql.SqlCreate",
   "org.apache.calcite.sql.SqlDrop",
+  "org.apache.calcite.sql.SqlDdl",

Review Comment:
   fixed



-- 
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: notifications-unsubscr...@ignite.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[GitHub] [ignite-3] lowka commented on a diff in pull request #1521: IGNITE-18254: Sql. Extend SQL grammar with ALTER ZONE statement

2023-01-17 Thread GitBox


lowka commented on code in PR #1521:
URL: https://github.com/apache/ignite-3/pull/1521#discussion_r1072072004


##
modules/sql-engine/src/main/codegen/includes/parserImpls.ftl:
##
@@ -532,3 +532,96 @@ SqlDrop SqlDropZone(Span s, boolean replace) :
 return new IgniteSqlDropZone(s.end(this), ifExists, zoneId);
 }
 }
+
+SqlNode SqlAlterZone() :
+{
+final Span s;
+final SqlIdentifier zoneId;
+final SqlIdentifier newZoneId;
+SqlNodeList optionList = null;
+}
+{
+ { s = span(); }
+ zoneId = CompoundIdentifier()

Review Comment:
   The ticket does not mention such syntax but sure, no problem.



-- 
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: notifications-unsubscr...@ignite.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[GitHub] [ignite-3] lowka commented on a diff in pull request #1521: IGNITE-18254: Sql. Extend SQL grammar with ALTER ZONE statement

2023-01-17 Thread GitBox


lowka commented on code in PR #1521:
URL: https://github.com/apache/ignite-3/pull/1521#discussion_r1072072004


##
modules/sql-engine/src/main/codegen/includes/parserImpls.ftl:
##
@@ -532,3 +532,96 @@ SqlDrop SqlDropZone(Span s, boolean replace) :
 return new IgniteSqlDropZone(s.end(this), ifExists, zoneId);
 }
 }
+
+SqlNode SqlAlterZone() :
+{
+final Span s;
+final SqlIdentifier zoneId;
+final SqlIdentifier newZoneId;
+SqlNodeList optionList = null;
+}
+{
+ { s = span(); }
+ zoneId = CompoundIdentifier()

Review Comment:
   The ticket does mention such syntax but sure, no problem.



-- 
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: notifications-unsubscr...@ignite.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[GitHub] [ignite-3] lowka commented on a diff in pull request #1521: IGNITE-18254: Sql. Extend SQL grammar with ALTER ZONE statement

2023-01-17 Thread GitBox


lowka commented on code in PR #1521:
URL: https://github.com/apache/ignite-3/pull/1521#discussion_r1072066793


##
modules/sql-engine/src/main/codegen/includes/parserImpls.ftl:
##
@@ -532,3 +532,96 @@ SqlDrop SqlDropZone(Span s, boolean replace) :
 return new IgniteSqlDropZone(s.end(this), ifExists, zoneId);
 }
 }
+
+SqlNode SqlAlterZone() :
+{
+final Span s;
+final SqlIdentifier zoneId;
+final SqlIdentifier newZoneId;
+SqlNodeList optionList = null;
+}
+{
+ { s = span(); }
+ zoneId = CompoundIdentifier()
+(
+newZoneId = CompoundIdentifier() {
+return new IgniteSqlAlterZoneRenameTo(s.end(this), zoneId, newZoneId);
+  }
+  |
+   { s.add(this); } optionList = AlterZoneOptions() {

Review Comment:
   Sure.



-- 
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: notifications-unsubscr...@ignite.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[GitHub] [ignite-3] lowka commented on a diff in pull request #1521: IGNITE-18254: Sql. Extend SQL grammar with ALTER ZONE statement

2023-01-17 Thread GitBox


lowka commented on code in PR #1521:
URL: https://github.com/apache/ignite-3/pull/1521#discussion_r1072065179


##
modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/engine/sql/IgniteSqlAlterZoneRenameTo.java:
##
@@ -0,0 +1,70 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.sql.engine.sql;
+
+import java.util.List;
+import org.apache.calcite.sql.SqlIdentifier;
+import org.apache.calcite.sql.SqlNode;
+import org.apache.calcite.sql.SqlWriter;
+import org.apache.calcite.sql.parser.SqlParserPos;
+import org.apache.calcite.util.ImmutableNullableList;
+
+/**
+ * Parse tree for {@code ALTER ZONE RENAME TO} statement.
+ */
+public class IgniteSqlAlterZoneRenameTo extends IgniteAbstractSqlAlterZone {
+
+private final SqlIdentifier name;
+
+private final SqlIdentifier newName;
+
+/** Constructor. */
+public IgniteSqlAlterZoneRenameTo(SqlParserPos pos, SqlIdentifier name, 
SqlIdentifier newName) {
+super(pos);
+this.name = name;
+this.newName = newName;
+}
+
+/** {@inheritDoc} */
+@Override
+public List getOperandList() {
+return ImmutableNullableList.of(name);
+}
+
+/** The name of a distribution zone to alter. **/
+public SqlIdentifier name() {
+return name;
+}
+
+/**
+ * The new name for a distribution zone.
+ */
+public SqlIdentifier newName() {
+return newName;
+}
+
+

Review Comment:
   fixed



-- 
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: notifications-unsubscr...@ignite.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[GitHub] [ignite-3] lowka commented on a diff in pull request #1521: IGNITE-18254: Sql. Extend SQL grammar with ALTER ZONE statement

2023-01-16 Thread GitBox


lowka commented on code in PR #1521:
URL: https://github.com/apache/ignite-3/pull/1521#discussion_r1071837306


##
modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/engine/sql/IgniteAbstractSqlAlterZone.java:
##
@@ -0,0 +1,48 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.sql.engine.sql;
+
+import org.apache.calcite.sql.SqlAlter;
+import org.apache.calcite.sql.SqlKind;
+import org.apache.calcite.sql.SqlOperator;
+import org.apache.calcite.sql.SqlSpecialOperator;
+import org.apache.calcite.sql.parser.SqlParserPos;
+
+/**
+ * A base class for a parse tree for {@code ALTER ZONE } statement.
+ */
+public abstract class IgniteAbstractSqlAlterZone extends SqlAlter {
+
+/** Alter operator. */
+private static final SqlOperator OPERATOR =
+new SqlSpecialOperator("ALTER ZONE", SqlKind.OTHER_DDL);
+
+/** Scope. **/
+private static final String SCOPE = "ZONE";
+
+/** Constructor. */
+public IgniteAbstractSqlAlterZone(SqlParserPos pos) {

Review Comment:
   Fixed



-- 
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: notifications-unsubscr...@ignite.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org