You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@asterixdb.apache.org by AsterixDB Code Review <do...@asterix-gerrit.ics.uci.edu> on 2022/01/06 00:40:53 UTC

Change in asterixdb[master]: [NO ISSUE][IDX] Clean up validating the indexed fields types

From Ali Alsuliman <al...@gmail.com>:

Ali Alsuliman has uploaded this change for review. ( https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/14703 )


Change subject: [NO ISSUE][IDX] Clean up validating the indexed fields types
......................................................................

[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
---
M asterixdb/asterix-algebra/src/main/java/org/apache/asterix/translator/util/ValidateUtil.java
1 file changed, 8 insertions(+), 20 deletions(-)



  git pull ssh://asterix-gerrit.ics.uci.edu:29418/asterixdb refs/changes/03/14703/1

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 @@
                     case DATE:
                     case TIME:
                     case DATETIME:
-                    case UNION:
                     case UUID:
                     case YEARMONTHDURATION:
                     case DAYTIMEDURATION:
@@ -249,7 +248,6 @@
                     case CIRCLE:
                     case POLYGON:
                     case GEOMETRY:
-                    case UNION:
                         break;
                     default:
                         throw new CompilationException(ErrorCode.COMPILATION_ERROR, sourceLoc,
@@ -258,14 +256,10 @@
                 }
                 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 @@
                     case STRING:
                     case MULTISET:
                     case ARRAY:
-                    case UNION:
                         break;
                     default:
                         throw new CompilationException(ErrorCode.COMPILATION_ERROR, sourceLoc,
@@ -282,14 +275,10 @@
                 }
                 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 @@
                     case STRING:
                     case MULTISET:
                     case ARRAY:
-                    case UNION:
                         break;
                     default:
                         throw new CompilationException(ErrorCode.COMPILATION_ERROR, sourceLoc,

-- 
To view, visit https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/14703
To unsubscribe, or for help writing mail filters, visit https://asterix-gerrit.ics.uci.edu/settings

Gerrit-Project: asterixdb
Gerrit-Branch: master
Gerrit-Change-Id: Ib70a3550411617c752b3acead778e2958e61dbb9
Gerrit-Change-Number: 14703
Gerrit-PatchSet: 1
Gerrit-Owner: Ali Alsuliman <al...@gmail.com>
Gerrit-MessageType: newchange

Change in asterixdb[master]: [NO ISSUE][IDX] Clean up validating the indexed fields types

Posted by AsterixDB Code Review <do...@asterix-gerrit.ics.uci.edu>.
From Ali Alsuliman <al...@gmail.com>:

Ali Alsuliman has uploaded this change for review. ( https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/14703 )


Change subject: [NO ISSUE][IDX] Clean up validating the indexed fields types
......................................................................

[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
---
M asterixdb/asterix-algebra/src/main/java/org/apache/asterix/translator/util/ValidateUtil.java
1 file changed, 8 insertions(+), 20 deletions(-)



  git pull ssh://asterix-gerrit.ics.uci.edu:29418/asterixdb refs/changes/03/14703/1

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 @@
                     case DATE:
                     case TIME:
                     case DATETIME:
-                    case UNION:
                     case UUID:
                     case YEARMONTHDURATION:
                     case DAYTIMEDURATION:
@@ -249,7 +248,6 @@
                     case CIRCLE:
                     case POLYGON:
                     case GEOMETRY:
-                    case UNION:
                         break;
                     default:
                         throw new CompilationException(ErrorCode.COMPILATION_ERROR, sourceLoc,
@@ -258,14 +256,10 @@
                 }
                 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 @@
                     case STRING:
                     case MULTISET:
                     case ARRAY:
-                    case UNION:
                         break;
                     default:
                         throw new CompilationException(ErrorCode.COMPILATION_ERROR, sourceLoc,
@@ -282,14 +275,10 @@
                 }
                 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 @@
                     case STRING:
                     case MULTISET:
                     case ARRAY:
-                    case UNION:
                         break;
                     default:
                         throw new CompilationException(ErrorCode.COMPILATION_ERROR, sourceLoc,

-- 
To view, visit https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/14703
To unsubscribe, or for help writing mail filters, visit https://asterix-gerrit.ics.uci.edu/settings

Gerrit-Project: asterixdb
Gerrit-Branch: master
Gerrit-Change-Id: Ib70a3550411617c752b3acead778e2958e61dbb9
Gerrit-Change-Number: 14703
Gerrit-PatchSet: 1
Gerrit-Owner: Ali Alsuliman <al...@gmail.com>
Gerrit-MessageType: newchange