![](/img/trans.png)
[英]How to pass Runtime query to SqlTransform in apache beam?
[英]How is pipe syntax implemented in apache beam?
我現在正在研究apache beam
,出於好奇,我想問以下問題。
事先,我已閱讀以下文檔和線程。
https://beam.apache.org/documentation/programming-guide/#applying-transforms
我知道 pipe( |
) 是.apply
的 python 版本。 但是,我很想知道 python 如何將__or__
運算符解釋為處理從左到右通過的每個 pcollection 元素的處理器。
如果有人可以教育我並指出代碼參考,我將不勝感激。
謝謝,於
我想將@Kolban 的回復標記為答案。
我在 Google 上搜索了“python 運算符重載”,發現了一堆看起來很有可能的很好的參考資料。 搜索 Github 存儲庫,看起來這可能是實際代碼: https ://github.com/apache/beam/blob/master/sdks/python/apache_beam/transforms/ptransform.py#L470
它通過運算符重載來實現:
def __or__(self, right):
"""Used to compose PTransforms, e.g., ptransform1 | ptransform2."""
if isinstance(right, PTransform):
return _ChainedPTransform(self, right)
return NotImplemented
管道 (|) 用於組成PTransforms ,例如ptransform1 | ptransform2
ptransform1 | ptransform2
。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.