Ali Alsuliman has uploaded this change for review. ( 
https://asterix-gerrit.ics.uci.edu/3404


Change subject: [ASTERIXDB-2547][COMP] Disallow passing UNION tag to get 
comparator
......................................................................

[ASTERIXDB-2547][COMP] Disallow passing UNION tag to get comparator

- user model changes: no
- storage format changes: no
- interface changes: no

Details:
UNION should not be allowed when getting a comparator by tag.
The comparator provider returns a generic comparator with types
ANY when UNION is passed as a tag. This could cause problems if
the actual type is a complex type. UNION should not be allowed.

Change-Id: Id8816a0dc5584f0a27410c512f3a44ccfc6c3151
---
M 
asterixdb/asterix-om/src/main/java/org/apache/asterix/formats/nontagged/BinaryComparatorFactoryProvider.java
1 file changed, 3 insertions(+), 3 deletions(-)



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

diff --git 
a/asterixdb/asterix-om/src/main/java/org/apache/asterix/formats/nontagged/BinaryComparatorFactoryProvider.java
 
b/asterixdb/asterix-om/src/main/java/org/apache/asterix/formats/nontagged/BinaryComparatorFactoryProvider.java
index 396bf3b..5f59a41 100644
--- 
a/asterixdb/asterix-om/src/main/java/org/apache/asterix/formats/nontagged/BinaryComparatorFactoryProvider.java
+++ 
b/asterixdb/asterix-om/src/main/java/org/apache/asterix/formats/nontagged/BinaryComparatorFactoryProvider.java
@@ -35,6 +35,7 @@
 import org.apache.asterix.om.types.ATypeTag;
 import org.apache.asterix.om.types.BuiltinType;
 import org.apache.asterix.om.types.IAType;
+import org.apache.hyracks.algebricks.common.exceptions.NotImplementedException;
 import org.apache.hyracks.algebricks.data.IBinaryComparatorFactoryProvider;
 import org.apache.hyracks.api.dataflow.value.IBinaryComparatorFactory;
 import org.apache.hyracks.data.std.accessors.BooleanBinaryComparatorFactory;
@@ -115,10 +116,9 @@
     public IBinaryComparatorFactory getBinaryComparatorFactory(ATypeTag type, 
boolean ascending) {
         switch (type) {
             case ANY:
-            case UNION:
-                // i think UNION shouldn't be allowed. the actual type could 
be closed array or record. ANY would fail.
-                // we could do smth better for nullable fields
                 return createGenericBinaryComparatorFactory(BuiltinType.ANY, 
BuiltinType.ANY, ascending);
+            case UNION:
+                throw new NotImplementedException("No comparator for type 
UNION");
             case NULL:
             case MISSING:
                 return new AnyBinaryComparatorFactory();

--
To view, visit https://asterix-gerrit.ics.uci.edu/3404
To unsubscribe, visit https://asterix-gerrit.ics.uci.edu/settings

Gerrit-Project: asterixdb
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: Id8816a0dc5584f0a27410c512f3a44ccfc6c3151
Gerrit-Change-Number: 3404
Gerrit-PatchSet: 1
Gerrit-Owner: Ali Alsuliman <[email protected]>

Reply via email to