alibaba/DataX · error · SQLException
ColType or colName is null, colType : ${colType} , colName :
Error message
ColType or colName is null, colType : ${colType} , colName : ${colName} What it means
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).
Source
Thrown at hbase11xsqlwriter/src/main/java/com/alibaba/datax/plugin/writer/hbase11xsqlwriter/HbaseSQLHelper.java:222
*/
public static Map<String, ThinClientPTable.ThinClientPColumn> parseColType(ResultSet rs) throws SQLException {
Map<String, ThinClientPTable.ThinClientPColumn> cols = new HashMap<String, ThinClientPTable
.ThinClientPColumn>();
ResultSetMetaData md = rs.getMetaData();
int columnCount = md.getColumnCount();
while (rs.next()) {
String colName = null;
PDataType colType = null;
for (int i = 1; i <= columnCount; i++) {
if (md.getColumnLabel(i).equals("TYPE_NAME")) {
colType = PDataType.fromSqlTypeName((String) rs.getObject(i));
} else if (md.getColumnLabel(i).equals("COLUMN_NAME")) {
colName = (String) rs.getObject(i);
}
}
if (colType == null || colName == null) {
throw new SQLException("ColType or colName is null, colType : " + colType + " , colName : " + colName);
}
cols.put(colName, new ThinClientPTable.ThinClientPColumn(colName, colType));
}
return cols;
}
/**
* 清空表
*/
public static void truncateTable(Connection conn, String tableName) {
PhoenixConnection sqlConn = null;
Admin admin = null;
try {
sqlConn = conn.unwrap(PhoenixConnection.class);
admin = sqlConn.getQueryServices().getAdmin();
TableName hTableName = TableName.valueOf(tableName);
// 确保表存在、可用View on GitHub (pinned to 80ec23d5c5)
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.
Defensive patterns
Strategy: validation
Validate before calling
// log metadata labels once to validate assumptions
ResultSetMetaData md = rs.getMetaData();
for (int i = 1; i <= md.getColumnCount(); i++) LOG.debug("meta col {} = {}", i, md.getColumnLabel(i)); Try / catch
try {
cols = HbaseSQLHelper.getColumnInfo(conn, tableName);
} catch (SQLException e) {
// check phoenix client/server version match before retrying
} Prevention
- 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.
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- faild load org.apache.phoenix.jdbc.PhoenixDriver
- Col {} not found
- CONFIG_ERROR
- JDBC Type: {sqlType}
- -405
AI-assisted analysis of alibaba/DataX@80ec23d5c5 (2026-08-14).
Data as JSON: /api/errors/896d501a3f9747c7.
Report an issue: GitHub.