morningman commented on code in PR #44160: URL: https://github.com/apache/doris/pull/44160#discussion_r1856802050
########## fe/fe-core/src/main/java/org/apache/doris/datasource/jdbc/client/JdbcPostgreSQLClient.java: ########## @@ -99,8 +151,43 @@ protected Type jdbcTypeToDoris(JdbcFieldSchema fieldSchema) { case "json": case "jsonb": return ScalarType.createStringType(); - default: - return Type.UNSUPPORTED; + default: { + if (fieldSchema.getDataType() == Types.ARRAY && pgType.startsWith("_")) { + return convertArrayType(fieldSchema); + } else { + return Type.UNSUPPORTED; + } + } + } + } + + private Type convertArrayType(JdbcFieldSchema fieldSchema) { + int arrayDimensions = fieldSchema.getArrayDimensions().orElse(0); + if (arrayDimensions == 0) { + return Type.UNSUPPORTED; + } + + String innerType = fieldSchema.getDataTypeName().orElse("unknown").substring(1); + String[] supportedInnerType = new String[] { Review Comment: Make it is static final field ########## fe/be-java-extensions/jdbc-scanner/src/main/java/org/apache/doris/jdbc/PostgreSQLJdbcExecutor.java: ########## @@ -122,4 +136,29 @@ private static String pgByteArrayToHexString(byte[] bytes) { } return hexString.toString(); } + + private String handleNestedArray(Object array) { + if (array == null) { + return null; + } + StringBuilder sb = new StringBuilder(); + sb.append("["); + int length = java.lang.reflect.Array.getLength(array); + for (int i = 0; i < length; i++) { + Object element = java.lang.reflect.Array.get(array, i); + if (element != null && element.getClass().isArray()) { + sb.append(handleNestedArray(element)); + } else if (element instanceof byte[]) { + sb.append(pgByteArrayToHexString((byte[]) element)); + } else { + String elementStr = element != null ? element.toString().trim() : "null"; Review Comment: Why use `trim()`? -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org