/** * Returns true or false indicating whether or not a field is closed. * * @param fieldName * the name of the field to check * @return true if fieldName is a closed field, otherwise false */ public boolean isClosedField(String fieldName) { return getFieldIndex(fieldName) != -1; }
@Override public int getFieldId(String fieldName) { return recType.getFieldIndex(fieldName); }
/** * Returns the field type of the field name if it exists, otherwise null. * * @param fieldName * the fieldName whose type is sought * @return the field type of the field name if it exists, otherwise null * NOTE: this method doesn't work for nested fields */ public IAType getFieldType(String fieldName) { int fieldPos = getFieldIndex(fieldName); if ((fieldPos < 0) || (fieldPos >= fieldTypes.length)) { return null; } return fieldTypes[fieldPos]; }
private String getCompressionScheme(ARecord datasetRecord) { final ARecordType datasetType = datasetRecord.getType(); final int compressionIndex = datasetType .getFieldIndex(MetadataRecordTypes.DATASET_ARECORD_BLOCK_LEVEL_STORAGE_COMPRESSION_FIELD_NAME); if (compressionIndex >= 0) { final ARecordType compressionType = (ARecordType) datasetType.getFieldTypes()[compressionIndex]; final int schemeIndex = compressionType .getFieldIndex(MetadataRecordTypes.DATASET_ARECORD_DATASET_COMPRESSION_SCHEME_FIELD_NAME); return ((AString) datasetRecord.getValueByPos(schemeIndex)).getStringValue(); } return CompressionManager.NONE; }
private long getRebalanceCount(ARecord datasetRecord) { // Read the rebalance count if there is one. int rebalanceCountIndex = datasetRecord.getType().getFieldIndex(MetadataRecordTypes.DATASET_ARECORD_REBALANCE_FIELD_NAME); return rebalanceCountIndex >= 0 ? ((AInt64) datasetRecord.getValueByPos(rebalanceCountIndex)).getLongValue() : 0; }
: sourceType.getFieldIndex(indexFieldId.fieldName.get(0));
ARecordType nestedRecType = (ARecordType) TypeComputeUtils.getActualType(nestedType.first); IAType[] nestedRecTypeFieldTypes = nestedRecType.getFieldTypes().clone(); nestedRecTypeFieldTypes[nestedRecType.getFieldIndex(nestedType.second)] = enforcedRecordType; enforcedRecordType = new ARecordType(nestedRecType.getTypeName() + "_enforced", nestedRecType.getFieldNames(), nestedRecTypeFieldTypes, nestedRecType.isOpen());
int indexKeyTypeFieldPos = rec.getType().getFieldIndex(INDEX_SEARCHKEY_TYPE_FIELD_NAME); IACursor fieldTypeCursor = new ACollectionCursor(); if (indexKeyTypeFieldPos > 0) { int isEnforcedFieldPos = rec.getType().getFieldIndex(INDEX_ISENFORCED_FIELD_NAME); Boolean isEnforcingKeys = false; if (isEnforcedFieldPos > 0) { int gramLenPos = rec.getType().getFieldIndex(GRAM_LENGTH_FIELD_NAME); if (gramLenPos >= 0) { gramLength = ((AInt32) rec.getValueByPos(gramLenPos)).getIntegerValue(); int keyFieldSourceIndicatorIndex = rec.getType().getFieldIndex(INDEX_SEARCHKEY_SOURCE_INDICATOR_FIELD_NAME); if (keyFieldSourceIndicatorIndex >= 0) { IACursor cursor = ((AOrderedList) rec.getValueByPos(keyFieldSourceIndicatorIndex)).getCursor();
int whereClauseIdx = feedConnRecord.getType().getFieldIndex(MetadataRecordTypes.FIELD_NAME_WHERE_CLAUSE); String whereClauseBody = whereClauseIdx >= 0 ? ((AString) feedConnRecord.getValueByPos(whereClauseIdx)).getStringValue() : "";
@SuppressWarnings("unchecked") private static ILogicalExpression createFieldAccessByIndex(ARecordType recType, AbstractFunctionCallExpression fce) { String s = ConstantExpressionUtil.getStringArgument(fce, 1); if (s == null) { return null; } int k = recType.getFieldIndex(s); if (k < 0) { return null; } ScalarFunctionCallExpression faExpr = new ScalarFunctionCallExpression( FunctionUtil.getFunctionInfo(BuiltinFunctions.FIELD_ACCESS_BY_INDEX), fce.getArguments().get(0), new MutableObject<>(new ConstantExpression(new AsterixConstantValue(new AInt32(k))))); faExpr.setSourceLocation(fce.getSourceLocation()); return faExpr; } }
datasetDetailsRecord.getType().getFieldIndex(InternalDatasetDetails.FILTER_FIELD_NAME); if (filterFieldPos >= 0) { filterField = new ArrayList<>(); .getFieldIndex(InternalDatasetDetails.KEY_FILD_SOURCE_INDICATOR_FIELD_NAME); if (keyFieldSourceIndicatorIndex >= 0) { cursor = ((AOrderedList) datasetDetailsRecord.getValueByPos(keyFieldSourceIndicatorIndex)) String metaTypeName = null; int metaTypeDataverseNameIndex = datasetRecord.getType().getFieldIndex(MetadataRecordTypes.FIELD_NAME_METADATA_DATAVERSE); if (metaTypeDataverseNameIndex >= 0) { metaTypeDataverseName = ((AString) datasetRecord.getValueByPos(metaTypeDataverseNameIndex)).getStringValue(); int metaTypeNameIndex = datasetRecord.getType().getFieldIndex(MetadataRecordTypes.FIELD_NAME_METATYPE_NAME); metaTypeName = ((AString) datasetRecord.getValueByPos(metaTypeNameIndex)).getStringValue();
int pos = resultType.getFieldIndex(fname); if (pos >= 0) {
final int fieldIndex = recordType.getFieldIndex(fieldName);
ARecordType rt = (ARecordType) _emptyTypeEnv.getType(expr.getArguments().get(0).getValue()); String str = ConstantExpressionUtil.getStringConstant(expr.getArguments().get(1).getValue()); int k = rt.getFieldIndex(str); if (k >= 0) {
? indicators.get(i).intValue() == Index.RECORD_INDICATOR ? recordType : metaType : recordType; int pos = skNames.get(i).size() > 1 ? -1 : sourceType.getFieldIndex(skNames.get(i).get(0)); secondaryFieldAccessEvalFactories[i] = mdProvider.getDataFormat().getFieldAccessEvaluatorFactory(mdProvider.getFunctionManager(),