use of org.apache.asterix.lang.common.expression.TypeExpression in project asterixdb by apache.
the class QueryPrintVisitor method visit.
@Override
public Void visit(RecordTypeDefinition r, Integer step) throws CompilationException {
if (r.getRecordKind() == RecordKind.CLOSED) {
out.print(skip(step) + "closed ");
} else {
out.print(skip(step) + "open ");
}
out.println("RecordType {");
Iterator<String> nameIter = r.getFieldNames().iterator();
Iterator<TypeExpression> typeIter = r.getFieldTypes().iterator();
Iterator<Boolean> isOptionalIter = r.getOptionableFields().iterator();
boolean first = true;
while (nameIter.hasNext()) {
if (first) {
first = false;
} else {
out.println(",");
}
String name = nameIter.next();
TypeExpression texp = typeIter.next();
Boolean isNullable = isOptionalIter.next();
out.print(skip(step + 1) + name + " : ");
texp.accept(this, step + 2);
if (isNullable) {
out.print("?");
}
}
out.println();
out.println(skip(step) + "}");
return null;
}
Aggregations