apache / apache/datafusion-sqlparser-rs

Make `CreateTable.location` / `AlterTable.location` make more sense

未关闭
#1,518 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
主要语言
Rust
星标
3.5k
派生
772
平均合并
4 天 9 小时
30 天内合并 PR
17

描述

`CreateTable.location` has no documentation and is a tricky edge case, not always set even when SQL statement did set location.

https://docs.rs/sqlparser/latest/sqlparser/ast/struct.CreateTable.html#structfield.location

Since this took some time to figure out, here's what I've found for others also pondering its role:

- `CREATE EXTERNAL TABLE .. LOCATION 'foo'` sets `CreateTable.location`
- `CREATE TABLE .. LOCATION 'foo'` sets `CreateTable.hive_formats.location`
- `ALTER TABLE .. LOCATION` sets `AlterTable.location`
- `AlterTable.location` types are about Hive, and is thus a bit confusing for external tables: https://docs.rs/sqlparser/latest/sqlparser/ast/enum.Statement.html#variant.AlterTable.field.location
- alter vs create behaviors thus do not match

Maybe make Hive syntax use the top-level `location` field?

贡献指南

这个仓库没有索引到贡献指南

调研方向

先查看 docs.rs 中对 CreateTable.location、CreateTable.hive_formats.location 和 AlterTable.location 的定义,然后跟踪 issue 中列出的 CREATE EXTERNAL TABLE、CREATE TABLE 和 ALTER TABLE LOCATION 形式的 parser 行为。当 location 的语义变得一致或得到明确记录,并且这些情况具有回归测试覆盖时,即视为完成。

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

评估

技术栈
rust, sql
领域
compilers, databases
Issue 类型
重构
难度
5/5
预计耗时
一周以上
活跃度
停滞
描述清晰度
基本清楚
新手友好度
30/100

把新 issue 发到你的邮箱

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