Search in sources :

Example 1 with ExternalFilePendingOp

use of org.apache.asterix.common.config.DatasetConfig.ExternalFilePendingOp in project asterixdb by apache.

the class ExternalFileTupleTranslator method createExternalFileFromARecord.

private ExternalFile createExternalFileFromARecord(ARecord externalFileRecord) {
    String dataverseName = ((AString) externalFileRecord.getValueByPos(MetadataRecordTypes.EXTERNAL_FILE_ARECORD_DATAVERSENAME_FIELD_INDEX)).getStringValue();
    String datasetName = ((AString) externalFileRecord.getValueByPos(MetadataRecordTypes.EXTERNAL_FILE_ARECORD_DATASET_NAME_FIELD_INDEX)).getStringValue();
    int fileNumber = ((AInt32) externalFileRecord.getValueByPos(MetadataRecordTypes.EXTERNAL_FILE_ARECORD_FILE_NUMBER_FIELD_INDEX)).getIntegerValue();
    String fileName = ((AString) externalFileRecord.getValueByPos(MetadataRecordTypes.EXTERNAL_FILE_ARECORD_FILE_NAME_FIELD_INDEX)).getStringValue();
    long fileSize = ((AInt64) externalFileRecord.getValueByPos(MetadataRecordTypes.EXTERNAL_FILE_ARECORD_FILE_SIZE_FIELD_INDEX)).getLongValue();
    Date lastMoDifiedDate = new Date(((ADateTime) externalFileRecord.getValueByPos(MetadataRecordTypes.EXTERNAL_FILE_ARECORD_FILE_MOD_DATE_FIELD_INDEX)).getChrononTime());
    ExternalFilePendingOp pendingOp = ExternalFilePendingOp.values()[((AInt32) externalFileRecord.getValueByPos(MetadataRecordTypes.EXTERNAL_FILE_ARECORD_FILE_PENDING_OP_FIELD_INDEX)).getIntegerValue()];
    return new ExternalFile(dataverseName, datasetName, fileNumber, fileName, lastMoDifiedDate, fileSize, pendingOp);
}
Also used : ExternalFilePendingOp(org.apache.asterix.common.config.DatasetConfig.ExternalFilePendingOp) AString(org.apache.asterix.om.base.AString) AString(org.apache.asterix.om.base.AString) AInt32(org.apache.asterix.om.base.AInt32) Date(java.util.Date) ExternalFile(org.apache.asterix.external.indexing.ExternalFile) AInt64(org.apache.asterix.om.base.AInt64)

Aggregations

Date (java.util.Date)1 ExternalFilePendingOp (org.apache.asterix.common.config.DatasetConfig.ExternalFilePendingOp)1 ExternalFile (org.apache.asterix.external.indexing.ExternalFile)1 AInt32 (org.apache.asterix.om.base.AInt32)1 AInt64 (org.apache.asterix.om.base.AInt64)1 AString (org.apache.asterix.om.base.AString)1