use of io.confluent.ksql.rest.entity.FieldInfo.FieldType in project ksql by confluentinc.
the class Console method formatFieldType.
private static String formatFieldType(final FieldInfo field, final Optional<WindowType> windowType, final boolean isTable) {
final FieldType possibleFieldType = field.getType().orElse(null);
if (possibleFieldType == FieldType.HEADER) {
final String headerType = field.getHeaderKey().map(k -> "(header('" + k + "'))").orElse("(headers)");
return String.format("%-16s %s", field.getSchema().toTypeString(), headerType);
}
if (possibleFieldType == FieldType.KEY) {
final String wt = windowType.map(v -> " (Window type: " + v + ")").orElse("");
final String keyType = isTable ? "(primary key)" : "(key)";
return String.format("%-16s %s%s", field.getSchema().toTypeString(), keyType, wt);
}
return field.getSchema().toTypeString();
}
Aggregations