Search in sources :

Example 1 with AMissing

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);
}
Also used : ANull(org.apache.asterix.om.base.ANull) FeedConnection(org.apache.asterix.metadata.entities.FeedConnection) AMissing(org.apache.asterix.om.base.AMissing) AString(org.apache.asterix.om.base.AString) IACursor(org.apache.asterix.om.base.IACursor) AString(org.apache.asterix.om.base.AString) FunctionSignature(org.apache.asterix.common.functions.FunctionSignature)

Aggregations

FunctionSignature (org.apache.asterix.common.functions.FunctionSignature)1 FeedConnection (org.apache.asterix.metadata.entities.FeedConnection)1 AMissing (org.apache.asterix.om.base.AMissing)1 ANull (org.apache.asterix.om.base.ANull)1 AString (org.apache.asterix.om.base.AString)1 IACursor (org.apache.asterix.om.base.IACursor)1