Skip to content
Permalink
Browse files
[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>
  • Loading branch information
AliSolaiman committed Jan 6, 2022
1 parent dd27f0f commit 83e5345ed694c6682627c18d28694931656f6930
Showing 1 changed file with 8 additions and 20 deletions.
@@ -230,7 +230,6 @@ public static void validateIndexFieldType(IndexType indexType, IAType fieldType,
case DATE:
case TIME:
case DATETIME:
case UNION:
case UUID:
case YEARMONTHDURATION:
case DAYTIMEDURATION:
@@ -249,7 +248,6 @@ public static void validateIndexFieldType(IndexType indexType, IAType fieldType,
case CIRCLE:
case POLYGON:
case GEOMETRY:
case UNION:
break;
default:
throw new CompilationException(ErrorCode.COMPILATION_ERROR, sourceLoc,
@@ -258,22 +256,17 @@ public static void validateIndexFieldType(IndexType indexType, IAType fieldType,
}
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:
switch (fieldType.getTypeTag()) {
case STRING:
case MULTISET:
case ARRAY:
case UNION:
break;
default:
throw new CompilationException(ErrorCode.COMPILATION_ERROR, sourceLoc,
@@ -282,22 +275,17 @@ public static void validateIndexFieldType(IndexType indexType, IAType fieldType,
}
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:
switch (fieldType.getTypeTag()) {
case STRING:
case MULTISET:
case ARRAY:
case UNION:
break;
default:
throw new CompilationException(ErrorCode.COMPILATION_ERROR, sourceLoc,

0 comments on commit 83e5345

Please sign in to comment.