}
else if (hashIndex != -1 && (fieldIndex == -1 || hashIndex > fieldIndex)) {
currentName = currentName.substring(0, hashIndex);
if ((fs = getColumn(currentName)) != null) {
if (fs.type != ColumnType.MAP)
throw new ParseException(name + " is not of type MAP");
offset += hashIndex;
pn.setName(name.substring(0, hashIndex), ColumnType.MAP,
hashIndex + 1);
return fs;
}
}
else {
currentName = currentName.substring(0, fieldIndex);
if (getColumn(currentName) != null) break;
}
}
currentName = name;
ColumnType ct = ColumnType.ANY;
while (true) {
if (fieldIndex == -1 && hashIndex == -1) {
offset += currentName.length();
pn.setName(name.substring(0, offset), ct);
fs = currentSchema.getColumn(currentName);
return fs;
}
else if (hashIndex != -1 && (fieldIndex == -1 || hashIndex < fieldIndex)) {
prefix = currentName.substring(0, hashIndex);
fs = currentSchema.getColumn(prefix);
if (fs == null)
throw new ParseException("Column " + name + " does not exist");
currentSchema = fs.schema;
if (fs.type != ColumnType.MAP)
throw new ParseException(name + " is not of type MAP");
offset += hashIndex;
pn.setName(name.substring(0, offset), ColumnType.MAP, offset + 1);
return fs;
}
else {
prefix = currentName.substring(0, fieldIndex);
if ((fs = currentSchema.getColumn(prefix)) == null)
throw new ParseException("Column " + name + " does not exist");
currentSchema = fs.schema;
if (fs.type != ColumnType.RECORD && fs.type != ColumnType.COLLECTION)
throw new ParseException(name
+ " is not of type RECORD or COLLECTION");
currentName = currentName.substring(fieldIndex + 1);
if (currentName.length() == 0)
throw new ParseException("Column " + name
+ " does not have field after the record field separator '.'");
offset += fieldIndex + 1;
ct = fs.type;
}
fieldIndex = currentName.indexOf('.');