Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
RubyとApache Arrow
Search
hatappi
December 08, 2018
Technology
2.7k
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
RubyとApache Arrow
Apache Arrow東京ミートアップ2018
https://speee.connpass.com/event/103514/
#ArrowTokyo
hatappi
December 08, 2018
More Decks by hatappi
See All by hatappi
メルカリのグローバルアプリで挑んだ AlloyDB 運用と課題解決の実践記
hatappi
0
280
AlloyDB 奮闘記
hatappi
0
490
Cloudflare を活用して変わったメルカリの開発体験 / How Cloudflare Changed Mercari's Development Experience
hatappi
1
920
RubyではじめるGraphQL
hatappi
0
970
RubyでChainerつくってます!!
hatappi
2
1.5k
TDDな個人開発
hatappi
0
380
できるだけ楽して楽しくRails開発しよう
hatappi
2
390
EKSにRailsをのせた
hatappi
1
1.3k
Red Chainerを なぜ作って今後どうするのか
hatappi
2
2.5k
Other Decks in Technology
See All in Technology
ペアプロの価値はコードを書くことだけじゃない
codmoninc
PRO
0
160
HRC_Frontend_Conference_Fukuoka_2026.pdf
ts020
0
390
Microsoft 365 Copilot chat -tekoälypalvelun tietosuojaongelmat
hponka
0
650
「図書館」という名前のままでいいのか -Code4Lib JAPANカンファレンス2026 アンカンファレンス報告- / Code4Lib JAPAN Conference 2026: Unconference Report
ykiyota
0
160
深夜のクラウド懺悔室 1:29:300 or 1:0:0
kazzpapa3
1
230
クロスボーダーM&AのValue Upを支えるプロダクト開発。日米チームのハブになったプロダクトエンジニアの実践 / Product Engineering Conference 2026
genda
0
110
Sigmaユーザーのための有用リソース一挙公開 & Sigmaで使えるMCP #sigma_ucj /useful-resources-for-sigma-computing-users-and-mcps-with-sigma
shinyaa31
0
180
生成AIのテナント制御とシャドーMCP対策 | AIを"止めずに"、情報を守る
yukun
0
140
Podは生きているのにGoだけが落ちる:GOGCとGOMEMLIMITで追うInvisible OOM Killの謎
tkc66buzz
1
500
プロダクト思考 × 基盤思考を AIで実現する Compound Engineering
tkc66buzz
1
310
研究開発部の紹介 / Sansan R&D Profile
sansan33
PRO
4
25k
Multica × 長期記憶:40個のミニプロジェクト管理
eiei114
1
240
Featured
See All Featured
The Curious Case for Waylosing
cassininazir
1
500
Fireside Chat
paigeccino
43
4k
jQuery: Nuts, Bolts and Bling
dougneiner
66
8.6k
Un-Boring Meetings
codingconduct
0
410
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
141
35k
Hiding What from Whom? A Critical Review of the History of Programming languages for Music
tomoyanonymous
3
1.2k
Odyssey Design
rkendrick25
PRO
2
800
The World Runs on Bad Software
bkeepers
PRO
72
12k
Neural Spatial Audio Processing for Sound Field Analysis and Control
skoyamalab
0
490
Practical Orchestrator
shlominoach
191
12k
エンジニアに許された特別な時間の終わり
watany
108
250k
The Anti-SEO Checklist Checklist. Pubcon Cyber Week
ryanjones
0
230
Transcript
RubyとApache Arrow Yusaku Hatanaka (@hatappi) Apache Arrow 東京ミートアップ2018
⾃⼰紹介 • Yusaku Hatanaka (@hatappi) • Red Data Tools のメンバー
• Ruby, Go, TypeScript C, C++ • 煎り⼤⾖が好き
この話のゴール • RubyでApache Arrowを使った取り組みの話や今後どうな ると嬉しいかの話を聞いて「へぇ〜」となる • RubyでApache Arrowを使う開発やApache Arrow本体の 開発に参加したくなる
Apache Arrow • 各種⾔語で使⽤できるインメモリのデータ処理プラット フォーム • ⾼速なデータフォーマット、交換処理ロジックによって効 率的なデータ交換処理ロジックなどを提供する
Red Data Tools • Ruby⽤のデータ処理ツールを提供するプロジェクト • 基本はGitter上でやりとりをしている • https://gitter.im/red-data-tools/ja •
毎⽉1回ミートアップしてる • 次回は12⽉11⽇ 来週⽕曜⽇ https://speee.connpass.com/event/105238/
現状どんなことが できるのか?
Red Arrow red-data-tools/red-arrow
Red Arrow • Apache ArrowのRuby binding • もともとはred-data-toolsのリポジトリで管理されていた が今はApache Arrow本体にある
• GObject Introspectionを使⽤してbindingを実現している • Arrow側の関数情報が更新されていけばRed Arrowもそ の最新の機能を使うことができる
データの変換コスト
“推測するな。計測せよ”
ཁૉ ࣮ߦ࣌ؒ T
JSONの読み書き
ཁૉ ࣮ߦ࣌ؒ T
Apache Arrowの読み書き
࣮ߦ࣌ؒ (s) 0 1.5 3 4.5 6 ཁૉ 10000 100000
1000000 10000000 JSON Apache Arrow
RubyでCSVをパース
CSV ߦ ࣮ߦ࣌ؒ T
Ccsv ߦ ࣮ߦ࣌ؒ T
Apache ArrowͷCSV Parser • Arrow 0.11.0で⼊った新機能 • データの永続化としてよく使われるCSVを⾼速に読み込ん でApache Arrowのデータとして処理できるようになる
Apache Arrow ߦ ࣮ߦ࣌ؒ T
࣮ߦ࣌ؒ T ߦ
DTW $DTW "QBDIF"SSPX
Arrow Arrowすごい Ccsvもすごい
データの相互交換
ߦ ࣮ߦ࣌ؒ T
CSV -> Arrow -> Parquet
今後どうなると嬉しいか
RubyでもGPU上で データフレームを使いたい
cuDF • GPU上でデータフレームを操作するためのライブラリ • RAPIDSというE2Eのデータ分析をGPUで実現するための プロジェクト • Rubyでbindingつくれるとよさそう
MySQLの実⾏結果を Apache Arrowのフォーマット で返せると良さそう!
CSVJSON ࠓ ͜͏ͳΔͱخ͍͠ ૣ͍
mysql2-arrow • mysql2はlibmysqlのRuby binding • ActiveRecordでMySQLを選択した時のアダプターとし ても使⽤される • mysql2を早くできればActiveRecordも早くなって嬉し いかもしれない
• mysql2で実⾏した際のMYSQL_RESを取り出すことができ ればArrow形式に変換できそう
select * from users; MYSQL_RES Mysql2::Result MYSQL_RESからいくつかのレコードを arrow::RecordBatchにまとめて返す Arrow::RecordBatch として受け取る!
3VCZͷੈք $ $ ͷੈք イメージ
実⾏イメージ
DEMO
• ActiveRecord: 6.849s • pluck: 2.450s • Apache Arrow: 0.520s
ActiveRecordで使うと
ここまでのまとめ • Apache Arrowの開発が進めばRubyだけでなく他の⾔語も 嬉しい! • Ruyb bindingつくるもよし! Apache Arrow本体の開発するもよし!
• やりたいことはたくさんある! • red-data-tools/want-to-do