added an additional test for feed ingestion
diff --git a/asterix-external-data/src/main/java/edu/uci/ics/asterix/external/library/ExternalFunctionProvider.java b/asterix-external-data/src/main/java/edu/uci/ics/asterix/external/library/ExternalFunctionProvider.java
index d8cd823..fc629ea 100755
--- a/asterix-external-data/src/main/java/edu/uci/ics/asterix/external/library/ExternalFunctionProvider.java
+++ b/asterix-external-data/src/main/java/edu/uci/ics/asterix/external/library/ExternalFunctionProvider.java
@@ -63,6 +63,7 @@
setArguments(tuple);
evaluate(functionHelper);
} catch (Exception e) {
+ e.printStackTrace();
throw new AlgebricksException(e);
}
}
diff --git a/asterix-external-data/src/main/java/edu/uci/ics/asterix/external/library/JTypeObjectFactory.java b/asterix-external-data/src/main/java/edu/uci/ics/asterix/external/library/JTypeObjectFactory.java
index a4d0f59..3c5ddfd 100644
--- a/asterix-external-data/src/main/java/edu/uci/ics/asterix/external/library/JTypeObjectFactory.java
+++ b/asterix-external-data/src/main/java/edu/uci/ics/asterix/external/library/JTypeObjectFactory.java
@@ -15,6 +15,7 @@
package edu.uci.ics.asterix.external.library;
import java.util.ArrayList;
+import java.util.List;
import edu.uci.ics.asterix.external.library.java.IJObject;
import edu.uci.ics.asterix.external.library.java.JObjects.JBoolean;
@@ -39,6 +40,8 @@
import edu.uci.ics.asterix.external.library.java.JObjects.JUnorderedList;
import edu.uci.ics.asterix.om.types.AOrderedListType;
import edu.uci.ics.asterix.om.types.ARecordType;
+import edu.uci.ics.asterix.om.types.ATypeTag;
+import edu.uci.ics.asterix.om.types.AUnionType;
import edu.uci.ics.asterix.om.types.AUnorderedListType;
import edu.uci.ics.asterix.om.types.IAType;
import edu.uci.ics.asterix.om.util.container.IObjectFactory;
@@ -121,8 +124,18 @@
index++;
}
retValue = new JRecord((ARecordType) type, fieldObjects);
-
break;
+ case UNION:
+ AUnionType unionType = (AUnionType) type;
+ List<IAType> unionList = unionType.getUnionList();
+ IJObject itemObject = null;
+ for (IAType elementType : unionList) {
+ if (!elementType.getTypeTag().equals(ATypeTag.NULL)) {
+ itemObject = create(elementType);
+ break;
+ }
+ }
+ return retValue = itemObject;
}
return retValue;
}
diff --git a/asterix-external-data/src/test/java/edu/uci/ics/asterix/external/library/ParseTweetFunction.java b/asterix-external-data/src/test/java/edu/uci/ics/asterix/external/library/ParseTweetFunction.java
index de13e59..1046518 100644
--- a/asterix-external-data/src/test/java/edu/uci/ics/asterix/external/library/ParseTweetFunction.java
+++ b/asterix-external-data/src/test/java/edu/uci/ics/asterix/external/library/ParseTweetFunction.java
@@ -14,18 +14,18 @@
*/
package edu.uci.ics.asterix.external.library;
-import edu.uci.ics.asterix.external.library.java.JObjects.JOrderedList;
import edu.uci.ics.asterix.external.library.java.JObjects.JRecord;
import edu.uci.ics.asterix.external.library.java.JObjects.JString;
+import edu.uci.ics.asterix.external.library.java.JObjects.JUnorderedList;
import edu.uci.ics.asterix.external.library.java.JTypeTag;
public class ParseTweetFunction implements IExternalScalarFunction {
- private JOrderedList list = null;
+ private JUnorderedList list = null;
@Override
public void initialize(IFunctionHelper functionHelper) {
- list = new JOrderedList(functionHelper.getObject(JTypeTag.STRING));
+ list = new JUnorderedList(functionHelper.getObject(JTypeTag.STRING));
}
@Override
diff --git a/asterix-external-data/src/test/resources/text_functions.xml b/asterix-external-data/src/test/resources/text_functions.xml
index fef51aa..bd485a4 100644
--- a/asterix-external-data/src/test/resources/text_functions.xml
+++ b/asterix-external-data/src/test/resources/text_functions.xml
@@ -4,8 +4,8 @@
<libraryFunction>
<function_type>SCALAR</function_type>
<name>parseTweet</name>
- <arguments>TweetType</arguments>
- <return_type>TweetType</return_type>
+ <arguments>TweetInputType</arguments>
+ <return_type>TweetOutputType</return_type>
<definition>edu.uci.ics.asterix.external.library.ParseTweetFactory
</definition>
</libraryFunction>