{"record":{"id":"896d501a3f9747c7","repo":"alibaba/DataX","slug":"coltype-or-colname-is-null-coltype-coltype","errorCode":null,"errorMessage":"ColType or colName is null, colType : ${colType} , colName : ${colName}","messagePattern":"ColType or colName is null, colType : (.+?) , colName : (.+?)","errorType":"exception","errorClass":"SQLException","httpStatus":null,"severity":"error","filePath":"hbase11xsqlwriter/src/main/java/com/alibaba/datax/plugin/writer/hbase11xsqlwriter/HbaseSQLHelper.java","lineNumber":222,"sourceCode":"     */\n    public static Map<String, ThinClientPTable.ThinClientPColumn>  parseColType(ResultSet rs) throws SQLException {\n        Map<String, ThinClientPTable.ThinClientPColumn> cols = new HashMap<String, ThinClientPTable\n            .ThinClientPColumn>();\n        ResultSetMetaData md = rs.getMetaData();\n        int columnCount = md.getColumnCount();\n\n        while (rs.next()) {\n            String colName  = null;\n            PDataType colType = null;\n            for (int i = 1; i <= columnCount; i++) {\n                if (md.getColumnLabel(i).equals(\"TYPE_NAME\")) {\n                    colType = PDataType.fromSqlTypeName((String) rs.getObject(i));\n                } else if (md.getColumnLabel(i).equals(\"COLUMN_NAME\")) {\n                    colName = (String) rs.getObject(i);\n                }\n            }\n            if (colType == null || colName == null) {\n                throw new SQLException(\"ColType or colName is null, colType : \" + colType + \" , colName : \" + colName);\n            }\n            cols.put(colName, new ThinClientPTable.ThinClientPColumn(colName, colType));\n        }\n        return cols;\n    }\n\n\n    /**\n     * 清空表\n     */\n    public static void truncateTable(Connection conn, String tableName) {\n        PhoenixConnection sqlConn = null;\n        Admin admin = null;\n        try {\n            sqlConn = conn.unwrap(PhoenixConnection.class);\n            admin = sqlConn.getQueryServices().getAdmin();\n            TableName hTableName = TableName.valueOf(tableName);\n            // 确保表存在、可用","sourceCodeStart":204,"sourceCodeEnd":240,"githubUrl":"https://github.com/alibaba/DataX/blob/80ec23d5c5328eb90ca364d2749e92dfaf44541e/hbase11xsqlwriter/src/main/java/com/alibaba/datax/plugin/writer/hbase11xsqlwriter/HbaseSQLHelper.java#L204-L240","documentation":"SQLException from HbaseSQLHelper metadata parsing (getColumnInfo): while iterating the result set of a table-metadata query, a row completed without both a TYPE_NAME and a COLUMN_NAME column value. Either the metadata query returned unexpected columns, or PDataType.fromSqlTypeName got a type name it cannot map (leaving colType null).","triggerScenarios":"Thin-client metadata query (e.g. DatabaseMetaData.getColumns or the Phoenix system catalog query) whose ResultSet lacks columns labeled exactly 'TYPE_NAME'/'COLUMN_NAME', or a TYPE_NAME value unknown to the bundled PDataType enum — typically after upgrading the Phoenix server to a version whose type names postdate the writer's client jar.","commonSituations":"Version mismatch between the phoenix thin-client jar in the plugin and the Phoenix/HBase server; non-default column types added in newer Phoenix releases; querying tables with odd namespace casing that break label matching.","solutions":["Pin the phoenix thin-client jar in the plugin to the exact version of the Phoenix server.","Inspect what the metadata query returns (log the ResultSet labels/values) to see which of colName/colType stays null.","If an exotic data type is the cause, cast or drop that column in the job config and re-run."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// log metadata labels once to validate assumptions\nResultSetMetaData md = rs.getMetaData();\nfor (int i = 1; i <= md.getColumnCount(); i++) LOG.debug(\"meta col {} = {}\", i, md.getColumnLabel(i));","typeGuard":null,"tryCatchPattern":"try {\n    cols = HbaseSQLHelper.getColumnInfo(conn, tableName);\n} catch (SQLException e) {\n    // check phoenix client/server version match before retrying\n}","preventionTips":["Pin the exact Phoenix client version to the server version in the plugin.","Test metadata reads against the real server version in CI, not just local H2/derby."],"tags":["phoenix","hbase","datax","metadata","version-mismatch"],"backgroundTag":null,"analyzedSha":"80ec23d5c5328eb90ca364d2749e92dfaf44541e","analyzedAt":"2026-08-14T15:33:51.187Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}