{"record":{"id":"2c8c43f21446ee7b","repo":"apache/seatunnel","slug":"failed-getting-table-s-2c8c43","errorCode":null,"errorMessage":"Failed getting table %s","messagePattern":"Failed getting table (.+?)","errorType":"exception","errorClass":"CatalogException","httpStatus":null,"severity":"error","filePath":"seatunnel-connectors-v2/connector-jdbc/src/main/java/org/apache/seatunnel/connectors/seatunnel/jdbc/catalog/saphana/SapHanaCatalog.java","lineNumber":261,"sourceCode":"                TableSchema.Builder builder = TableSchema.builder();\n                buildColumnsWithErrorCheck(tablePath, resultSet, builder);\n                // add primary key\n                primaryKey.ifPresent(builder::primaryKey);\n                // add constraint key\n                constraintKeys.forEach(builder::constraintKey);\n                TableIdentifier tableIdentifier = getTableIdentifier(originalTablePath);\n                return CatalogTable.of(\n                        tableIdentifier,\n                        builder.build(),\n                        buildConnectorOptions(tablePath),\n                        Collections.emptyList(),\n                        \"\",\n                        catalogName);\n            }\n        } catch (SeaTunnelRuntimeException e) {\n            throw e;\n        } catch (Exception e) {\n            throw new CatalogException(\n                    String.format(\"Failed getting table %s\", tablePath.getFullName()), e);\n        }\n    }\n\n    @Override\n    protected Column buildColumn(ResultSet resultSet) throws SQLException {\n        String columnName = resultSet.getString(\"COLUMN_NAME\");\n        String typeName = resultSet.getString(\"DATA_TYPE_NAME\");\n        Long columnLength = resultSet.getLong(\"LENGTH\");\n        Integer columnScale = resultSet.getObject(\"SCALE\", Integer.class);\n        String fullTypeName = appendColumnSizeIfNeed(typeName, columnLength, columnScale);\n        String columnComment = resultSet.getString(\"COMMENTS\");\n        Object defaultValue = resultSet.getObject(\"DEFAULT_VALUE\");\n        boolean isNullable = resultSet.getString(\"IS_NULLABLE\").equals(\"TRUE\");\n\n        if (typeName.equalsIgnoreCase(\"ARRAY\")) {\n            fullTypeName =\n                    appendColumnSizeIfNeed(","sourceCodeStart":243,"sourceCodeEnd":279,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-connectors-v2/connector-jdbc/src/main/java/org/apache/seatunnel/connectors/seatunnel/jdbc/catalog/saphana/SapHanaCatalog.java#L243-L279","documentation":"Generic wrapper in SapHanaCatalog.getTable(): after the synonym resolution step, any Exception raised while reading metadata (primary keys, constraint keys, columns) and building the CatalogTable is rethrown as CatalogException 'Failed getting table <fullName>'. SeaTunnelRuntimeException is rethrown unchanged. This error means metadata extraction for an existing table failed — the table exists but its schema could not be read.","triggerScenarios":"getPrimaryKey, getConstraintKeys, or the columns query throws (SQL error, unsupported column type in buildColumn, connection dropped), or CatalogTable construction fails after the table was confirmed to exist.","commonSituations":"Table contains a data type the converter cannot map (falls into buildColumn errors); the querying user lacks metadata privileges on the schema; JDBC driver returns unexpected metadata for HANA-specific types; connection timeout during metadata reads.","solutions":["Inspect the cause chain — the wrapped SQLException/RuntimeException names the failing metadata call or column.","Check user privileges on the target schema for metadata queries (TABLES, COLUMNS, constraints views).","Look for HANA-specific column types that the JdbcColumnConverter cannot map and cast or alter them.","Retry in case of transient connection failures, or increase connection/metadata timeout settings."],"exampleFix":"// before\nCatalogTable t = catalog.getTable(TablePath.of(\"MYDB\", \"ORDERS\"));\n// after\ntry {\n    CatalogTable t = catalog.getTable(TablePath.of(\"MYDB\", \"ORDERS\"));\n} catch (CatalogException e) {\n    LOG.error(\"metadata read failed for ORDERS\", e.getCause());\n    throw e;\n}","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"// java\ntry {\n    CatalogTable t = catalog.getTable(tablePath);\n} catch (CatalogException e) {\n    Throwable c = e.getCause();\n    LOG.error(\"failed reading metadata for {}: {}\", tablePath.getFullName(), c.getMessage());\n    throw e;\n}","preventionTips":["Check metadata privileges for the connecting user on the target schema.","Avoid column types the JDBC converter cannot map (e.g. HANA-specific/UDT columns).","Watch for transient connection drops during multi-query metadata reads; use connection timeouts."],"tags":["sap-hana","catalog","metadata","jdbc"],"backgroundTag":"database-query-failed","analyzedSha":"cf67b549a7a6c35fa0beb12d83c62892427ea919","analyzedAt":"2026-09-10T21:44:55.265Z","contentChangedAt":"2026-09-10T21:44:55.265Z","schemaVersion":2},"datasetVersion":"2026-09-14T11:17:12.474Z"}