This message was deleted.
# troubleshooting
s
This message was deleted.
v
Druid SQL has a placeholder syntax
?
specifically developed (https://druid.apache.org/docs/latest/querying/sql.html#dynamic-parameters) to pass large single values into the query as a parameter. This was originally developed for Bloom filters (https://druid.apache.org/docs/latest/development/extensions-core/bloom-filter.html) that work with huge literal strings.
I don't think that will help in your case though
because you are passing whole filter expressions
I don't know how generic your usecase is but if you are just looking to do a comparison of count per separate value of a given dimension like your limited example seems to indicate you could have a lookup
dim1Value => threshold
then apply that lookup in your query and have it as another column and then write the having filter as
HAVING COUNT(*) > threshold
but then the lookup itself stores the complexity of your rules
🤷‍♀️
u
I took count just as an example, but similar thing i would need for other aggregation/quantile (post_Agg) too. But all in all it is about comparing with some value for given dimensions (grouping). I have not used lookup so far, but seems like if go by lookup route, i would need look up per query and assuming we have 1000 of such queries running, will there be issues with respect to scale ?
v
can you elaborate on your usecase? It does not fit any pattern I recognize from what you said so far
u
one such use case is find out if count by service, api is below a threshold. Every combination of service,api will have a it's own threshold.
r
usually this data is either only queired by service,api (so just a few filters per query) or you can pre-store the values when you are saving the data (so you where is
service IN (..) AND over_threshold='yes'
but if you change the threshold value you need to either reprocess everything or accept that only new data will be using the new threshold Using lookup on filters does work, but I don't recommend using it for that, but it's possible you add a lookup with "${service_name}:${api}": $threshold then use: WHERE always_same_dim >= CAST (lookup(concat(dim_service, ':', dim_api)) AS Int)