@@ -142,21 +142,19 @@ defmodule Panoramix.Query do
142
142
143
143
_ ->
144
144
# Are we creating a new query from scratch, given some kind of datasource?
145
- % Panoramix.Query { data_source: Panoramix.Query . datasource ( source ) }
145
+ % Panoramix.Query { data_source: source }
146
146
end
147
147
148
148
Map . merge ( query , Map . new ( query_fields ) )
149
149
end
150
150
end
151
151
152
- @ doc nil
153
- # exported only so that the `from` macro can call it.
154
- def datasource ( datasource ) when is_binary ( datasource ) do
152
+ defp datasource ( datasource ) when is_binary ( datasource ) do
155
153
# We're using a named datasource as the source for the query
156
154
datasource
157
155
end
158
156
159
- def datasource ( % { type: :query , query: nested_query } = datasource ) do
157
+ defp datasource ( % { type: :query , query: nested_query } = datasource ) do
160
158
# The datasource is a nested query. Let's convert it to JSON if needed
161
159
nested_query_json =
162
160
case nested_query do
@@ -171,7 +169,7 @@ defmodule Panoramix.Query do
171
169
% { datasource | query: nested_query_json }
172
170
end
173
171
174
- def datasource ( % { type: :join , left: left , right: right } = datasource ) do
172
+ defp datasource ( % { type: :join , left: left , right: right } = datasource ) do
175
173
# A join between two datasources.
176
174
# A named datasource and a recursive join can only appear on the
177
175
# left side, but let's let Druid enforce that.
@@ -180,7 +178,7 @@ defmodule Panoramix.Query do
180
178
% { datasource | left: left_datasource , right: right_datasource }
181
179
end
182
180
183
- def datasource ( % { type: type } = datasource ) when is_atom ( type ) do
181
+ defp datasource ( % { type: type } = datasource ) when is_atom ( type ) do
184
182
# Some other type of datasource. Let's include it literally.
185
183
datasource
186
184
end
@@ -852,7 +850,7 @@ defmodule Panoramix.Query do
852
850
analysisTypes: query . analysis_types ,
853
851
bound: query . bound ,
854
852
context: query . context ,
855
- dataSource: query . data_source ,
853
+ dataSource: datasource ( query . data_source ) ,
856
854
dimension: query . dimension ,
857
855
dimensions: query . dimensions ,
858
856
filter: query . filter ,
0 commit comments