Source:
public RelDataType toType(RelDataTypeFactory typeFactory, Object o) { if (o instanceof List) { @SuppressWarnings("unchecked") final List<Map<String, Object>> jsonList = (List<Map<String, Object>>) o; final RelDataTypeFactory.Builder builder = typeFactory.builder(); for (Map<String, Object> jsonMap : jsonList) { builder.add((String) jsonMap.get("name"), toType(typeFactory, jsonMap)); } return builder.build(); } else if (o instanceof Map) { @SuppressWarnings("unchecked") final Map<String, Object> map = (Map<String, Object>) o; final Object fields = map.get("fields"); if (fields != null) { return toType(typeFactory, fields); } else { final SqlTypeName sqlTypeName = Util.enumVal(SqlTypeName.class, (String) map.get("type")); final Integer precision = (Integer) map.get("precision"); final Integer scale = (Integer) map.get("scale"); if (SqlTypeName.INTERVAL_TYPES.contains(sqlTypeName)) { TimeUnit startUnit = sqlTypeName.getEndUnit(); TimeUnit endUnit = sqlTypeName.getEndUnit(); return typeFactory.createSqlIntervalType( new SqlIntervalQualifier(startUnit, endUnit, SqlParserPos.ZERO)); } final RelDataType type; if (precision == null) { type = typeFactory.createSqlType(sqlTypeName); } else if (scale == null) { type = typeFactory.createSqlType(sqlTypeName, precision); } else { type = typeFactory.createSqlType(sqlTypeName, precision, scale); } final boolean nullable = (Boolean) map.get("nullable"); return typeFactory.createTypeWithNullability(type, nullable); } } else { final SqlTypeName sqlTypeName = Util.enumVal(SqlTypeName.class, (String) o); return typeFactory.createSqlType(sqlTypeName); } }

Target:
public RelDataType toType(RelDataTypeFactory typeFactory, Object o) { if (o instanceof List) { @SuppressWarnings("unchecked") final List<Map<String, Object>> jsonList = (List<Map<String, Object>>) o; final RelDataTypeFactory.Builder builder = typeFactory.builder(); for (Map<String, Object> jsonMap : jsonList) { builder.add((String) jsonMap.get("name"), toType(typeFactory, jsonMap)); } return builder.build(); } else if (o instanceof Map) { @SuppressWarnings("unchecked") final Map<String, Object> map = (Map<String, Object>) o; final Object fields = map.get("fields"); if (fields != null) { return toType(typeFactory, fields); } else { final SqlTypeName sqlTypeName = Util.enumVal(SqlTypeName.class, (String) map.get("type")); final Integer precision = (Integer) map.get("precision"); final Integer scale = (Integer) map.get("scale"); if (SqlTypeName.INTERVAL_TYPES.contains(sqlTypeName)) { TimeUnit startUnit = sqlTypeName.getStartUnit(); TimeUnit endUnit = sqlTypeName.getEndUnit(); return typeFactory.createSqlIntervalType( new SqlIntervalQualifier(startUnit, endUnit, SqlParserPos.ZERO)); } final RelDataType type; if (precision == null) { type = typeFactory.createSqlType(sqlTypeName); } else if (scale == null) { type = typeFactory.createSqlType(sqlTypeName, precision); } else { type = typeFactory.createSqlType(sqlTypeName, precision, scale); } final boolean nullable = (Boolean) map.get("nullable"); return typeFactory.createTypeWithNullability(type, nullable); } } else { final SqlTypeName sqlTypeName = Util.enumVal(SqlTypeName.class, (String) o); return typeFactory.createSqlType(sqlTypeName); } }