public static String toSql(FieldType type) { switch (type) { case INTEGER: return "INT"; case DECIMAL: return "DECIMAL"; case LONG: return "BIGINT"; case STRING: return "VARCHAR"; case BINARY: return "VARBINARY"; case BOOLEAN: case DATE: case TIME: case TIMESTAMP: return type.name(); case DOUBLE: return "DOUBLE"; default: if (type.isArray()) { return "ARRAY<" + toSql(type.getArrayElementType()) + ">"; } if (type.isMap()) { return "MAP<VARCHAR, " + toSql(type.getMapValueType()) + ">"; } throw new IllegalStateException("sql type couldn't converted to fieldtype"); } }
return f; }) .map(f -> format("\"%s\" %s", f.getName(), toSql(f.getType()))) .collect(Collectors.joining(", ")); if (queryEnd.isEmpty()) { .map(f -> format("ALTER TABLE %s.\"%s\".\"%s\" ADD COLUMN \"%s\" %s", config.getColdStorageConnector(), project, collection, f.getName(), toSql(f.getType()))) .forEach(q -> { try {