>From Peeyush Gupta <[email protected]>:

Peeyush Gupta has uploaded this change for review. ( 
https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/17868 )


Change subject: WIP : Make ScanCollectionUnnestingFunction  return MISSING on 
wrong args
......................................................................

WIP : Make ScanCollectionUnnestingFunction  return MISSING on wrong args

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

Change-Id: I0e43bcdaa13dd3c2eb3f8ffbff50c6ef7933d5af
---
M 
asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/scalar/AbstractScalarAggregateDescriptor.java
M 
asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/unnestingfunctions/std/ScanCollectionDescriptor.java
2 files changed, 23 insertions(+), 6 deletions(-)



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

diff --git 
a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/scalar/AbstractScalarAggregateDescriptor.java
 
b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/scalar/AbstractScalarAggregateDescriptor.java
index 064c861..2fd065d 100644
--- 
a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/scalar/AbstractScalarAggregateDescriptor.java
+++ 
b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/scalar/AbstractScalarAggregateDescriptor.java
@@ -80,7 +80,7 @@
             public IScalarEvaluator createScalarEvaluator(IEvaluatorContext 
ctx) throws HyracksDataException {
                 // Use ScanCollection to iterate over list items.
                 ScanCollectionUnnestingFunctionFactory scanCollectionFactory =
-                        new ScanCollectionUnnestingFunctionFactory(args[0], 
sourceLoc);
+                        new ScanCollectionUnnestingFunctionFactory(args[0], 
sourceLoc, getIdentifier());
                 return 
createScalarAggregateEvaluator(aggFuncFactory.createAggregateEvaluator(ctx),
                         scanCollectionFactory, ctx);
             }
diff --git 
a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/unnestingfunctions/std/ScanCollectionDescriptor.java
 
b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/unnestingfunctions/std/ScanCollectionDescriptor.java
index ff6dd89..6f9dd5c 100644
--- 
a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/unnestingfunctions/std/ScanCollectionDescriptor.java
+++ 
b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/unnestingfunctions/std/ScanCollectionDescriptor.java
@@ -21,11 +21,11 @@

 import java.io.IOException;

+import org.apache.asterix.om.exceptions.ExceptionUtil;
 import org.apache.asterix.om.functions.BuiltinFunctions;
 import org.apache.asterix.om.functions.IFunctionDescriptorFactory;
 import org.apache.asterix.om.types.ATypeTag;
 import org.apache.asterix.runtime.evaluators.common.ListAccessor;
-import org.apache.asterix.runtime.exceptions.TypeMismatchException;
 import 
org.apache.asterix.runtime.unnestingfunctions.base.AbstractUnnestingFunctionDynamicDescriptor;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
 import org.apache.hyracks.algebricks.runtime.base.IEvaluatorContext;
@@ -52,7 +52,7 @@

     @Override
     public IUnnestingEvaluatorFactory createUnnestingEvaluatorFactory(final 
IScalarEvaluatorFactory[] args) {
-        return new ScanCollectionUnnestingFunctionFactory(args[0], sourceLoc);
+        return new ScanCollectionUnnestingFunctionFactory(args[0], sourceLoc, 
getIdentifier());
     }

     public static class ScanCollectionUnnestingFunctionFactory implements 
IUnnestingEvaluatorFactory {
@@ -60,10 +60,13 @@
         private static final long serialVersionUID = 1L;
         private IScalarEvaluatorFactory listEvalFactory;
         private final SourceLocation sourceLoc;
+        private final FunctionIdentifier funID;

-        public ScanCollectionUnnestingFunctionFactory(IScalarEvaluatorFactory 
arg, SourceLocation sourceLoc) {
+        public ScanCollectionUnnestingFunctionFactory(IScalarEvaluatorFactory 
arg, SourceLocation sourceLoc,
+                FunctionIdentifier funID) {
             this.listEvalFactory = arg;
             this.sourceLoc = sourceLoc;
+            this.funID = funID;
         }

         @Override
@@ -88,8 +91,9 @@
                     }
                     if (typeTag != ATypeTag.SERIALIZED_ORDEREDLIST_TYPE_TAG
                             && typeTag != 
ATypeTag.SERIALIZED_UNORDEREDLIST_TYPE_TAG) {
-                        throw new TypeMismatchException(sourceLoc, typeTag, 
ATypeTag.SERIALIZED_ORDEREDLIST_TYPE_TAG,
-                                ATypeTag.SERIALIZED_UNORDEREDLIST_TYPE_TAG);
+                        ExceptionUtil.warnTypeMismatch(ctx, sourceLoc, funID, 
typeTag, 0, ATypeTag.MULTISET);
+                        metUnknown = true;
+                        return;
                     }
                     listAccessor.reset(inputVal.getByteArray(), 
inputVal.getStartOffset());
                     itemIndex = 0;

--
To view, visit https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/17868
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: I0e43bcdaa13dd3c2eb3f8ffbff50c6ef7933d5af
Gerrit-Change-Number: 17868
Gerrit-PatchSet: 1
Gerrit-Owner: Peeyush Gupta <[email protected]>
Gerrit-MessageType: newchange

Reply via email to