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
Druid + R
Search
Metamarkets
April 03, 2013
Technology
210
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Druid + R
Metamarkets
April 03, 2013
More Decks by Metamarkets
See All by Metamarkets
R Workshop for Beginners
metamx
2
4.7k
Other Decks in Technology
See All in Technology
システム思考で問題に対処する
yussak
0
280
つくって納得、つかって実感! 大規模言語モデルことはじめ ver2.0
recruitengineers
PRO
4
1.6k
【CEDEC2026】ゲームシナリオライターを支援するAIツール開発の実践 ― 設計とプロンプトの工夫 ―
cygames
PRO
1
850
SmartHR Engineering Team Deck
smarthr
1
2.1k
ホームラボ紹介
y_sera15
0
180
社内の7割が使うデータ基盤を、 データチーム2人で回すためにやったこと
koh_yoshi
4
1.3k
Model Studio CLI × Token Plan
maigo999
0
180
まちスペース®とデジタルツインと「まちづくり」
hiro_ogi
0
120
Genie Codeハンズオン基礎編
taka_aki
1
120
変化の早いClaude Codeを 書籍に落とし込む
oikon48
7
1.4k
取引先から届く 「セキュリティチェックシート」の読み解き方
kamadamakoto
0
150
名刺メーカーDevグループ 紹介資料
sansan33
PRO
0
1.2k
Featured
See All Featured
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
12
1.8k
Lessons Learnt from Crawling 1000+ Websites
charlesmeaden
PRO
1
1.5k
Bridging the Design Gap: How Collaborative Modelling removes blockers to flow between stakeholders and teams @FastFlow conf
baasie
0
640
Building Adaptive Systems
keathley
44
3.2k
Facilitating Awesome Meetings
lara
57
7.1k
Git: the NoSQL Database
bkeepers
PRO
432
67k
実際に使うSQLの書き方 徹底解説 / pgcon21j-tutorial
soudai
PRO
201
75k
YesSQL, Process and Tooling at Scale
rocio
174
15k
Prompt Engineering for Job Search
mfonobong
0
400
Done Done
chrislema
186
16k
Beyond borders and beyond the search box: How to win the global "messy middle" with AI-driven SEO
davidcarrasco
3
200
From π to Pie charts
rasagy
0
280
Transcript
Druid + R aggregate all your data
agenda An Overview of Druid RDruid Lab Conclusions
motivation visualize big data existing data engines did not meet
our needs
motivation relational databases scans were too slow! NoSQL computationally intractable
pre-computations took too long! nothing existed that could solve our problems (or was cost prohibitive)
enter Druid real-time distributed column-oriented analytical data store scales horizontally
open-source
how is Druid different highly optimized fast scans & aggregations
real-time data ingestion explore events within milliseconds no pre-computation arbitrarily slice & dice data highly available
using Druid we will explore Druid architecture in future meetups
let's learn to use Druid!
RDruid slicing & dicing on steroids
what are we addressing? slicing and dicing data in R
is fun… …until you run out of memory
solution fire up a 64G EC2 machine and hope it
works or let Druid do the work for you
how we use it ad-hoc reporting analyze client data internal
metrics prototyping
metrics
let’s try it code bit.ly/YtJ1Xj
setup launch your favorite R environment install and load the
druid R package install.packages("devtools") install.packages("ggplot2") library(devtools) install_github("RDruid", "metamx") library(RDruid) library(ggplot2) druid-meetup.R
concepts Druid always computes aggregates events are based in time
Druid understands time bucketing dimensions along which to slice & dice metrics to aggregate
concepts think aggregates and group by in SQL SELECT hour(timestamp),
time page, language, dimensions sum(count) metrics GROUP BY hour(timestamp), page, language
data sources connect to our cluster druid <- druid.url("druid-meetup.mmx.io") Wikipedia
druid.query.dimensions(url = druid, dataSource = "wikipedia_editstream") druid.query.metrics(url = druid, dataSource = "wikipedia_editstream") Twitter dataSource = "twitterstream" x0-sources.R
timeseries Wikipedia page edits since January, by hour edits <-
druid.query.timeseries( url = druid, dataSource = "wikipedia_editstream", intervals = interval(ymd("2013-01-01"), ymd("2013-04-01")), aggregations = sum(metric("count")), granularity = "hour" ) qplot(data = edits, x = timestamp, y = count, geom = "line") x1-timeseries.R
filters what if I'm only interested in articles in English
and French enfr <- druid.query.timeseries( [...] granularity = "hour", filter = dimension("namespace") == "article" & ( dimension("language") == "en" | dimension("language") == "fr" ) ) x2-filters.R
group by let's break it out by language enfr <-
druid.query.groupBy( [...] filter = dimension("namespace") == "article" & ( dimension("language") == "en" | dimension("language") == "fr" ), dimensions = list("language") ) qplot(data = enfr, x = timestamp, y = count, geom = "line", color = language) x3-groupby.R
granularity arbitrary time slices granularity = granularity( "PT6H", timeZone =
"America/Los_Angeles" ) try out a few more P1D · P1W · P1M x4-timeslices.R
aggregations sum, min, max aggregations = list( count = sum(metric("count")),
total = sum(metric("added")) ) timestamp total count 1 2013-01-01 127232693 346895 2 2013-01-02 130657602 403504 3 2013-01-03 134643672 387462 x5-aggs.R
math you can do math too + - * /
constants aggregations = list( count = sum(metric("count")), added = sum(metric("added")), deleted = sum(metric("deleted")) ), postAggregations = list( average = field("added") / field("count"), pct = field("deleted") / field("added") * -100 ) x6-postaggs.R
more advanced all pages edited by users matching regex '^Bob.*'
druid.query.groupBy([...] intervals = interval(ymd("2013-03-01"), ymd("2013-04-01")), granularity = "all", single time bucket filter = dimension("user") %~% "^Bob.*", dimensions = list("user", "page") ) x7-advanced.R
academy awards stats awards <- druid.query.groupBy( url = druid, dataSource
= "twitterstream", intervals = interval(ymd("2013-02-24"), ymd("2013-02-28")), aggregations = list(tweets = sum(metric("count"))), granularity = granularity("PT1H"), filter = dimension("first_hashtag") %~% "academyawards" | dimension("first_hashtag") %~% "oscars", dimensions = list("first_hashtag")) awards <- subset(awards, tweets > 10) qplot(data=awards, x = timestamp, y = tweets, color = first_hashtag, geom="line") x8-awards.R
academy awards stats x8-awards.R
roll your own run your own Druid cluster github.com/metamx/druid/wiki/ Druid-Personal-Demo-Cluster
contribute fork us on github Druid github.com/metamx/druid RDruid github.com/metamx/RDruid
thank you