class SchemaUtil {

  public static String getSqlTypeName(Schema schema) {
    switch (schema.type()) {
      case INT32:
        return "INT";
      case INT64:
        return "BIGINT";
      case FLOAT32:
      case FLOAT64:
        return "DOUBLE";
      case BOOLEAN:
        return "BOOLEAN";
      case STRING:
        return "VARCHAR";
      case ARRAY:
        return "ARRAY<" + getSqlTypeName(schema.valueSchema()) + ">";
      case MAP:
        return "MAP<"
               + getSqlTypeName(schema.keySchema())
               + ","
               + getSqlTypeName(schema.valueSchema())
               + ">";
      default:
        throw new KsqlException(String.format("Invalid type in schema: %s.", schema.toString()));
    }
  }

}