Support segment granularity and query granularity in Druid

2,332 views
Skip to first unread message

Jagadeesh M

unread,
May 26, 2016, 2:11:37 PM5/26/16
to Druid User
What are the supported segmentGranularity and queryGranularity options?

As per doc here - http://druid.io/docs/latest/querying/granularities.html only the following are supported - 

allnoneminutefifteen_minutethirty_minutehour and day

Are these the only ones supported? Can we say 10 minutes? And whatz the reason behind not having more flexibility here ?

Thanks!

Xavier Léauté

unread,
May 26, 2016, 2:17:26 PM5/26/16
to druid...@googlegroups.com
If you scroll down the page a bit, you can define arbitrary granularities using any ISO 8601 Period

--
You received this message because you are subscribed to the Google Groups "Druid User" group.
To unsubscribe from this group and stop receiving emails from it, send an email to druid-user+...@googlegroups.com.
To post to this group, send email to druid...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/druid-user/c5b62344-ad59-45cb-8e51-8e71d23373bb%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Jagadeesh M

unread,
May 26, 2016, 2:30:44 PM5/26/16
to Druid User
It is slightly confusing, but using the periods, can I do the following - 

I currently have -  

"granularitySpec" : {
           
"type" : "uniform",
           
"segmentGranularity" : "FIFTEEN_MINUTE",
           
"queryGranularity" : "NONE"
},



And can I do this instead ? - 

 "granularitySpec" : {
           
"type": "period",
            "segmentGranularity" : "P30M"
           
"queryGranularity" : "P10M"
},

I think it doesn't work, these periods look like they only work for queries. Can FJ or Giam confirm?

Thank!

Gian Merlino

unread,
May 26, 2016, 2:57:24 PM5/26/16
to druid...@googlegroups.com
segmentGranularity is an enum and is restricted to the values defined here: https://github.com/metamx/java-util/blob/master/src/main/java/com/metamx/common/Granularity.java

queryGranularity can be anything, the link Xavier posted applies to those.

Gian

Jagadeesh M

unread,
May 26, 2016, 3:15:15 PM5/26/16
to Druid User
Thanks Gian!

So for I can say -  "queryGranularity" : "P10M" ?? And should I specify the type as period or uniform ?

Thanks!

Gian Merlino

unread,
May 26, 2016, 10:30:55 PM5/26/16
to druid...@googlegroups.com
I guess you want queryGranularity PT10M (10 minutes) not P10M (10 months). But yes that would work. The type should still be "uniform". So something like this should work,

   "granularitySpec" : {
            "type" : "uniform",
            "segmentGranularity" : "HOUR",
            "queryGranularity" : "PT10M"
   },

Gian

Jagadeesh M

unread,
May 27, 2016, 7:15:44 AM5/27/16
to Druid User
Thanks Gian!
Reply all
Reply to author
Forward
Message has been deleted
0 new messages