{"record":{"id":"92e41e0b1bcd88cd","repo":"apache/seatunnel","slug":"custom-sql-execution-interrupted","errorCode":null,"errorMessage":"Custom SQL execution interrupted","messagePattern":"Custom SQL execution interrupted","errorType":"exception","errorClass":"CatalogException","httpStatus":null,"severity":"warning","filePath":"seatunnel-connectors-v2/connector-bigquery/src/main/java/org/apache/seatunnel/connectors/bigquery/catalog/BigQueryCatalog.java","lineNumber":415,"sourceCode":"            TableId tableId = TableId.of(getDatasetName(tablePath), tablePath.getTableName());\n            Table table = bigquery.getTable(tableId);\n            return table != null && table.getNumRows().longValue() > 0;\n        }\n    }\n\n    @Override\n    public void executeSql(TablePath tablePath, String sql) {\n        if (sql == null || sql.trim().isEmpty()) {\n            log.warn(\"No custom SQL query provided for table {}, skipping execution.\", tablePath);\n            return;\n        }\n        log.info(\"Executing custom SQL in dataset {}: {}\", getDatasetName(tablePath), sql);\n        QueryJobConfiguration queryConfig = QueryJobConfiguration.newBuilder(sql).build();\n        try {\n            bigquery.query(queryConfig);\n        } catch (InterruptedException e) {\n            Thread.currentThread().interrupt();\n            throw new CatalogException(\"Custom SQL execution interrupted\", e);\n        } catch (Exception e) {\n            throw new CatalogException(\"Failed to execute custom SQL\", e);\n        }\n    }\n\n    private Field convertColumn(Column column) {\n        StandardSQLTypeName bqType = mapToBigQueryType(column.getDataType().getSqlType());\n        Field.Builder fieldBuilder = Field.newBuilder(column.getName(), bqType);\n\n        if (column.isNullable()) {\n            fieldBuilder.setMode(Field.Mode.NULLABLE);\n        } else {\n            fieldBuilder.setMode(Field.Mode.REQUIRED);\n        }\n\n        if (column.getDataType().getSqlType() == SqlType.ROW) {\n            SeaTunnelRowType rowType = (SeaTunnelRowType) column.getDataType();\n            List<Field> subFields = new ArrayList<>();","sourceCodeStart":397,"sourceCodeEnd":433,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-connectors-v2/connector-bigquery/src/main/java/org/apache/seatunnel/connectors/bigquery/catalog/BigQueryCatalog.java#L397-L433","documentation":"Thrown by BigQueryCatalog.executeSql when bigquery.query(queryConfig) throws InterruptedException while executing a user-supplied custom SQL statement. The interrupt flag is restored and the interruption is wrapped in a CatalogException. It indicates the custom SQL job was cancelled because the calling thread was interrupted, not a SQL syntax or data problem.","triggerScenarios":"Calling executeSql(tablePath, sql) when the thread waiting on the synchronous BigQuery query job is interrupted — e.g. SeaTunnel job cancellation, engine shutdown, or a watchdog interrupt during schema-save-mode SQL execution.","commonSituations":"Job stopped by the user while a save-mode auto-create/DDL SQL ran; Zeta worker task termination; pipeline failover interrupting catalog calls.","solutions":["Determine whether the interrupt was intentional (job cancel) — if so, handle at the orchestration level","Re-run the SQL after confirming job state; the statement may have partially executed, so verify results in BigQuery","Move long-running SQL to an async pattern if interruption-prone threads must issue it"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n    catalog.executeSql(tablePath, sql);\n} catch (CatalogException e) {\n    if (Thread.interrupted()) {\n        LOG.warn(\"Custom SQL cancelled by interruption\");\n        return;\n    }\n    throw e;\n}","preventionTips":["Keep custom SQL short-running to reduce the interruption window","Check whether the interrupt stems from intentional job cancellation","Restore interrupt status before rethrowing","Verify SQL results in BigQuery after an interruption since execution state is uncertain"],"tags":["bigquery","interrupt","custom-sql","thread-interrupted"],"backgroundTag":"request-timeout","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"}