Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Apache Beam Go SDK 触ってみた話
Search
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
apstndb
March 25, 2018
Programming
1.1k
1
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Apache Beam Go SDK 触ってみた話
Open Go Friday #2 で話した資料
2018年3月時点の master ブランチを触ってみた話です。
apstndb
March 25, 2018
More Decks by apstndb
See All by apstndb
GKE/Kubernetes の Service はどう動いているのか
apstndb
18
10k
Other Decks in Programming
See All in Programming
Apache Hive: そしてCloud Native Lakehouseへ
okumin
1
200
Go言語とトイモデルで学ぶTransformerの気持ち / fukuokago23-transformer
monochromegane
0
160
仕様書を書く前にハーネスを作る - Agent Native開発は「探索を速く、判定を固く」
gotalab555
4
1.5k
Terraform標準の組織で AWS CDKをどう使うか
mu7889yoon
1
470
言語を使う側から、作る側へ。 自作 Lisp で得た新たな気づき。
andpad
0
150
ソフトウェア設計に溶けるインフラ ― AWS CDK のインフラ認識論
konokenj
3
750
Augmenting AI with the Power of Jakarta EE
ivargrimstad
0
480
その節約、円になってますか?
isamumumu
1
680
Detecting Compromised CI with eBPF and Cilium Tetragon
lizrice
0
130
生成AIで帳票OCRが「簡単に」作れる時代になった?
kon_shou
0
420
AIが無かった頃の素敵な出会いの話
codmoninc
1
380
ルールを書いて終わらせないハーネスエンジニアリング
yug1224
4
1.8k
Featured
See All Featured
Have SEOs Ruined the Internet? - User Awareness of SEO in 2025
akashhashmi
0
410
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
254
22k
Designing for humans not robots
tammielis
254
26k
Collaborative Software Design: How to facilitate domain modelling decisions
baasie
1
270
The Psychology of Web Performance [Beyond Tellerrand 2023]
tammyeverts
49
3.5k
Sam Torres - BigQuery for SEOs
techseoconnect
PRO
0
460
AI in Enterprises - Java and Open Source to the Rescue
ivargrimstad
0
1.4k
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
31
2.8k
Building a A Zero-Code AI SEO Workflow
portentint
PRO
0
650
Deep Space Network (abreviated)
tonyrice
0
250
Unlocking the hidden potential of vector embeddings in international SEO
frankvandijk
0
890
Stop Working from a Prison Cell
hatefulcrawdad
274
21k
Transcript
Apache Beam Go SDK 触ってみた話 apstndb
Apache Beam とは • Google 発のバッチ処理とストリーミング処理の統一モデルである Dataflow モデル を扱う OSS
• フルマネージドなデータ処理サービス Google Cloud Dataflow 実行可能 ◦ そもそも Apache 寄贈前は Dataflow SDK ◦ 他の Runner 上でも実行可能(Spark, Flink, etc...) • 2.4.0 では Java と Python の SDK が含まれる ◦ 2018年3月現在開発が進んでいる目玉は Streaming SQL と Go SDK • Go でもクラウドで分散データ処理が可能になる?
Apache Beam Go SDK のステータス(2018/3現在) - 設計資料 https://s.apache.org/beam-go-sdk-design-rfc - JIRA
の sdk-go コンポーネントとして管理されている - 開発状況 - 長い間 go-sdk ブランチで開発 - Apache Beam 2.4 ブランチが切られてから master にマージ済 - 2.5 でリリース予定? https://github.com/apache/beam/blob/master/sdks/go/README.md
Apache Beam Go SDK のステータス
構成要素 - PCollection - Beam 上でのデータセット - リストのようなもの - PTransform
- PCollection から PCollection を作る操作 - 複数入出力でマージ(JOIN) や分岐も可能 - ParDo は map / flatMap 相当 - 他にも Combine, GroupByKey, Flatten, Partition 等
ソースコードの実例 var input beam.PCollection = beam.Create(s, 1, 2, 3, 4)
var square beam.PCollection = beam.ParDo(s, func(x int) int { return x * x }, input) // int to int var strings beam.PCollection = beam.ParDo(s, strconv.Itoa, square) textio.Write(s, *output, strings) 値の型がない!
Go SDK での実行におけるフェーズ • Compile ◦ 通常の Go のプログラムとしてコンパイルする ◦
型チェックが行われるがジェネリクスがないため大部分は検査できない • Pipeline Construction ◦ Go のプログラム実行時に Beam の実行グラフを生成する ◦ リフレクションでパイプラインの型チェックをする ▪ panic するか err で受け取るかは選択可能 • Runtime ◦ 実行グラフを元に Runner 上で実行する ▪ Cloud Dataflow のジョブ内での処理に対応 ◦ 型チェック済なので安全
実行時に管理される型情報 stringList := beam.CreateList(s, []string{"a", "b", "c"}) fmt.Println("stringList:", stringList.Type()) //
stringList: string intList := beam.CreateList(s, []int{1, 2, 3}) fmt.Println("intList:", intList.Type()) // intList: int convList := beam.ParDo(s, strconv.Itoa, intList) fmt.Println("convList:", convList.Type()) // convList: string convList2 := beam.ParDo(s, strconv.Itoa, stringList) fmt.Println("convList2:", convList2.Type()) // panic
Direct Runnerでの実行 • ローカルで実行可能 • パイプラインのグラフのにおける型情報がデバッグ出力される • 実装済の機能は動く
Cloud Dataflow での実行 • ジョブを発行可能 ◦ グラフが見える • 2018/3 現在の
master は機能せず • 途中から詰まったままになる • 実行状況の詳細も取れない ◦ Currently unsupported らしい
まとめ - Go にも分散処理が来る日は近そう - 脱 Java したい! - エディタでの対応が望まれる(型チェック・補完)
- Go にもやっぱりジェネリクスは欲しいのでは?