Druid.Druid
— ModuleDruid.Aggregator
— TypeAggregator
Supertype of all aggregators.
Druid.AndF
— TypeAndF(filters::Vector{<:Filter})
Match all filters
.
Druid.AndH
— TypeAndH(havingSpecs::Vector{<:HavingSpec})
Match all havingSpecs
.
Druid.Arithmetic
— TypeArithmetic(name::String, fn::String, fields::Vector{<:PostAggregator}; ordering=nothing)
Apply the fn
aggregation to the fields
.
ordering should be a String if provided.
Druid.Bound
— TypeBound(dimension::String;
lower=nothing, upper=nothing, lowerStrict=nothing, upperStrict=nothing,
ordering=nothing, extractionFn=nothing)
Filter values bounded in a range.
lower, upper and ordering should be String
s if provided. lowerStrict and upperStrict should be Bool
s if provided. extractionFn should be an ExtractionFunction if provided.
Druid.BucketEF
— TypeBucketEF(; size=nothing, offset=nothing)
Bucket numeric values into size
buckets starting at offset
.
size and offset should be non negative integers if provided.
Druid.CascadeEF
— TypeCascadeEF(extractionFns::Vector{<:ExtractionFunction})
Apply multiple extraction functions in sequence.
Druid.Client
— TypeClient
Client(url::URIs.URI)
Client(url::AbstractString)
Client(host, port, scheme)
Druid queryable host connection information store.
Do not provide the endpoint, it will be set based on the type of query. For example, "druid/v2/sql" for SQL queries and "druid/v2" for all other queries.
Examples
julia> client = Client("http://localhost:8888/")
Client(URI("http://localhost:8888/"))
julia> client = Client("localhost", 8082, "http")
Client(URI("http://localhost:8082"))
Druid.ColumnComparison
— TypeColumnComparison(dimensions::Tuple{DimensionSpec, DimensionSpec})
ColumnComparison(dim1::DimensionSpec, dim2::DimensionSpec)
dimension1 = dimension2 filter.
Druid.ConstantPA
— TypeConstantPA(name::String, value::Real)
Return a constant value as name
.
Druid.Contains
— TypeContains(value::String; case_sensitive=nothing)
Search query spec for strings containing value
.
case_sensitive should be a Bool if provided.
Druid.Count
— TypeCount(output_name)
Count number of rows.
Druid.DataSource
— TypeDataSource
Supertype of all data sources.
Druid.DatasourceMetadata
— TypeDatasourceMetadata(dataSource::DataSource; context=nothing)
Returns a Dict{String, String} with "timestamp" and "maxIngestedEventTime" as keys.
context should be a Dict if provided.
Druid.DefaultDS
— TypeDefaultDS(dimension::String;
outputName=nothing, outputType=nothing)
The "default" type dimension spec.
outputName and outputType should be String
s if provided.
Druid.DefaultLS
— TypeDefaultLS(; limit=nothing, offset=nothing, columns=nothing)
Default limitSpec.
limit and offset should be non negative integers if provided. columns should be Vector{OrderByColumn} if provided.
Druid.DimSelector
— TypeDimSelector(dimension::String, value)
dimension = value filter.
Druid.Dimension
— TypeDimension()
Dimension(; ordering=nothing, previousStop=nothing)
Dimension topN metric spec.
ordering and previousStop should be String
s if provided.
Druid.DimensionSpec
— TypeDimensionSpec
Supertype of all dimension specs.
Druid.DurationGranularity
— TypeDurationGranularity(duration::UInt64; origin=nothing)
Duration type granularity where the duration is specified as milliseconds since origin.
Specifying origin is not required (defaults to Druid's default), but should be a ISO8601 datetime string if you do specify it.
Druid.EqualTo
— TypeEqualTo(aggregation::String, value::Real)
aggregation = value filter.
Druid.Expression
— TypeExpression(name::String, expression::String; outputType=nothing)
Create a virtual column using expression
.
outputType should be String if provided.
Druid.ExtractionDS
— TypeExtractionDS(dimension::String, extractionFn::ExtractionFunction;
outputName=nothing, outputType=nothing)
Dimension spec to use with an extraction function.
outputName and outputType should be String
s if provided.
Druid.ExtractionFilter
— TypeExtractionFilter(dimension::String, value, extractionFn::ExtractionFunction)
Filter to value
extracted using extractionFn
.
Druid.ExtractionFunction
— TypeExtractionFunction
Supertype of all extraction functions.
Druid.FieldAccess
— TypeFieldAccess(name::String, aggregator::String)
FieldAccess(aggregator::String)
Access the aggregator
and return as name
.
Druid.Filter
— TypeFilter
Supertype of all filters.
Druid.Filtered
— TypeFiltered(filter, aggregator)
An aggregator that combines a filter with the aggregator
.
Druid.FinalizingFieldAccess
— TypeFinalizingFieldAccess(name::String, aggregator::String)
FinalizingFieldAccess(aggregator::String)
Access the aggregator
and return as name
.
Druid.Fragment
— TypeFragment(value::String; case_sensitive=nothing)
Fragment search query spec.
case_sensitive should be a Bool if provided.
Druid.Granularity
— TypeGranularity
Supertype of all granularities.
Druid.GreaterThan
— TypeGreaterThan(aggregation::String, value::Real)
aggregation >= value filter.
Druid.Greatest
— TypeGreatest(name::String, fields::Vector{<:PostAggregator}, dtype::String)
Find the largest value per row across the fields
of type dtype
(double, long) and return as name
.
Druid.GroupBy
— TypeGroupBy(
dataSource::DataSource,
dimensions::Vector{<:DimensionSpec},
intervals::Vector{<:Interval},
granularity::Granularity;
<keyword arguments>
)
Returns a Druid.GroupByResult which is compatible with the Tables.jl interface.
A method with all arguments as keyword arguments is also provided.
Arguments
- limitSpec::LimitSpec = nothing
- having::HavingSpec = nothing
- filter::Filter = nothing
- aggregations::Vector{<:Aggregator} = nothing
- postAggregations::Vector{<:PostAggregator} = nothing
- virtualColumns::Vector{<:VirtualColumn} = nothing
- subtotalsSpec::Vector{Vector{String}} = nothing
- context::Dict = nothing
Druid.Grouping
— TypeGrouping(groupings, name)
Grouping aggregator
Druid.HavingSpec
— TypeHavingSpec
Supertype of all having filters.
Druid.HyperUniqueCardinality
— TypeHyperUniqueCardinality(name::String, field::String)
HyperUniqueCardinality(field::String)
Post aggregator of a hyper unique aggregation.
Druid.InF
— TypeInF(dimension::String, values::Vector)
Filter if value is in values
.
Druid.Inline
— TypeInline(column_names::Vector{String}, rows::Vector{Vector{T}})
Inline datasource.
Druid.InlineLookupEF
— TypeInlineLookupEF(lookup::Map;
retainMissingValue=nothing, replaceMissingValueWith=nothing, injective=nothing, optimize=nothing)
Extract using an inline lookup.
retainMissingValue, injective, optimize should be Bool
s and replaceMissingValueWith should be a String if provided.
Druid.InsensitiveContains
— TypeInsensitiveContains(value::String)
Case insensitive string contains searhc query spec.
Druid.Interval
— TypeInterval(first::String, last::String)
A type to represent ISO8601 intervals.
Druid.IntervalF
— TypeIntervalF(dimension::String, intervals::Vector{<:Interval}; extractionFn=nothing)
Filter by time falling in one of the intervals
.
extractionFn should be an ExtractionFunction if provided.
Druid.Inverted
— TypeInverted(metric::TopNMetricSpec)
Inverting topN metric spec.
Druid.JavaScriptEF
— TypeJavaScriptEF(jsfunction::String; injective=nothing)
Extract using a custom JavaScript function.
injective should be a Bool if provided.
Druid.JavaScriptF
— TypeJavaScriptF(dimension::String, jsfunction::String)
Filter using a custom JavaScript function.
Druid.JavaScriptPA
— TypeJavaScriptPA(name::String, fieldNames::Vector{String}, jsfunction::String)
Post aggregate the fieldNames
aggregators using a custom jsfunction
JavaScript function.
Druid.Join
— TypeJoin(left::Union{Table, Lookup, Inline, QuerySource, Join},
right::Union{Lookup, Inline, QuerySource}, rightPrefix::String,
condition::String, joinType::String)
Join datasource.
Druid.Least
— TypeLeast(name::String, fields::Vector{<:PostAggregator}, dtype::String)
Find the smallest value per row across the fields
of type dtype
(double, long) and return as name
.
Druid.LessThan
— TypeLessThan(aggregation::String, value::Real)
aggregation <= value filter.
Druid.Like
— TypeLike(dimension::String, pattern::String; escape=nothing, extractionFn=nothing)
Filter strings matching pattern
.
escape should be a String and extractionFn an ExtractionFunction if provided.
Druid.LimitSpec
— TypeLimitSpec
Supertype of all limit specs.
Druid.ListFiltered
— TypeListFiltered(delegate::DimensionSpec, values::Vector{String}; isWhitelist=nothing)
Filter the delegate
dimension spec with the values
.
isWhitelist should be a Bool if provided.
Druid.Lookup
— TypeLookup(name::String)
Lookup datasource.
Druid.LookupDS
— TypeLookupDS(dimension::String, name::String; outputName=nothing)
A dimension spec to use with the name
lookup.
outputName should be a String if provided.
Druid.LowerEF
— TypeLowerEF(; locale=nothing)
Extract strings as lower case.
locale should be a String if provided.
Druid.Map
— TypeMap(isOneToOne::Bool, dict::Dict)
The lookup map used in the map lookup dimension spec.
Druid.MapLookupDS
— TypeMapLookupDS(dimension::String, lookup::Map;
outputName=nothing, retainMissingValue=nothing, replaceMissingValueWith=nothing, optimize=nothing)
Map lookup dimension spec.
outputName and replaceMissingValueWith should be String
s, retainMissingValue and optimize should be Bool
s if provided.
Druid.NotF
— TypeNotF(filter::Filter)
Do not match filter
.
Druid.NotH
— TypeNotH(havingSpec::HavingSpec)
Do not match the havingSpec
.
Druid.Numeric
— TypeNumeric(metric::String)
Numeric topN metric spec.
Druid.OrF
— TypeOrF(filters::Vector{<:Filter})
Match at least one of the filters
.
Druid.OrH
— TypeOrH(havingSpecs::Vector{<:HavingSpec})
Match at leats one of the havingSpecs
.
Druid.OrderByColumn
— TypeOrderByColumn(dimension::String, direction::String; dimensionOrder=nothing)
dimensionOrder should be a String if provided.
Druid.Parameter
— TypeParameter(type::String, value)
SQL query parameter, where type
is one of the Druid SQL data types and value
is the parameter value.
Druid.PartialEF
— TypePartialEF(expr::String)
Regex based extraction function that return nulls for non-matches.
Druid.PeriodGranularity
— TypePeriodGranularity(period::String; origin=nothing, timezone=nothing)
Period type granularity where the period is specified as an ISO8601 period string. Period starts on origin in the timezone.
Specifying origin and timezone is not required (defaults to Druid's default). But if you do specify them, origin should be a ISO8601 datetime string and timezone should be one of those supported by Druid.
Druid.PostAggregator
— TypePostAggregator
Supertype of all post aggregators.
Druid.PrefixFiltered
— TypePrefixFiltered(delegate::DimensionSpec, prefix::String)
Filter the delegate
dimension spec with the prefix
.
Druid.Query
— TypeQuery
Supertype of all queries.
Druid.QueryResult
— TypeQueryResult
Supertype of all query results.
Druid.QuerySource
— TypeQuerySource(query::Query)
Query datasource.
Druid.RegexEF
— TypeRegexEF(expr::String; index=nothing, replaceMissingValue=nothing, replaceMissingValueWith=nothing)
Regex based extraction function.
index should be a non negative integer, replaceMissingValue a Bool and replaceMissingValueWith a String if provided.
Druid.RegexF
— TypeRegexF(dimension::String, pattern::String)
Regex pattern matching filter.
Druid.RegexFiltered
— TypeRegexFiltered(delegate::DimensionSpec, pattern::String)
Filter the delegate
dimension spec with the regex pattern
.
Druid.RegisteredLookupEF
— TypeRegisteredLookupEF(lookup::String;
retainMissingValue=nothing, replaceMissingValueWith=nothing, injective=nothing, optimize=nothing)
Extract using a registered lookup.
retainMissingValue, injective, optimize should be Bool
s and replaceMissingValueWith should be a String if provided.
Druid.Scan
— TypeScan(dataSource::DataSource, intervals::Vector{<:Interval}; <keyword arguments>)
A method with all arguments as keyword arguments is also provided.
Arguments
- columns::Vector{String} = nothing
- filter::Filter = nothing
- virtualColumns::Vector{<:VirtualColumn} = nothing
- order::String = nothing
- limit::Integer = nothing
- offset::Integer = nothing
- resultFormat::String = nothing
- batchSize::Integer = nothing
- context::Dict = nothing
- legacy::Bool = nothing
Druid.Search
— TypeSearch(dataSource::DataSource, intervals::Vector{<:Interval}, query::SearchQuerySpec; <keyword arguments>)
Returns a Druid.SearchResult which is compatible with the Tables.jl interface.
A method with all arguments as keyword arguments is also provided.
Arguments
- granularity::Granularity = nothing
- filter::Filter = nothing
- virtualColumns::Vector{<:VirtualColumn} = nothing
- sort::String = nothing
- limit::Integer = nothing
- context::Dict = nothing
Druid.SearchF
— TypeSearchF(dimension::String, query::SearchQuerySpec; extractionFn=nothing)
Filter using a query and optionally extraction function.
extractionFn should be an ExtractionFunction if provided.
Druid.SearchQueryEF
— TypeSearchQueryEF(query::SearchQuerySpec)
Extraction using a search query spec.
Druid.SearchQuerySpec
— TypeSearchQuerySpec
Supertype of all search query specs.
Druid.SegmentMetadata
— TypeSegmentMetadata(dataSource::DataSource; <keyword arguments>)
Returns a Dict with the query output.
A method with all arguments as keyword arguments is also provided.
Arguments
- intervals::Vector{<:Interval} = nothing
- toInclude::Union{String, Vector{String}} = nothing
- merge::Bool = nothing
- analysisTypes::Vector{String} = nothing
- lenientAggregatorMerge::Bool = nothing
- virtualColumns::Vector{<:VirtualColumn} = nothing
- context::Dict = nothing
Druid.Selector
— TypeSelector(dimension::String, value::String)
dimension = value filter.
Druid.SimpleGranularity
— TypeSimpleGranularity(name::String)
One of the simple predefined granularities of Druid.
Druid.SingleField
— TypeSingleField(type, field, output_name)
Apply type
aggregator to the field
and get result as output_name
.
Available type
s: "longSum", "doubleSum", "floatSum", "longMin", "doubleMin", "floatMin", "longMax", "doubleMax", "floatMax", "longFirst", "doubleFirst", "floatFirst", "longLast", "doubleLast", "floatLast", "longAny", "doubleAny", "floatAny", "doubleMean"
Druid.Sql
— TypeSql(query::String; <keyword arguments>)
A method with all arguments as keyword arguments is also provided.
Arguments
- parameters::Vector{Parameter} = nothing
- resultFormat::String = nothing
- header::Bool = true
- context::Dict = nothing
Druid.StringAgg
— TypeStringAgg(type, field, output_name; maxStringBytes=nothing)
Apply type
string aggregator to field
and get result as output_name
.
Available type
s: "first", "last", "any"
See Druid documentation for maxStringBytes
.
Druid.StringFormatEF
— TypeStringFormatEF(format::String; nullHandling=nothing)
Extract strings using a format.
nullHandling should be a String if provided.
Druid.StrlenEF
— TypeStrlenEF()
Extract string length.
Druid.SubstringEF
— TypeSubstringEF(index::UInt64; length=nothing)
Substring extraction based on index and length.
length should be a non negative integer if provided.
Druid.Table
— TypeTable(name::String)
Table datasource.
Druid.TimeBoundary
— TypeTimeBoundary(dataSource::DataSource; <keyword arguments>)
Returns a Dict{String, String} with "timestamp", "minTime" and/or "maxTime" (depending on bound
) as keys.
A method with all arguments as keyword arguments is also provided.
Arguments
- bound::String = nothing
- filter::Filter = nothing
- virtualColumns::Vector{<:VirtualColumn} = nothing
- context::Dict = nothing
Druid.TimeFormatEF
— TypeTimeFormatEF(; format=nothing, timeZone=nothing, locale=nothing, granularity=nothing, asMillis=nothing)
Extract timestamps.
format, timeZone, locale should be String
s, granularity should be a Granularity and asMillis should be a Bool if provided.
Druid.TimeParseEF
— TypeTimeParseEF(timeFormat::String, resultFormat::String; joda=nothing)
Parse and extract time.
joda should be a Bool if provided.
Druid.Timeseries
— TypeTimeseries(dataSource::DataSource, intervals::Vector{<:Interval}, granularity::Granularity; <keyword arguments>)
Returns a Druid.TimeseriesResult which is compatible with the Tables.jl interface.
A method with all arguments as keyword arguments is also provided.
Arguments
- filter::Filter = nothing
- aggregations::Vector{<:Aggregator} = nothing
- postAggregations::Vector{<:PostAggregator} = nothing
- virtualColumns::Vector{<:VirtualColumn} = nothing
- descending::Bool = nothing
- limit::Integer = nothing
- context::Dict = nothing
Druid.TopN
— TypeTopN(dataSource::DataSource, intervals::Vector{Interval}, granularity::Granularity,
dimension::DimensionSpec, threshold::Uint64, metric::TopNMetricSpec; <keyword arguments>)
Returns a Druid.TopNResult which is compatible with the Tables.jl interface.
A method with all arguments as keyword arguments is also provided.
Arguments
- aggregations::Vector{<:Aggregator} = nothing
- postAggregations::Vector{<:PostAggregator} = nothing
- filter::Filter = nothing
- virtualColumns::Vector{<:VirtualColumn} = nothing
- context::Dict = nothing
Druid.TopNMetricSpec
— TypeTopNMetricSpec
Supertype of all topN metric specs.
Druid.TrueF
— TypeTrueF()
Filter everything.
Druid.Unioned
— TypeUnioned(names::Vector{String})
Union of table datasources.
Druid.UpperEF
— TypeUpperEF(; locale=nothing)
Extract strings as upper case.
locale should be a String if provided.
Druid.VirtualColumn
— TypeVirtualColumn
Supertype of all virtual columns.
Druid.execute
— Functionexecute(client, query::Sql; names=:auto)
Executes the Druid SQL query
on the client::Client
. Returns the query results as a String. Throws exception if query execution fails.
A Vector{Symbol} can be provided for the column names through names
.
Examples
julia> query = Sql("SELECT * FROM some_datasource LIMIT 10")
julia> execute(client, query)
"[...\n]"
julia> query = Sql("SELECT * FROM non_existent_datasource")
julia> execute(client, query)
ERROR: Druid error during query execution
Dict{String,Any}("errorClass" => "org.apache.calcite.tools.ValidationException"...
Druid.execute
— Methodexecute(client, query; pretty=false)
Executes the native Druid query
on the client::Client
. Returns the query results as a String. Throws exception if query execution fails.
Druid.non_nothing_dict
— MethodConvert a structure into a Dict but only with the properties with non-nothing values.