Submit Spark SQL queries that write results to Iceberg tables.
submitSparkSql(options)
Submit a Spark SQL query that writes its result to an Iceberg output table. Returns run info immediately; use getRun() or submitSparkSqlAndWait() to poll status.
const submitted = await client.submitSparkSql({ namespace: "my-namespace", name: "nightly-agg", query: "SELECT day, count(*) AS n FROM oleander.default.events GROUP BY day", outputTable: "default.daily_counts",});console.log(submitted.run_id, submitted.state); // "..." SUBMITTED
Submit a Spark SQL query and poll until the run reaches a terminal state (COMPLETE, FAIL, or ABORT). Throws an error if the timeout is exceeded.
const { runId, state, run } = await client.submitSparkSqlAndWait({ namespace: "my-namespace", name: "nightly-agg", query: "SELECT day, count(*) AS n FROM oleander.default.events GROUP BY day", outputTable: "default.daily_counts", writeMode: "APPEND",});if (state !== "COMPLETE") { throw new Error(`Run ${runId} ended with state: ${state}`);}
Accepts all submitSparkSql options plus:
number
default:"10000"
Milliseconds between status polls.
number
default:"600000"
Maximum time to wait in milliseconds before throwing a timeout error.