use of org.apache.asterix.om.base.AMissing in project asterixdb by apache.
the class FeedConnectionTupleTranslator method createFeedConnFromRecord.
private FeedConnection createFeedConnFromRecord(ARecord feedConnRecord) {
String dataverseName = ((AString) feedConnRecord.getValueByPos(MetadataRecordTypes.FEED_CONN_DATAVERSE_NAME_FIELD_INDEX)).getStringValue();
String feedName = ((AString) feedConnRecord.getValueByPos(MetadataRecordTypes.FEED_CONN_FEED_NAME_FIELD_INDEX)).getStringValue();
String datasetName = ((AString) feedConnRecord.getValueByPos(MetadataRecordTypes.FEED_CONN_DATASET_NAME_FIELD_INDEX)).getStringValue();
String outputType = ((AString) feedConnRecord.getValueByPos(MetadataRecordTypes.FEED_CONN_OUTPUT_TYPE_INDEX)).getStringValue();
String policyName = ((AString) feedConnRecord.getValueByPos(MetadataRecordTypes.FEED_CONN_POLICY_FIELD_INDEX)).getStringValue();
ArrayList<FunctionSignature> appliedFunctions = null;
Object o = feedConnRecord.getValueByPos(MetadataRecordTypes.FEED_CONN_APPLIED_FUNCTIONS_FIELD_INDEX);
IACursor cursor;
if (!(o instanceof ANull) && !(o instanceof AMissing)) {
appliedFunctions = new ArrayList<>();
FunctionSignature functionSignature;
cursor = ((AUnorderedList) feedConnRecord.getValueByPos(MetadataRecordTypes.FEED_CONN_APPLIED_FUNCTIONS_FIELD_INDEX)).getCursor();
while (cursor.next()) {
//TODO: allow different arity
functionSignature = new FunctionSignature(dataverseName, ((AString) cursor.get()).getStringValue(), 1);
appliedFunctions.add(functionSignature);
}
}
return new FeedConnection(dataverseName, feedName, datasetName, appliedFunctions, policyName, outputType);
}
Aggregations