Repository navigation
Report no columns for Thrift statements without output - #651
Open
vuanhphung wants to merge 2 commits into
Open
vuanhphung wants to merge 2 commits into
vuanhphung wants to merge 2 commits into
Conversation
For DDL the Thrift server sends a placeholder `Result STRING` column, which can't be told apart from `SELECT 'x' AS Result WHERE 1 = 0`. The Arrow schema in the same response has no fields, so getSchema() and getResultMetadata() now report no columns, matching the kernel backend. getMetadata() still returns the wire response. Without Arrow results the wire is identical and the placeholder is kept. Fixes #309 Co-authored-by: Isaac <no-reply@databricks.com> Signed-off-by: Vu Anh Phung <vu.phung@databricks.com>
Decode the Arrow schema once per operation and hand the normalized metadata to the result handlers, so DDL results skip FetchResults. getSchema() goes through an optional IOperationBackend.getSchema() instead of an instanceof check and still works without resultFormat. Tolerate Thrift schemas missing required fields, close operations and the session even when e2e assertions fail, and add a changelog entry. Co-authored-by: Isaac <no-reply@databricks.com> Signed-off-by: Vu Anh Phung <vu.phung@databricks.com>
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #309. For DDL such as
CREATE TABLE, the Thrift server returns a placeholder schema (oneResult STRINGcolumn) withhasResultSet: trueand no rows, which is indistinguishable fromSELECT 'sample' AS Result WHERE 1 = 0. The Arrow schema in the same response has no fields, sogetSchema()andgetResultMetadata()now report no columns in that case. This matches the kernel backend, which already returns an empty schema for DDL. The deprecatedgetMetadata()still returns the wire response.No API signature changes. On Thrift,
getSchema()for DDL now returns{ columns: [] }instead of the placeholder. WitharrowEnabled: falsethe two responses are identical on the wire, so the placeholder is kept.Verified on a live warehouse: the new
tests/e2e/ddl_schema.test.tspasses on Thrift and kernel, and its Thrift case fails without this change.execute()decides by regex (DatabricksStatement.shouldReturnResultSet); the server'shasResultSetis unuseddescriptionis[]for DDL; Thrift shows theResultplaceholder with Arrow on or off (verified live on 4.9.0)RowsAffectedis 0 for both;Exec/Queryis the caller's choiceNo driver exposes a statement type and neither Thrift nor SEA carries one, so this PR doesn't add one.
This pull request and its description were written by Isaac.
This PR was created with GitHub MCP.