apache / apache/iceberg-python

Add `CAST` to `parser.py`

オープン
#198 コメント 7 件 リアクション 0 件 担当者 0 名 GitHub で見る
stale
主要言語
Python
スター
1.1k
フォーク
581
平均マージ
1日 17時間
マージ済み PR(30日)
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 クラスと parse actions を追跡し、その後、パースされた式が scan に到達するまでの流れと、文字列が IcebergType 値になる仕組みを追います。CAST 構文がパースされ、その対象型が scan に伝播されれば完了です。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
python
領域
databases
issue の種類
機能追加
難易度
4/5
見積もり時間
3〜5日
活発さ
活発
明瞭さ
おおむね明確
初心者へのやさしさ
45/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。