DDL Statement vs Select statement identical results
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 35/100
- Issue type
- Feature
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- sql, typescript
- Domain
- backend-api-design, databases
Research direction
Start with the DBSQLClient session.executeStatement flow and the query.fetchChunk(), query.hasMoreRows(), and query.metadata.schema APIs shown in the report. Compare how the CREATE TABLE and empty SELECT operations are exposed, then determine whether metadata can distinguish them or whether a result-row change is appropriate. Done means callers can reliably identify the operation without parsing SQL.
Written by the indexing model from the issue text.
Description
Hello,
After testing, it appears that the results of the following 2 queries are indistinguishable when looking at the result sets:
CREATE TABLE example (
col1 INT
);
and
SELECT 'sample' as Result
WHERE 1 = 0;
This is because when iterating over the rows, both return 0 rows:
import { DBSQLClient } from '@databricks/sql';
const connectionOptions = {...};
let results = [];
const client = new DBSQLClient();
const session = await client.connect(connectOptions);
const query = await session.executeStatement(query, options);
do {
results = results.concat(await query.fetchChunk());
} while (await query.hasMoreRows());
console.log(results);
And the schema is exactly the same:
... code above
console.log(query.metadata.schema)
Do you have any advice for differentiating the operations without requiring in a SQL parser to determine the query? Would it be possible to add the operation type to the query.metadata, or a result row for DDL operations?
- Dominant language
- TypeScript
- Stars
- 36
- Forks
- 50
- Avg merge
- 13h 46m
- Merged PRs (30d)
- 9
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from databricks/databricks-sql-nodejs
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
-
engineer-bot
Difficulty 2/5 1-3 hours Newbie friendliness 64/100
databricks/databricks-sql-nodejs#274 · 1 comment · 1 reaction ·
-
Difficulty 3/5 1-2 days Newbie friendliness 68/100
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
-
Difficulty 4/5 3-5 days Newbie friendliness 48/100