Last active
January 20, 2017 15:07
-
-
Save hospadar/d51a67c7aead36bd2779cb0b51bd59da to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(def operators [= < > <= >= not= + - * / mod and or not]) | |
(def functions [filter select]) | |
;not yet | |
;(def more_functions [select-distinct inner-join left-join group-by aggregate]) | |
;not yet | |
;(def agg_func [min max sum count ]) | |
;not yet | |
;(def window_func [row_number rank dense_rank percent_rank cume_dist ntile lag lead first_value last_value nth_value]) | |
;not yet | |
;(def tagged_types [timestamp]) | |
;not yet | |
;(def complex_funcs [explode array_contains posexplode map_keys map_values size sort_array]) | |
;(def data_funcs [to_unixtime from_unixtime]) | |
;map-only select example | |
(select | |
;fields use placeholder as namespace | |
[[:t1/f1 :alias_name_for_f1] | |
:t1/f2 | |
(+ 1 :t1/f2)] | |
(filter | |
(> :t1/f2 5) | |
;Transform has placeholder to schema type | |
;When transform is actually called actual schema types will be provided | |
:t1)) | |
;potential more complex examples | |
(select | |
;select only has access to the fields output byt agg and the fields in the group-by | |
[:t1/f1 | |
;aliased fields inherit the namespace of their parent | |
:t1/max_f2] | |
;agg has access to fields in the group by AND fields in the base table | |
(agg | |
[[(max :t1/f2) :max_f2] | |
(group-by | |
[:t1/f1] | |
:t1))) | |
;join with subjoin | |
(select | |
[:t1/f1 | |
:t2/f2 | |
:t3/f3] | |
(left-join | |
(= :t1/id :t2/id) | |
[:t2 | |
;this subquery not aliased, it's fields will percolate upwards maybe? | |
(join | |
;'on' clause | |
(= :t1/id:t3/id) | |
[:t1 | |
;subquery is aliased to new table name, although it doesn't have to be maybe? | |
[(join | |
(= :t4/id :t5/id) | |
[:t4 :t5])) | |
:t3]])])) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment