Rabbit Slide Show

Groonga and Apache Arrow

Description

https://red-data-tools.connpass.com/event/349680/

Text

Page: 1

Groonga and
Apache Arrow
Abe Tomoaki
ClearCode Inc.
Groonga and Apache Arrow
Powered by Rabbit 3.0.5

Page: 2

Groongaは
Apache Arrow
フォーマットで入
出力できるよ!

Page: 3

Groongaとは?
✓ オープンソースのカラムストア
機能付き全文検索エンジン
✓ 即時更新
✓ 参照ロックフリー
✓ 集計もできる
Groonga and Apache Arrow
Powered by Rabbit 3.0.5

Page: 4

例で紹介Groonga: 検索
// SQLで書くとこういう感じ
// select _key, introduction
// from Users
// where introduction &@ 'engine'
query = new URLSearchParams({
table: 'Users',
output_columns: '_key,introduction',
match_columns: 'introduction',
query: 'engine', // 「engine」で全文検索
// output_type: 'apache-arrow', このパラメータを付与するとApache Arrowフォーマットになる
command_version: 3
});
response = await fetch(`http://localhost:10041/d/select?${query}`);
(await response.json()).body.drilldowns.department.records
// [
//
[ "Groonga", "Groonga is an open-source fulltext search engine and column store." ],
//
[ "Mroonga", "A MySQL pluggable storage engine based on Groonga." ]
// ]
Groonga and Apache Arrow
Powered by Rabbit 3.0.5

Page: 5

例で紹介Groonga: 集計
// SQLで書くとこういう感じ
// select department, avg(age)
// from Users
// group by department
// drilldownというので集計できる
query = new URLSearchParams({
table: 'Users',
output_columns: '_id',
drilldown: 'department',
drilldown_calc_types: 'AVG',
drilldown_calc_target: 'age',
drilldown_output_columns: '_key,_avg',
command_version: 3
});
response = await fetch(`http://localhost:10041/d/select?${query}`);
(await response.json()).body.drilldowns.department.records
// [
//
[ "A", 37 ],
//
[ "B", 15.5 ]
// ]
Groonga and Apache Arrow
Powered by Rabbit 3.0.5

Page: 6

事例紹介

Page: 7

活用事例1: Groonga delta
✓ MySQL/MariaDBのデータをリ
アルタイムでGroongaに同期す
るツール
✓ 差分情報をApache Parquet形
式で保存
✓ Groongaへの取り込みを高速に行え
る
Groonga and Apache Arrow
Powered by Rabbit 3.0.5

Page: 8

Groonga delta補足
✓ MySQL/MariaDBのbinlog(差
分情報)を一度ストレージに書
き出す
✓ これにより途中で失敗してもやり直し
がしやすい
✓ この書き出すフォーマットがApache
Parquet形式
Groonga and Apache Arrow
Powered by Rabbit 3.0.5

Page: 9

活用事例2: ログ収集製品
✓ 某ログ収集製品でGroongaが利
用されている
✓ データのやり取りにApache
Arrowフォーマットを使うこと
で高速化できた
Groonga and Apache Arrow
Powered by Rabbit 3.0.5

Page: 10

まとめ
✓ GroongaはApache Arrow
フォーマットで入出力できる
よ!
✓ Groongaは全文検索も集計もで
きるよ!
Groonga and Apache Arrow
Powered by Rabbit 3.0.5

Page: 11

宣伝
何かとApache Parquet形
式でデータを保存する時代
なので、Groongaでデータ
分析の前処理とかしてみる
といいよ!
Groonga and Apache Arrow
Powered by Rabbit 3.0.5

Page: 12

参考
✓ Groonga
✓ https://groonga.org/
✓ Groonga delta
✓ https://github.com/groonga/
groonga-delta
✓ https://www.clear-code.com/blog/
2022/5/20/groonga-delta.html
Groonga and Apache Arrow
Powered by Rabbit 3.0.5

Other slides