You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@calcite.apache.org by GitBox <gi...@apache.org> on 2019/12/20 10:27:44 UTC

[GitHub] [calcite] danny0405 opened a new pull request #1679: [CALCITE-3620] Remove implicit lateral operator for temporal table join

danny0405 opened a new pull request #1679: [CALCITE-3620] Remove implicit lateral operator for temporal table join
URL: https://github.com/apache/calcite/pull/1679
 
 
   * Remove the SqlLateralOperator instantiation for temporal table join;
   * Remove SNAPSHOT node match for SqlLateralOperator;
   * In SqlValidatorImpl, fix the scope of SNAPSHOT node.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [calcite] danny0405 commented on a change in pull request #1679: [CALCITE-3620] Remove implicit lateral operator for temporal table join

Posted by GitBox <gi...@apache.org>.
danny0405 commented on a change in pull request #1679: [CALCITE-3620] Remove implicit lateral operator for temporal table join
URL: https://github.com/apache/calcite/pull/1679#discussion_r360421067
 
 

 ##########
 File path: core/src/main/java/org/apache/calcite/sql/validate/SqlValidatorImpl.java
 ##########
 @@ -4763,6 +4752,34 @@ private void validateAccess(
     }
   }
 
+  /**
+   * Validates snapshot to a table.
+   *
+   * @param node  The node to validate
+   * @param scope Validator scope to derive type
+   * @param ns    The namespace to lookup table
+   */
+  private void validateSnapshot(
+      SqlNode node,
+      SqlValidatorScope scope,
+      SqlValidatorNamespace ns) {
+    if (node.getKind() == SqlKind.SNAPSHOT) {
+      SqlSnapshot snapshot = (SqlSnapshot) node;
+      SqlNode period = snapshot.getPeriod();
+      RelDataType dataType = deriveType(scope, period);
+      if (dataType.getSqlTypeName() != SqlTypeName.TIMESTAMP) {
+        throw newValidationError(period,
+            Static.RESOURCE.illegalExpressionForTemporal(dataType.getSqlTypeName().getName()));
+      }
+      if (!ns.getTable().isTemporal()) {
+        List<String> qualifiedName = ns.getTable().getQualifiedName();
+        String tableName = qualifiedName.get(qualifiedName.size() - 1);
+        throw newValidationError(snapshot.getTableRef(),
+            Static.RESOURCE.notTemporalTable(tableName));
+      }
 
 Review comment:
   Tests was already there.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [calcite] danny0405 commented on a change in pull request #1679: [CALCITE-3620] Remove implicit lateral operator for temporal table join

Posted by GitBox <gi...@apache.org>.
danny0405 commented on a change in pull request #1679: [CALCITE-3620] Remove implicit lateral operator for temporal table join
URL: https://github.com/apache/calcite/pull/1679#discussion_r360421067
 
 

 ##########
 File path: core/src/main/java/org/apache/calcite/sql/validate/SqlValidatorImpl.java
 ##########
 @@ -4763,6 +4752,34 @@ private void validateAccess(
     }
   }
 
+  /**
+   * Validates snapshot to a table.
+   *
+   * @param node  The node to validate
+   * @param scope Validator scope to derive type
+   * @param ns    The namespace to lookup table
+   */
+  private void validateSnapshot(
+      SqlNode node,
+      SqlValidatorScope scope,
+      SqlValidatorNamespace ns) {
+    if (node.getKind() == SqlKind.SNAPSHOT) {
+      SqlSnapshot snapshot = (SqlSnapshot) node;
+      SqlNode period = snapshot.getPeriod();
+      RelDataType dataType = deriveType(scope, period);
+      if (dataType.getSqlTypeName() != SqlTypeName.TIMESTAMP) {
+        throw newValidationError(period,
+            Static.RESOURCE.illegalExpressionForTemporal(dataType.getSqlTypeName().getName()));
+      }
+      if (!ns.getTable().isTemporal()) {
+        List<String> qualifiedName = ns.getTable().getQualifiedName();
+        String tableName = qualifiedName.get(qualifiedName.size() - 1);
+        throw newValidationError(snapshot.getTableRef(),
+            Static.RESOURCE.notTemporalTable(tableName));
+      }
 
 Review comment:
   Tests were already there.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [calcite] chunweilei commented on a change in pull request #1679: [CALCITE-3620] Remove implicit lateral operator for temporal table join

Posted by GitBox <gi...@apache.org>.
chunweilei commented on a change in pull request #1679: [CALCITE-3620] Remove implicit lateral operator for temporal table join
URL: https://github.com/apache/calcite/pull/1679#discussion_r360355255
 
 

 ##########
 File path: core/src/main/java/org/apache/calcite/sql/validate/SqlValidatorImpl.java
 ##########
 @@ -4763,6 +4752,34 @@ private void validateAccess(
     }
   }
 
+  /**
+   * Validates snapshot to a table.
+   *
+   * @param node  The node to validate
+   * @param scope Validator scope to derive type
+   * @param ns    The namespace to lookup table
+   */
+  private void validateSnapshot(
+      SqlNode node,
+      SqlValidatorScope scope,
+      SqlValidatorNamespace ns) {
+    if (node.getKind() == SqlKind.SNAPSHOT) {
+      SqlSnapshot snapshot = (SqlSnapshot) node;
+      SqlNode period = snapshot.getPeriod();
+      RelDataType dataType = deriveType(scope, period);
+      if (dataType.getSqlTypeName() != SqlTypeName.TIMESTAMP) {
+        throw newValidationError(period,
+            Static.RESOURCE.illegalExpressionForTemporal(dataType.getSqlTypeName().getName()));
+      }
+      if (!ns.getTable().isTemporal()) {
+        List<String> qualifiedName = ns.getTable().getQualifiedName();
+        String tableName = qualifiedName.get(qualifiedName.size() - 1);
+        throw newValidationError(snapshot.getTableRef(),
+            Static.RESOURCE.notTemporalTable(tableName));
+      }
 
 Review comment:
   Should we add some tests?

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [calcite] danny0405 merged pull request #1679: [CALCITE-3620] Remove implicit lateral operator for temporal table join

Posted by GitBox <gi...@apache.org>.
danny0405 merged pull request #1679: [CALCITE-3620] Remove implicit lateral operator for temporal table join
URL: https://github.com/apache/calcite/pull/1679
 
 
   

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services