apache / apache/iceberg-python

Add `CAST` to `parser.py`

已關閉
#198 7 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視
stale
主要語言
Python
星號
1.1k
分支
581
平均合併
1 天 13 小時
30 天內合併 PR
76

描述

### 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 摘要。