apache / apache/iceberg-python

Add `CAST` to `parser.py`

未关闭
#198 7 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
stale
主要语言
Python
星标
1.1k
派生
581
平均合并
1 天 17 小时
30 天内合并 PR
78

描述

### Feature Request / Improvement

I think I have somewhat of an idea on how to do this, so far have added the following to `parser.py`:

```py
CAST = CaselessKeyword("cast")
cast_expression = (CAST + "(" + column + "as" + identifier + Suppress(")")).set_results_name("cast")

# would need something special for the set_parse_action
```

I am wondering a couple of things:
Do we need a new class `CastableReference` or something? Worth expanding on the `Reference` class? And once that is done, how would we propagate the new type (Im assuming we need some way to go from a string to an `IcebergType` of the string the user has put into the cast operation) into the scan?

This was spawned from https://github.com/apache/iceberg-python/issues/170

Happy to work on this, just would be awesome to get some context

贡献指南

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

调研方向

从 parser.py 和 issue 170 中的上下文开始。跟踪现有的 Reference 类和解析操作,然后继续跟踪已解析的表达式如何到达 scan,以及字符串如何变成 IcebergType 值。完成的标准是 CAST 语法能够被解析,并且其目标类型能够传播到 scan。

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

评估

技术栈
python
领域
databases
Issue 类型
功能
难度
4/5
预计耗时
3-5 天
活跃度
活跃
描述清晰度
基本清楚
新手友好度
45/100

把新 issue 发到你的邮箱

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