You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@asterixdb.apache.org by al...@apache.org on 2022/01/06 20:34:38 UTC

[asterixdb] branch master updated: [NO ISSUE][IDX] Clean up validating the indexed fields types

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

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


The following commit(s) were added to refs/heads/master by this push:
     new 83e5345  [NO ISSUE][IDX] Clean up validating the indexed fields types
83e5345 is described below

commit 83e5345ed694c6682627c18d28694931656f6930
Author: Ali Alsuliman <al...@gmail.com>
AuthorDate: Wed Jan 5 16:32:18 2022 -0800

    [NO ISSUE][IDX] Clean up validating the indexed fields types
    
    - user model changes: no
    - storage format changes: no
    - interface changes: no
    
    Details:
    When checking the type of the indexed field, the actual type
    is checked. Remove UNION type from valid types of indexed field.
    
    Change-Id: Ib70a3550411617c752b3acead778e2958e61dbb9
    Reviewed-on: https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/14703
    Contrib: Jenkins <je...@fulliautomatix.ics.uci.edu>
    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: Dmitry Lychagin <dm...@couchbase.com>
---
 .../asterix/translator/util/ValidateUtil.java      | 28 +++++++---------------
 1 file changed, 8 insertions(+), 20 deletions(-)

diff --git a/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/translator/util/ValidateUtil.java b/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/translator/util/ValidateUtil.java
index 93d9347..0d6a452 100644
--- a/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/translator/util/ValidateUtil.java
+++ b/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/translator/util/ValidateUtil.java
@@ -230,7 +230,6 @@ public class ValidateUtil {
                     case DATE:
                     case TIME:
                     case DATETIME:
-                    case UNION:
                     case UUID:
                     case YEARMONTHDURATION:
                     case DAYTIMEDURATION:
@@ -249,7 +248,6 @@ public class ValidateUtil {
                     case CIRCLE:
                     case POLYGON:
                     case GEOMETRY:
-                    case UNION:
                         break;
                     default:
                         throw new CompilationException(ErrorCode.COMPILATION_ERROR, sourceLoc,
@@ -258,14 +256,10 @@ public class ValidateUtil {
                 }
                 break;
             case LENGTH_PARTITIONED_NGRAM_INVIX:
-                switch (fieldType.getTypeTag()) {
-                    case STRING:
-                    case UNION:
-                        break;
-                    default:
-                        throw new CompilationException(ErrorCode.COMPILATION_ERROR, sourceLoc,
-                                "The field \"" + displayFieldName + "\" which is of type " + fieldType.getTypeTag()
-                                        + " cannot be indexed using the Length Partitioned N-Gram index.");
+                if (fieldType.getTypeTag() != ATypeTag.STRING) {
+                    throw new CompilationException(ErrorCode.COMPILATION_ERROR, sourceLoc,
+                            "The field \"" + displayFieldName + "\" which is of type " + fieldType.getTypeTag()
+                                    + " cannot be indexed using the Length Partitioned N-Gram index.");
                 }
                 break;
             case LENGTH_PARTITIONED_WORD_INVIX:
@@ -273,7 +267,6 @@ public class ValidateUtil {
                     case STRING:
                     case MULTISET:
                     case ARRAY:
-                    case UNION:
                         break;
                     default:
                         throw new CompilationException(ErrorCode.COMPILATION_ERROR, sourceLoc,
@@ -282,14 +275,10 @@ public class ValidateUtil {
                 }
                 break;
             case SINGLE_PARTITION_NGRAM_INVIX:
-                switch (fieldType.getTypeTag()) {
-                    case STRING:
-                    case UNION:
-                        break;
-                    default:
-                        throw new CompilationException(ErrorCode.COMPILATION_ERROR, sourceLoc,
-                                "The field \"" + displayFieldName + "\" which is of type " + fieldType.getTypeTag()
-                                        + " cannot be indexed using the N-Gram index.");
+                if (fieldType.getTypeTag() != ATypeTag.STRING) {
+                    throw new CompilationException(ErrorCode.COMPILATION_ERROR, sourceLoc,
+                            "The field \"" + displayFieldName + "\" which is of type " + fieldType.getTypeTag()
+                                    + " cannot be indexed using the N-Gram index.");
                 }
                 break;
             case SINGLE_PARTITION_WORD_INVIX:
@@ -297,7 +286,6 @@ public class ValidateUtil {
                     case STRING:
                     case MULTISET:
                     case ARRAY:
-                    case UNION:
                         break;
                     default:
                         throw new CompilationException(ErrorCode.COMPILATION_ERROR, sourceLoc,