|
67 | 67 | ;; ============================================================================= |
68 | 68 |
|
69 | 69 | (def agg-op-set |
70 | | - "All recognized aggregate operators." |
| 70 | + "All recognized aggregate operators (keywords only). |
| 71 | + Symbol forms (e.g. 'sum) are normalized to keywords by the query engine before dispatch." |
71 | 72 | #{:sum :count :count-non-null :avg :min :max :stddev :stddev-pop :variance :variance-pop :corr |
72 | | - :sum-product :count-distinct :median :percentile :approx-quantile |
73 | | - 'sum 'count 'count-non-null 'avg 'min 'max 'stddev 'stddev-pop 'variance 'variance-pop 'corr |
74 | | - 'sum-product 'count-distinct 'median 'percentile 'approx-quantile}) |
| 73 | + :sum-product :count-distinct :median :percentile :approx-quantile}) |
75 | 74 |
|
76 | 75 | (def pred-op-set |
77 | | - "All recognized predicate operators." |
| 76 | + "All recognized predicate operators (keywords only). |
| 77 | + Symbol forms (e.g. '< '=) are normalized to keywords by the query engine before dispatch." |
78 | 78 | #{:< :> :<= :>= := :!= :not= :between :range :not-range |
79 | 79 | :like :not-like :ilike :not-ilike :contains :starts-with :ends-with |
80 | | - :in :not-in :is-null :is-not-null :or :and :not |
81 | | - '< '> '<= '>= '= 'not= 'between 'range |
82 | | - 'like 'in 'not-in 'ilike 'not-ilike 'is-null 'is-not-null 'or 'and 'not}) |
| 80 | + :in :not-in :is-null :is-not-null :or :and :not}) |
83 | 81 |
|
84 | 82 | (def expr-op-set |
85 | | - "All recognized expression operators." |
| 83 | + "All recognized expression operators (keywords only). |
| 84 | + Symbol forms are normalized to keywords by the query engine before dispatch." |
86 | 85 | #{:+ :- :* :/ :mod :% :abs :sqrt :log :ln :log10 :exp :pow |
87 | 86 | :round :floor :ceil :sign :signum |
88 | 87 | :year :month :day :hour :minute :second :day-of-week :week-of-year |
89 | 88 | :date-trunc :date-add :date-diff :epoch-days :epoch-seconds |
90 | 89 | :coalesce :nullif :greatest :least :lower :upper :substr :length :trim :replace :concat |
91 | | - :cast :case |
92 | | - '+ '- '* '/ 'abs 'sqrt 'round 'cast}) |
| 90 | + :cast :case}) |
93 | 91 |
|
94 | 92 | (def SExpr |
95 | 93 | "Column reference, literal, or expression vector. |
|
123 | 121 | (str "aggregate must start with a known operator: " |
124 | 122 | ":sum :count :count-non-null :avg :min :max :stddev :stddev-pop :variance :variance-pop :corr " |
125 | 123 | ":count-distinct :median :percentile :approx-quantile :as")} |
126 | | - #(contains? (conj agg-op-set :as 'as) (first %))]]) |
| 124 | + #(let [op (first %) |
| 125 | + kw (if (symbol? op) (keyword (name op)) op)] |
| 126 | + (contains? (conj agg-op-set :as) kw))]]) |
127 | 127 |
|
128 | 128 | ;; ============================================================================= |
129 | 129 | ;; Predicate Specifications |
|
146 | 146 | (str "predicate must start with an operator: " |
147 | 147 | ":< :> :<= :>= := :!= :between :in :not-in " |
148 | 148 | ":like :ilike :is-null :is-not-null :or :and :not")} |
149 | | - #(let [op (first %)] |
150 | | - (or (contains? pred-op-set op) |
| 149 | + #(let [op (first %) |
| 150 | + kw (if (symbol? op) (keyword (name op)) op)] |
| 151 | + (or (contains? pred-op-set kw) |
151 | 152 | ;; Also allow expression predicates: [:< [:* :a :b] 100] |
152 | | - (contains? expr-op-set op)))]]) |
| 153 | + (contains? expr-op-set kw)))]]) |
153 | 154 |
|
154 | 155 | ;; ============================================================================= |
155 | 156 | ;; Query Types |
|
0 commit comments