You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@asterixdb.apache.org by mb...@apache.org on 2021/03/26 11:10:49 UTC

[asterixdb] 06/09: [NO ISSUE][COMP] Issue a warning when a synonym was not created because it exists

This is an automated email from the ASF dual-hosted git repository.

mblow pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/asterixdb.git

commit 4b8a47d8d711241b8970cb8cdef186ecb5dffc2c
Author: Ali Alsuliman <al...@gmail.com>
AuthorDate: Thu Mar 11 17:09:06 2021 -0800

    [NO ISSUE][COMP] Issue a warning when a synonym was not created because it exists
    
    - user model changes: no
    - storage format changes: no
    - interface changes: no
    
    Details:
    When creating a synonym with IF EXISTS, issue a warning when
    the synonym was not created because it exists.
    
    Change-Id: Iff9ec2f4e28db9824e93a4ab71dcfd85e716fec6
    Reviewed-on: https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/10463
    Integration-Tests: Jenkins <je...@fulliautomatix.ics.uci.edu>
    Tested-by: Jenkins <je...@fulliautomatix.ics.uci.edu>
    Reviewed-by: Ali Alsuliman <al...@gmail.com>
    Reviewed-by: Ian Maxon <im...@uci.edu>
---
 .../main/java/org/apache/asterix/app/translator/QueryTranslator.java  | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/translator/QueryTranslator.java b/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/translator/QueryTranslator.java
index 0a88832..64d0fd7 100644
--- a/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/translator/QueryTranslator.java
+++ b/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/translator/QueryTranslator.java
@@ -2664,6 +2664,10 @@ public class QueryTranslator extends AbstractLangTranslator implements IStatemen
             if (synonym != null) {
                 if (css.getIfNotExists()) {
                     MetadataManager.INSTANCE.commitTransaction(mdTxnCtx);
+                    if (warningCollector.shouldWarn()) {
+                        warningCollector
+                                .warn(Warning.of(css.getSourceLocation(), ErrorCode.SYNONYM_EXISTS, synonymName));
+                    }
                     return;
                 }
                 throw new CompilationException(ErrorCode.SYNONYM_EXISTS, css.getSourceLocation(), synonymName);