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 12:37:36 UTC
[GitHub] [calcite] chunweilei commented on a change in pull request #1679:
[CALCITE-3620] Remove implicit lateral operator for temporal table join
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