pytrilogy 0.0.3.37__py3-none-any.whl → 0.0.3.39__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of pytrilogy might be problematic. Click here for more details.

@@ -108,12 +108,12 @@
108
108
 
109
109
  // rank/lag/lead
110
110
  WINDOW_TYPE: ("row_number"i|"rank"i|"lag"i|"lead"i | "sum"i | "avg"i | "max"i | "min"i ) /[\s]+/
111
-
112
- window_item: WINDOW_TYPE int_lit? expr window_item_over? window_item_order?
113
-
111
+
114
112
  window_item_over: ("OVER"i over_list)
115
-
113
+
116
114
  window_item_order: ("ORDER"i? "BY"i order_list)
115
+
116
+ window_item: WINDOW_TYPE int_lit? expr window_item_over? window_item_order?
117
117
 
118
118
  select_hide_modifier: "--"
119
119
  select_partial_modifier: "~"
@@ -129,7 +129,7 @@
129
129
 
130
130
  limit: "LIMIT"i /[0-9]+/
131
131
 
132
- !window_order: ("TOP"i | "BOTTOM"i)
132
+ !window_order: /TOP|BOTTOM/i
133
133
 
134
134
  window: window_order /[0-9]+/
135
135
 
@@ -139,19 +139,26 @@
139
139
 
140
140
  over_list: concept_lit ("," concept_lit )* ","?
141
141
 
142
- !ordering: ("ASC"i | "DESC"i ) ("NULLS"i ("FIRST"i | "LAST"i | "AUTO"i) )?
142
+ !ordering: /ASC|DESC/i ("NULLS"i /FIRST|LAST|AUTO/i )?
143
143
 
144
144
  order_by: "ORDER"i "BY"i order_list
145
145
 
146
146
  //WHERE STATEMENT
147
+ LOGICAL_OR: "or"i
148
+ LOGICAL_AND: "and"i
147
149
 
148
- !logical_operator: "and"i | "or"i
149
-
150
- condition_parenthetical: "(" conditional ")"
150
+ conditional: _or_condition
151
151
 
152
- _condition_unit: (expr | condition_parenthetical)
152
+ _or_condition: _and_condition
153
+ | (_or_condition LOGICAL_OR _and_condition)
153
154
 
154
- conditional: _condition_unit (logical_operator _condition_unit)*
155
+ _and_condition: _condition_unit
156
+ | (_and_condition LOGICAL_AND _condition_unit)
157
+
158
+ condition_parenthetical: "(" conditional ")"
159
+
160
+ _condition_unit: expr
161
+ | condition_parenthetical
155
162
 
156
163
  where: "WHERE"i conditional
157
164
 
@@ -159,7 +166,7 @@
159
166
 
160
167
  !array_comparison: ( ("NOT"i "IN"i) | "IN"i)
161
168
 
162
- COMPARISON_OPERATOR: (/is[\s]+not/ | "is" |"=" | ">" | "<" | ">=" | "<=" | "!=")
169
+ COMPARISON_OPERATOR: /(is\s+not|is|=|>=|<=|!=|>|<)/i
163
170
 
164
171
  comparison: expr COMPARISON_OPERATOR expr
165
172
 
@@ -185,16 +192,28 @@
185
192
  attr_access: expr "." string_lit
186
193
 
187
194
 
188
- expr: _constant_functions | window_item | filter_item | subselect_comparison | between_comparison | fgroup | aggregate_functions | unnest | union | _static_functions | literal | concept_lit | index_access | map_key_access | attr_access | parenthetical | expr_tuple | comparison | alt_like | custom_function
189
-
195
+ expr: _basic_expr | _functional_expr | _operation_expr | _access_expr
196
+
197
+ # Most common/basic expressions
198
+ _basic_expr: literal | concept_lit | parenthetical | expr_tuple
199
+
200
+ # Operations and comparisons
201
+ _operation_expr: comparison | alt_like | between_comparison | subselect_comparison
202
+
203
+ # Function-like expressions
204
+ _functional_expr: _constant_functions | _static_functions | filter_item | aggregate_functions | window_item | custom_function | fgroup | unnest | union | aggregate_by
205
+
206
+ # Access patterns
207
+ _access_expr: index_access | map_key_access | attr_access
190
208
  // functions
191
209
 
192
- fadd: ("add"i "(" expr "," expr ")" ) | ( expr "+" expr )
210
+ fadd: (/add\(/ expr "," expr ")" ) | ( expr "+" expr )
193
211
  fsub: ("subtract"i "(" expr "," expr ")" ) | ( expr "-" expr )
194
212
  fmul: ("multiply"i "(" expr "," expr ")" ) | ( expr "*" expr )
195
213
  fdiv: ( "divide"i "(" expr "," expr ")") | ( expr "/" expr )
196
214
  fmod: ( "mod"i "(" expr "," (int_lit | concept_lit ) ")") | ( expr "%" (int_lit | concept_lit ) )
197
- fround: "round"i "(" expr "," expr ")"
215
+ _ROUND.1: "round"i "("
216
+ fround: _ROUND expr "," expr ")"
198
217
  fabs: "abs"i "(" expr ")"
199
218
  _SQRT.1: "sqrt("
200
219
  fsqrt: _SQRT expr ")"
@@ -250,6 +269,10 @@
250
269
  // special aggregate
251
270
  _GROUP.1: "group("i
252
271
  fgroup: _GROUP expr ")" aggregate_over?
272
+
273
+ //by:
274
+ aggregate_by: "group" IDENTIFIER "BY"i (IDENTIFIER ",")* IDENTIFIER
275
+
253
276
  //aggregates
254
277
  _COUNT.1: "count("i
255
278
  count: _COUNT expr ")"
@@ -351,9 +374,9 @@
351
374
 
352
375
  literal: null_lit | string_lit | int_lit | float_lit | bool_lit | array_lit | map_lit | struct_lit | tuple_lit
353
376
 
354
- MODIFIER: "Optional"i | "Partial"i | "Nullable"i
377
+ MODIFIER: /OPTIONAL|PARTIAL|NULLABLE/i
355
378
 
356
- SHORTHAND_MODIFIER: "~" | "?"
379
+ SHORTHAND_MODIFIER: /~|\?/
357
380
 
358
381
  struct_type: "struct"i "<" ((data_type | IDENTIFIER) ",")* (data_type | IDENTIFIER) ","? ">"
359
382
 
@@ -369,7 +392,6 @@
369
392
  PROPERTY: "property"i
370
393
  CONST: "const"i | "constant"i
371
394
  AUTO: "AUTO"i
372
-
373
395
  // meta functions
374
396
  CONCEPTS: "CONCEPTS"i
375
397
  DATASOURCES: "DATASOURCES"i