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
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
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
340
AlloyDB 奮闘記
hatappi
0
520
Cloudflare を活用して変わったメルカリの開発体験 / How Cloudflare Changed Mercari's Development Experience
hatappi
1
960
RubyではじめるGraphQL
hatappi
0
990
RubyでChainerつくってます!!
hatappi
2
1.6k
TDDな個人開発
hatappi
0
390
できるだけ楽して楽しくRails開発しよう
hatappi
2
400
EKSにRailsをのせた
hatappi
1
1.3k
Red Chainerを なぜ作って今後どうするのか
hatappi
2
2.6k
Other Decks in Technology
See All in Technology
フィンテック養成勉強会#68
finengine
0
190
ポケモン対戦を自動で記録して振り返ろう
fufufukakaka
0
180
僕のハーネスを紹介します
watany
4
1.3k
AI駆動開発におけるハーネスエンジニアリングの勘所
tsukuboshi
1
360
Tofu-Controller lightning talk @ Containerday 2026
gionn
0
170
Gemini Intelligence 入門 ― AppFunctions と Gemini Nano
takuroabe
0
340
[JAWS-UG彩の国埼玉#12]そろそろ準備する?re:Invent2026をやさしく解説 / reinvent2026-sainokuni
sh_fk2
1
380
dbt Semantic Layerで進めるenechainのデータ民主化
akizhou
1
190
20261017福岡devIO 「AIは"良いダッシュボード"を作れるか?
jtakeda
0
220
こんにちは!SORACOM です & IoT とは【SORACOM UG 東北 in 八戸】
soracom
PRO
0
160
FinOps Agentが生んだ技術負債:コスト自動調査の落とし穴と解消までの道のり
oasis1994liveforever
3
250
スプシの手作業からの解脱 ~更新はClaude Codeに、見せ方と使い方はGASアプリに任せる~
kentarofujii
0
170
Featured
See All Featured
How to build an LLM SEO readiness audit: a practical framework
nmsamuel
2
950
What the history of the web can teach us about the future of AI
inesmontani
PRO
2
750
From π to Pie charts
rasagy
1
400
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
360
31k
Evolution of real-time – Irina Nazarova, EuRuKo, 2024
irinanazarova
9
1.6k
We Are The Robots
honzajavorek
0
400
Beyond borders and beyond the search box: How to win the global "messy middle" with AI-driven SEO
davidcarrasco
3
280
Prompt Engineering for Job Search
mfonobong
0
530
Claude Code どこまでも/ Claude Code Everywhere
nwiizo
68
59k
Build The Right Thing And Hit Your Dates
maggiecrowley
39
3.5k
Making Projects Easy
brettharned
120
6.8k
Noah Learner - AI + Me: how we built a GSC Bulk Export data pipeline
techseoconnect
PRO
0
460
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