apache/beam · error · RuntimeException

Unable run pipeline with CREATE IF NEEDED - no response.

Error message

Unable run pipeline with CREATE IF NEEDED - no response.

What it means

checkResultIfTableExists expects the SHOW TABLES-style result set for the CREATE IF NEEDED disposition to return at least one row; an empty result set means the table-existence probe produced no answer, so Beam aborts rather than guessing. Unlike an empty-rowset meaning 'table missing', here the overall query yielded nothing interpretable.

Solutions

  1. Check your custom StatementExecutionSupplier/implementation is returning the raw result set of the existence query, not a pre-consumed or empty one.
  2. Verify database and schema names in the config are correct and exist.
  3. Update the Snowflake JDBC driver; some versions changed SHOW result-set behavior.
  4. Use a simpler existence probe manually (SELECT 1 FROM information_schema.tables WHERE ...) to compare behavior.

Example fix

// before: supplier returns empty ResultSet
result -> statement.executeQuery("SHOW OBJECTS IN missing_db.public")
// after: ensure target exists
result -> statement.executeQuery("SHOW OBJECTS IN mydb.public")
Defensive patterns

Strategy: validation

Validate before calling

// Validate your StatementExecutionSupplier returns the raw result set
// ResultSet rs = supplier.apply(statement); assert rs.getMetaData().getColumnCount() > 0;

Prevention

When it happens

Trigger: Running createTableIfNotExists (CREATE_IF_NEEDED disposition) when the existence-check statement returns a result set with no rows at all — resultSet.next() is false on the first call.

Common situations: Custom SnowflakeServiceConfig / StatementExecutionSupplier returning malformed or empty results; driver returning an unexpected result shape for the SHOW-object query; misconfigured database/schema so the probe targets a non-existent container and the driver swallows errors into an empty result.

Understand the failure class

Background: EmptyResultError / "no results found": when an API or scraper succeeds but returns zero rows — this error's family across 9 libraries.

Related errors


AI-assisted analysis of apache/beam@12126d8942 (2026-09-13). Data as JSON: /api/errors/cbea44084d5b9604. Report an issue: GitHub.

Appendix: source

Thrown at sdks/java/io/snowflake/src/main/java/org/apache/beam/sdk/io/snowflake/services/SnowflakeBatchServiceImpl.java:259

        query,
        resultSet -> {
          assert resultSet != null;
          if (!checkResultIfTableExists(resultSet)) {
            try {
              createTable(dataSource, table, tableSchema);
            } catch (SQLException e) {
              throw new RuntimeException("Unable to create table.", e);
            }
          }
        });
  }

  private static boolean checkResultIfTableExists(ResultSet resultSet) {
    try {
      if (resultSet.next()) {
        return checkIfResultIsTrue(resultSet);
      } else {
        throw new RuntimeException("Unable run pipeline with CREATE IF NEEDED - no response.");
      }
    } catch (SQLException e) {
      throw new RuntimeException("Unable run pipeline with CREATE IF NEEDED disposition.", e);
    }
  }

  private void createTable(DataSource dataSource, String table, SnowflakeTableSchema tableSchema)
      throws SQLException {
    checkArgument(
        tableSchema != null,
        "The CREATE_IF_NEEDED disposition requires schema if table doesn't exists");
    String query = String.format("CREATE TABLE %s (%s);", table, tableSchema.sql());
    runConnectionWithStatement(dataSource, query, null);
  }

  private static boolean checkIfResultIsTrue(ResultSet resultSet) throws SQLException {
    int columnId = 1;
    return resultSet.getBoolean(columnId);

View on GitHub (pinned to 12126d8942)