[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 <jenkins@fulliautomatix.ics.uci.edu>
Integration-Tests: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Tested-by: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Reviewed-by: Ali Alsuliman <ali.al.solaiman@gmail.com>
Reviewed-by: Dmitry Lychagin <dmitry.lychagin@couchbase.com>
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,