DDL Statement vs Select statement identical results

未关闭
#309 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
35/100
Issue 类型
功能
描述清晰度
基本清楚
活跃度
停滞
技术栈
sql, typescript

调研方向

从报告中展示的 DBSQLClient session.executeStatement 流程以及 query.fetchChunk()、query.hasMoreRows() 和 query.metadata.schema API 入手。比较 CREATE TABLE 和空 SELECT 操作的暴露方式,然后确定元数据是否能够区分它们,或者是否适合更改结果行。完成的标准是调用方无需解析 SQL 即可可靠地识别该操作。

由索引模型根据 Issue 内容生成。

描述

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?

主要语言
TypeScript
星标
36
派生
50
平均合并
13 小时 46 分钟
30 天内合并 PR
9

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

databricks/databricks-sql-nodejs 的其他 Issue

查看 databricks/databricks-sql-nodejs 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。