@quillsql/react 2.13.52 → 2.14.0

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.
Files changed (33) hide show
  1. package/dist/cjs/ChartBuilder.d.ts.map +1 -1
  2. package/dist/cjs/ChartBuilder.js +11 -5
  3. package/dist/cjs/Context.d.ts +3 -0
  4. package/dist/cjs/Context.d.ts.map +1 -1
  5. package/dist/cjs/Context.js +67 -44
  6. package/dist/cjs/Dashboard.d.ts +1 -1
  7. package/dist/cjs/Dashboard.d.ts.map +1 -1
  8. package/dist/cjs/Dashboard.js +37 -15
  9. package/dist/cjs/QuillProvider.d.ts +9 -5
  10. package/dist/cjs/QuillProvider.d.ts.map +1 -1
  11. package/dist/cjs/utils/astFilterProcessing.d.ts.map +1 -1
  12. package/dist/cjs/utils/astFilterProcessing.js +681 -122
  13. package/dist/cjs/utils/columnProcessing.d.ts.map +1 -1
  14. package/dist/cjs/utils/columnProcessing.js +1 -0
  15. package/dist/cjs/utils/queryConstructor.d.ts.map +1 -1
  16. package/dist/cjs/utils/queryConstructor.js +28 -0
  17. package/dist/esm/ChartBuilder.d.ts.map +1 -1
  18. package/dist/esm/ChartBuilder.js +11 -5
  19. package/dist/esm/Context.d.ts +3 -0
  20. package/dist/esm/Context.d.ts.map +1 -1
  21. package/dist/esm/Context.js +67 -44
  22. package/dist/esm/Dashboard.d.ts +1 -1
  23. package/dist/esm/Dashboard.d.ts.map +1 -1
  24. package/dist/esm/Dashboard.js +37 -15
  25. package/dist/esm/QuillProvider.d.ts +9 -5
  26. package/dist/esm/QuillProvider.d.ts.map +1 -1
  27. package/dist/esm/utils/astFilterProcessing.d.ts.map +1 -1
  28. package/dist/esm/utils/astFilterProcessing.js +681 -122
  29. package/dist/esm/utils/columnProcessing.d.ts.map +1 -1
  30. package/dist/esm/utils/columnProcessing.js +1 -0
  31. package/dist/esm/utils/queryConstructor.d.ts.map +1 -1
  32. package/dist/esm/utils/queryConstructor.js +28 -0
  33. package/package.json +1 -1
@@ -3137,6 +3137,109 @@ const queryPatterns = [
3137
3137
  },
3138
3138
  },
3139
3139
  ],
3140
+ // TODO: Add databricks
3141
+ // using postgresql cases for now
3142
+ databricks: [
3143
+ {
3144
+ query: `
3145
+ SELECT *
3146
+ FROM transactions
3147
+ WHERE transaction_date >= CURRENT_DATE - INTERVAL '30 months'
3148
+ `,
3149
+ value: function (astWhere) {
3150
+ const value = astWhere.right?.right?.expr?.value ?? null;
3151
+ if (astWhere.right?.right?.expr?.type !== 'number') {
3152
+ return value ? Number(value.split(' ')[0]) : null;
3153
+ }
3154
+ else {
3155
+ return value;
3156
+ }
3157
+ },
3158
+ unit: function (astWhere) {
3159
+ const unit = astWhere.right?.right?.unit ?? null;
3160
+ if (unit === '') {
3161
+ return stripTimeS(astWhere.right?.right?.expr?.value?.split(' ')[1]);
3162
+ }
3163
+ else {
3164
+ return unit;
3165
+ }
3166
+ },
3167
+ ast: {
3168
+ with: null,
3169
+ type: 'select',
3170
+ options: null,
3171
+ distinct: {
3172
+ type: null,
3173
+ },
3174
+ columns: [
3175
+ {
3176
+ expr: {
3177
+ type: 'column_ref',
3178
+ table: null,
3179
+ column: '*',
3180
+ },
3181
+ as: null,
3182
+ },
3183
+ ],
3184
+ into: {
3185
+ position: null,
3186
+ },
3187
+ from: [
3188
+ {
3189
+ db: null,
3190
+ table: 'transactions',
3191
+ as: null,
3192
+ },
3193
+ ],
3194
+ where: {
3195
+ type: 'binary_expr',
3196
+ operator: '>=',
3197
+ left: {
3198
+ type: 'column_ref',
3199
+ table: null,
3200
+ column: {
3201
+ expr: {
3202
+ type: 'default',
3203
+ value: 'transaction_date',
3204
+ },
3205
+ },
3206
+ },
3207
+ right: {
3208
+ type: 'binary_expr',
3209
+ operator: '-',
3210
+ left: {
3211
+ type: 'function',
3212
+ name: {
3213
+ name: [
3214
+ {
3215
+ type: 'origin',
3216
+ value: 'CURRENT_DATE',
3217
+ },
3218
+ ],
3219
+ },
3220
+ over: null,
3221
+ },
3222
+ right: {
3223
+ type: 'interval',
3224
+ expr: {
3225
+ type: 'single_quote_string',
3226
+ value: '30 months',
3227
+ },
3228
+ unit: '',
3229
+ },
3230
+ },
3231
+ },
3232
+ groupby: null,
3233
+ having: null,
3234
+ orderby: null,
3235
+ limit: {
3236
+ seperator: '',
3237
+ value: [],
3238
+ },
3239
+ window: null,
3240
+ },
3241
+ },
3242
+ ],
3140
3243
  },
3141
3244
  },
3142
3245
  {
@@ -6190,56 +6293,19 @@ const queryPatterns = [
6190
6293
  },
6191
6294
  },
6192
6295
  ],
6193
- },
6194
- },
6195
- {
6196
- operator: DateOperator.InThePrevious,
6197
- patterns: {
6198
- redshift: [
6296
+ // TODO: Add databricks
6297
+ // using postgresql cases for now
6298
+ databricks: [
6199
6299
  {
6200
6300
  query: `
6201
- SELECT * FROM transactions
6202
- WHERE transaction_date >= DATEADD(day, -180, CURRENT_DATE)
6203
- AND transaction_date < DATEADD(day, -90, CURRENT_DATE)
6301
+ SELECT * FROM transactions
6302
+ WHERE DATE_TRUNC('month', transaction_date) = DATE_TRUNC('month', CURRENT_DATE)
6204
6303
  `,
6205
- value: function (astWhere) {
6206
- if (astWhere.right.operator === 'AND') {
6207
- // Avoid AND chains
6208
- return -1;
6209
- }
6210
- const operatorLeft = astWhere.left.operator;
6211
- const operatorRight = astWhere.right.operator;
6212
- const valueLeft = -astWhere.left.right?.args?.value[1]?.value;
6213
- const valueRight = -astWhere.right.right?.args?.value[1]?.value;
6214
- if (!valueLeft || !valueRight) {
6215
- return null;
6216
- }
6217
- if (operatorLeft === '>=' &&
6218
- operatorRight === '<' &&
6219
- valueLeft == valueRight * 2) {
6220
- return valueRight;
6221
- }
6222
- else if (operatorLeft === '<' &&
6223
- operatorRight === '>=' &&
6224
- valueLeft * 2 == valueRight) {
6225
- return valueLeft;
6226
- }
6227
- else {
6228
- const unitLeft = astWhere.left?.right?.args?.value[0]?.column?.expr?.value ??
6229
- null;
6230
- const unitRight = astWhere.right?.right?.args?.value[0]?.column?.expr?.value ??
6231
- null;
6232
- return parseStartEndDate(operatorLeft, operatorRight, valueLeft, valueRight, stripTimeS(unitLeft.toLowerCase()), stripTimeS(unitRight.toLowerCase()));
6233
- }
6304
+ value: function () {
6305
+ return 0;
6234
6306
  },
6235
6307
  unit: function (astWhere) {
6236
- const unitLeft = astWhere.left?.right?.args?.value[0]?.column?.expr?.value ?? null;
6237
- const unitRight = astWhere.right?.right?.args?.value[0]?.column?.expr?.value ??
6238
- null;
6239
- return stripTimeS(unitLeft.toLowerCase()) ===
6240
- stripTimeS(unitRight.toLowerCase())
6241
- ? stripTimeS(unitLeft.toLowerCase())
6242
- : null;
6308
+ return astWhere.left?.args?.value[0]?.value ?? null;
6243
6309
  },
6244
6310
  ast: {
6245
6311
  with: null,
@@ -6270,95 +6336,408 @@ const queryPatterns = [
6270
6336
  ],
6271
6337
  where: {
6272
6338
  type: 'binary_expr',
6273
- operator: 'AND',
6339
+ operator: '=',
6274
6340
  left: {
6275
- type: 'binary_expr',
6276
- operator: '>=',
6277
- left: {
6278
- type: 'column_ref',
6279
- table: null,
6280
- column: {
6281
- expr: {
6341
+ type: 'function',
6342
+ name: {
6343
+ name: [
6344
+ {
6282
6345
  type: 'default',
6283
- value: 'transaction_date',
6346
+ value: 'DATE_TRUNC',
6284
6347
  },
6285
- },
6348
+ ],
6286
6349
  },
6287
- right: {
6288
- type: 'function',
6289
- name: {
6290
- name: [
6291
- {
6292
- type: 'default',
6293
- value: 'DATEADD',
6294
- },
6295
- ],
6296
- },
6297
- args: {
6298
- type: 'expr_list',
6299
- value: [
6300
- {
6301
- type: 'column_ref',
6302
- table: null,
6303
- column: {
6304
- expr: {
6305
- type: 'default',
6306
- value: 'day',
6307
- },
6308
- },
6309
- },
6310
- {
6311
- type: 'number',
6312
- value: -180,
6313
- },
6314
- {
6315
- type: 'function',
6316
- name: {
6317
- name: [
6318
- {
6319
- type: 'origin',
6320
- value: 'CURRENT_DATE',
6321
- },
6322
- ],
6350
+ args: {
6351
+ type: 'expr_list',
6352
+ value: [
6353
+ {
6354
+ type: 'single_quote_string',
6355
+ value: 'month',
6356
+ },
6357
+ {
6358
+ type: 'column_ref',
6359
+ table: null,
6360
+ column: {
6361
+ expr: {
6362
+ type: 'default',
6363
+ value: 'transaction_date',
6323
6364
  },
6324
- over: null,
6325
6365
  },
6326
- ],
6327
- },
6366
+ },
6367
+ ],
6328
6368
  },
6329
6369
  },
6330
6370
  right: {
6331
- type: 'binary_expr',
6332
- operator: '<',
6333
- left: {
6334
- type: 'column_ref',
6335
- table: null,
6336
- column: {
6337
- expr: {
6371
+ type: 'function',
6372
+ name: {
6373
+ name: [
6374
+ {
6338
6375
  type: 'default',
6339
- value: 'transaction_date',
6376
+ value: 'DATE_TRUNC',
6340
6377
  },
6341
- },
6378
+ ],
6342
6379
  },
6343
- right: {
6344
- type: 'function',
6345
- name: {
6346
- name: [
6347
- {
6348
- type: 'default',
6349
- value: 'DATEADD',
6350
- },
6351
- ],
6352
- },
6353
- args: {
6354
- type: 'expr_list',
6355
- value: [
6356
- {
6357
- type: 'column_ref',
6358
- table: null,
6359
- column: {
6360
- expr: {
6361
- type: 'default',
6380
+ args: {
6381
+ type: 'expr_list',
6382
+ value: [
6383
+ {
6384
+ type: 'single_quote_string',
6385
+ value: 'month',
6386
+ },
6387
+ {
6388
+ type: 'function',
6389
+ name: {
6390
+ name: [
6391
+ {
6392
+ type: 'origin',
6393
+ value: 'CURRENT_DATE',
6394
+ },
6395
+ ],
6396
+ },
6397
+ over: null,
6398
+ },
6399
+ ],
6400
+ },
6401
+ },
6402
+ },
6403
+ groupby: null,
6404
+ having: null,
6405
+ orderby: null,
6406
+ limit: {
6407
+ seperator: '',
6408
+ value: [],
6409
+ },
6410
+ window: null,
6411
+ },
6412
+ },
6413
+ {
6414
+ query: `
6415
+ SELECT * FROM transactions
6416
+ WHERE created_at >= date_trunc('month', CURRENT_DATE)
6417
+ AND created_at < (date_trunc('month', CURRENT_DATE) + INTERVAL '1 month')
6418
+ `,
6419
+ value: function () {
6420
+ return 0;
6421
+ },
6422
+ unit: function (astWhere) {
6423
+ return astWhere.left?.right?.args?.value[0]?.value ?? null;
6424
+ },
6425
+ ast: {
6426
+ with: null,
6427
+ type: 'select',
6428
+ options: null,
6429
+ distinct: {
6430
+ type: null,
6431
+ },
6432
+ columns: [
6433
+ {
6434
+ expr: {
6435
+ type: 'column_ref',
6436
+ table: null,
6437
+ column: '*',
6438
+ },
6439
+ as: null,
6440
+ },
6441
+ ],
6442
+ into: {
6443
+ position: null,
6444
+ },
6445
+ from: [
6446
+ {
6447
+ db: null,
6448
+ table: 'transactions',
6449
+ as: null,
6450
+ },
6451
+ ],
6452
+ where: {
6453
+ type: 'binary_expr',
6454
+ operator: 'AND',
6455
+ left: {
6456
+ type: 'binary_expr',
6457
+ operator: '>=',
6458
+ left: {
6459
+ type: 'column_ref',
6460
+ table: null,
6461
+ column: {
6462
+ expr: {
6463
+ type: 'default',
6464
+ value: 'created_at',
6465
+ },
6466
+ },
6467
+ },
6468
+ right: {
6469
+ type: 'function',
6470
+ name: {
6471
+ name: [
6472
+ {
6473
+ type: 'default',
6474
+ value: 'date_trunc',
6475
+ },
6476
+ ],
6477
+ },
6478
+ args: {
6479
+ type: 'expr_list',
6480
+ value: [
6481
+ {
6482
+ type: 'single_quote_string',
6483
+ value: 'month',
6484
+ },
6485
+ {
6486
+ type: 'function',
6487
+ name: {
6488
+ name: [
6489
+ {
6490
+ type: 'origin',
6491
+ value: 'CURRENT_DATE',
6492
+ },
6493
+ ],
6494
+ },
6495
+ over: null,
6496
+ },
6497
+ ],
6498
+ },
6499
+ },
6500
+ },
6501
+ right: {
6502
+ type: 'binary_expr',
6503
+ operator: '<',
6504
+ left: {
6505
+ type: 'column_ref',
6506
+ table: null,
6507
+ column: {
6508
+ expr: {
6509
+ type: 'default',
6510
+ value: 'created_at',
6511
+ },
6512
+ },
6513
+ },
6514
+ right: {
6515
+ type: 'binary_expr',
6516
+ operator: '+',
6517
+ left: {
6518
+ type: 'function',
6519
+ name: {
6520
+ name: [
6521
+ {
6522
+ type: 'default',
6523
+ value: 'date_trunc',
6524
+ },
6525
+ ],
6526
+ },
6527
+ args: {
6528
+ type: 'expr_list',
6529
+ value: [
6530
+ {
6531
+ type: 'single_quote_string',
6532
+ value: 'month',
6533
+ },
6534
+ {
6535
+ type: 'function',
6536
+ name: {
6537
+ name: [
6538
+ {
6539
+ type: 'origin',
6540
+ value: 'CURRENT_DATE',
6541
+ },
6542
+ ],
6543
+ },
6544
+ over: null,
6545
+ },
6546
+ ],
6547
+ },
6548
+ },
6549
+ right: {
6550
+ type: 'interval',
6551
+ expr: {
6552
+ type: 'single_quote_string',
6553
+ value: '1 month',
6554
+ },
6555
+ unit: '',
6556
+ },
6557
+ parentheses: true,
6558
+ },
6559
+ },
6560
+ },
6561
+ groupby: null,
6562
+ having: null,
6563
+ orderby: null,
6564
+ limit: {
6565
+ seperator: '',
6566
+ value: [],
6567
+ },
6568
+ window: null,
6569
+ },
6570
+ },
6571
+ ],
6572
+ },
6573
+ },
6574
+ {
6575
+ operator: DateOperator.InThePrevious,
6576
+ patterns: {
6577
+ redshift: [
6578
+ {
6579
+ query: `
6580
+ SELECT * FROM transactions
6581
+ WHERE transaction_date >= DATEADD(day, -180, CURRENT_DATE)
6582
+ AND transaction_date < DATEADD(day, -90, CURRENT_DATE)
6583
+ `,
6584
+ value: function (astWhere) {
6585
+ if (astWhere.right.operator === 'AND') {
6586
+ // Avoid AND chains
6587
+ return -1;
6588
+ }
6589
+ const operatorLeft = astWhere.left.operator;
6590
+ const operatorRight = astWhere.right.operator;
6591
+ const valueLeft = -astWhere.left.right?.args?.value[1]?.value;
6592
+ const valueRight = -astWhere.right.right?.args?.value[1]?.value;
6593
+ if (!valueLeft || !valueRight) {
6594
+ return null;
6595
+ }
6596
+ if (operatorLeft === '>=' &&
6597
+ operatorRight === '<' &&
6598
+ valueLeft == valueRight * 2) {
6599
+ return valueRight;
6600
+ }
6601
+ else if (operatorLeft === '<' &&
6602
+ operatorRight === '>=' &&
6603
+ valueLeft * 2 == valueRight) {
6604
+ return valueLeft;
6605
+ }
6606
+ else {
6607
+ const unitLeft = astWhere.left?.right?.args?.value[0]?.column?.expr?.value ??
6608
+ null;
6609
+ const unitRight = astWhere.right?.right?.args?.value[0]?.column?.expr?.value ??
6610
+ null;
6611
+ return parseStartEndDate(operatorLeft, operatorRight, valueLeft, valueRight, stripTimeS(unitLeft.toLowerCase()), stripTimeS(unitRight.toLowerCase()));
6612
+ }
6613
+ },
6614
+ unit: function (astWhere) {
6615
+ const unitLeft = astWhere.left?.right?.args?.value[0]?.column?.expr?.value ?? null;
6616
+ const unitRight = astWhere.right?.right?.args?.value[0]?.column?.expr?.value ??
6617
+ null;
6618
+ return stripTimeS(unitLeft.toLowerCase()) ===
6619
+ stripTimeS(unitRight.toLowerCase())
6620
+ ? stripTimeS(unitLeft.toLowerCase())
6621
+ : null;
6622
+ },
6623
+ ast: {
6624
+ with: null,
6625
+ type: 'select',
6626
+ options: null,
6627
+ distinct: {
6628
+ type: null,
6629
+ },
6630
+ columns: [
6631
+ {
6632
+ expr: {
6633
+ type: 'column_ref',
6634
+ table: null,
6635
+ column: '*',
6636
+ },
6637
+ as: null,
6638
+ },
6639
+ ],
6640
+ into: {
6641
+ position: null,
6642
+ },
6643
+ from: [
6644
+ {
6645
+ db: null,
6646
+ table: 'transactions',
6647
+ as: null,
6648
+ },
6649
+ ],
6650
+ where: {
6651
+ type: 'binary_expr',
6652
+ operator: 'AND',
6653
+ left: {
6654
+ type: 'binary_expr',
6655
+ operator: '>=',
6656
+ left: {
6657
+ type: 'column_ref',
6658
+ table: null,
6659
+ column: {
6660
+ expr: {
6661
+ type: 'default',
6662
+ value: 'transaction_date',
6663
+ },
6664
+ },
6665
+ },
6666
+ right: {
6667
+ type: 'function',
6668
+ name: {
6669
+ name: [
6670
+ {
6671
+ type: 'default',
6672
+ value: 'DATEADD',
6673
+ },
6674
+ ],
6675
+ },
6676
+ args: {
6677
+ type: 'expr_list',
6678
+ value: [
6679
+ {
6680
+ type: 'column_ref',
6681
+ table: null,
6682
+ column: {
6683
+ expr: {
6684
+ type: 'default',
6685
+ value: 'day',
6686
+ },
6687
+ },
6688
+ },
6689
+ {
6690
+ type: 'number',
6691
+ value: -180,
6692
+ },
6693
+ {
6694
+ type: 'function',
6695
+ name: {
6696
+ name: [
6697
+ {
6698
+ type: 'origin',
6699
+ value: 'CURRENT_DATE',
6700
+ },
6701
+ ],
6702
+ },
6703
+ over: null,
6704
+ },
6705
+ ],
6706
+ },
6707
+ },
6708
+ },
6709
+ right: {
6710
+ type: 'binary_expr',
6711
+ operator: '<',
6712
+ left: {
6713
+ type: 'column_ref',
6714
+ table: null,
6715
+ column: {
6716
+ expr: {
6717
+ type: 'default',
6718
+ value: 'transaction_date',
6719
+ },
6720
+ },
6721
+ },
6722
+ right: {
6723
+ type: 'function',
6724
+ name: {
6725
+ name: [
6726
+ {
6727
+ type: 'default',
6728
+ value: 'DATEADD',
6729
+ },
6730
+ ],
6731
+ },
6732
+ args: {
6733
+ type: 'expr_list',
6734
+ value: [
6735
+ {
6736
+ type: 'column_ref',
6737
+ table: null,
6738
+ column: {
6739
+ expr: {
6740
+ type: 'default',
6362
6741
  value: 'day',
6363
6742
  },
6364
6743
  },
@@ -8257,6 +8636,181 @@ const queryPatterns = [
8257
8636
  },
8258
8637
  },
8259
8638
  ],
8639
+ // TODO: Add databricks
8640
+ // using postgresql cases for now
8641
+ databricks: [
8642
+ {
8643
+ query: `
8644
+ SELECT * FROM transactions
8645
+ WHERE transaction_date >= CURRENT_DATE - INTERVAL '2 month'
8646
+ AND transaction_date < CURRENT_DATE - INTERVAL '1 month'
8647
+ `,
8648
+ value: function (astWhere) {
8649
+ if (astWhere.right.operator === 'AND') {
8650
+ // Avoid AND chains
8651
+ return -1;
8652
+ }
8653
+ const operatorLeft = astWhere.left.operator;
8654
+ const operatorRight = astWhere.right.operator;
8655
+ const valueLeft = astWhere.left.right?.right?.expr?.type === 'number'
8656
+ ? astWhere.left.right?.right?.expr?.value
8657
+ : Number(astWhere.left.right?.right?.expr?.value?.split(' ')[0]);
8658
+ const valueRight = astWhere.right.right?.right?.expr?.type === 'number'
8659
+ ? astWhere.right.right?.right?.expr?.value
8660
+ : Number(astWhere.right.right?.right?.expr?.value?.split(' ')[0]);
8661
+ if (!valueLeft || !valueRight) {
8662
+ return null;
8663
+ }
8664
+ if (operatorLeft === '>=' &&
8665
+ operatorRight === '<' &&
8666
+ valueLeft == valueRight * 2) {
8667
+ return valueRight;
8668
+ }
8669
+ else if (operatorLeft === '<' &&
8670
+ operatorRight === '>=' &&
8671
+ valueLeft * 2 == valueRight) {
8672
+ return valueLeft;
8673
+ }
8674
+ else {
8675
+ const unitLeft = astWhere.left?.right?.right?.unit === ''
8676
+ ? stripTimeS(astWhere.left.right?.right?.expr?.value?.split(' ')[1])
8677
+ : stripTimeS(astWhere.left?.right?.right?.unit);
8678
+ const unitRight = astWhere.right?.right?.right?.unit === ''
8679
+ ? stripTimeS(astWhere.right.right?.right?.expr?.value?.split(' ')[1])
8680
+ : stripTimeS(astWhere.right?.right?.right?.unit);
8681
+ return parseStartEndDate(operatorLeft, operatorRight, valueLeft, valueRight, stripTimeS(unitLeft.toLowerCase()), stripTimeS(unitRight.toLowerCase()));
8682
+ }
8683
+ },
8684
+ unit: function (astWhere) {
8685
+ const unitLeft = astWhere.left?.right?.right?.unit === ''
8686
+ ? stripTimeS(astWhere.left.right?.right?.expr?.value?.split(' ')[1])
8687
+ : stripTimeS(astWhere.left?.right?.right?.unit);
8688
+ const unitRight = astWhere.right?.right?.right?.unit === ''
8689
+ ? stripTimeS(astWhere.right.right?.right?.expr?.value?.split(' ')[1])
8690
+ : stripTimeS(astWhere.right?.right?.right?.unit);
8691
+ return stripTimeS(unitLeft.toLowerCase()) ===
8692
+ stripTimeS(unitRight.toLowerCase())
8693
+ ? stripTimeS(unitLeft.toLowerCase())
8694
+ : null;
8695
+ },
8696
+ ast: {
8697
+ with: null,
8698
+ type: 'select',
8699
+ options: null,
8700
+ distinct: {
8701
+ type: null,
8702
+ },
8703
+ columns: [
8704
+ {
8705
+ expr: {
8706
+ type: 'column_ref',
8707
+ table: null,
8708
+ column: '*',
8709
+ },
8710
+ as: null,
8711
+ },
8712
+ ],
8713
+ into: {
8714
+ position: null,
8715
+ },
8716
+ from: [
8717
+ {
8718
+ db: null,
8719
+ table: 'transactions',
8720
+ as: null,
8721
+ },
8722
+ ],
8723
+ where: {
8724
+ type: 'binary_expr',
8725
+ operator: 'AND',
8726
+ left: {
8727
+ type: 'binary_expr',
8728
+ operator: '>=',
8729
+ left: {
8730
+ type: 'column_ref',
8731
+ table: null,
8732
+ column: {
8733
+ expr: {
8734
+ type: 'default',
8735
+ value: 'transaction_date',
8736
+ },
8737
+ },
8738
+ },
8739
+ right: {
8740
+ type: 'binary_expr',
8741
+ operator: '-',
8742
+ left: {
8743
+ type: 'function',
8744
+ name: {
8745
+ name: [
8746
+ {
8747
+ type: 'origin',
8748
+ value: 'CURRENT_DATE',
8749
+ },
8750
+ ],
8751
+ },
8752
+ over: null,
8753
+ },
8754
+ right: {
8755
+ type: 'interval',
8756
+ expr: {
8757
+ type: 'single_quote_string',
8758
+ value: '2 month',
8759
+ },
8760
+ unit: '',
8761
+ },
8762
+ },
8763
+ },
8764
+ right: {
8765
+ type: 'binary_expr',
8766
+ operator: '<',
8767
+ left: {
8768
+ type: 'column_ref',
8769
+ table: null,
8770
+ column: {
8771
+ expr: {
8772
+ type: 'default',
8773
+ value: 'transaction_date',
8774
+ },
8775
+ },
8776
+ },
8777
+ right: {
8778
+ type: 'binary_expr',
8779
+ operator: '-',
8780
+ left: {
8781
+ type: 'function',
8782
+ name: {
8783
+ name: [
8784
+ {
8785
+ type: 'origin',
8786
+ value: 'CURRENT_DATE',
8787
+ },
8788
+ ],
8789
+ },
8790
+ over: null,
8791
+ },
8792
+ right: {
8793
+ type: 'interval',
8794
+ expr: {
8795
+ type: 'single_quote_string',
8796
+ value: '1 month',
8797
+ },
8798
+ unit: '',
8799
+ },
8800
+ },
8801
+ },
8802
+ },
8803
+ groupby: null,
8804
+ having: null,
8805
+ orderby: null,
8806
+ limit: {
8807
+ seperator: '',
8808
+ value: [],
8809
+ },
8810
+ window: null,
8811
+ },
8812
+ },
8813
+ ],
8260
8814
  },
8261
8815
  },
8262
8816
  ];
@@ -8493,6 +9047,7 @@ function fieldColumnToLowerCaseAst(field, db, isColumnRef, table) {
8493
9047
  };
8494
9048
  case 'postgresql':
8495
9049
  case 'clickhouse':
9050
+ case 'databricks':
8496
9051
  default:
8497
9052
  return {
8498
9053
  type: 'function',
@@ -8551,6 +9106,7 @@ function lowerFunctionToField(lower, db) {
8551
9106
  case 'mysql':
8552
9107
  case 'postgresql':
8553
9108
  case 'clickhouse':
9109
+ case 'databricks':
8554
9110
  case 'mssql':
8555
9111
  return getFieldFromExpression(lower, db) ?? '';
8556
9112
  default:
@@ -9356,6 +9912,7 @@ export const filterToAst = (filter, db) => {
9356
9912
  },
9357
9913
  };
9358
9914
  case 'postgresql':
9915
+ case 'databricks': // TODO: check
9359
9916
  return {
9360
9917
  type: 'binary_expr',
9361
9918
  operator: '>=',
@@ -9974,6 +10531,7 @@ export const filterToAst = (filter, db) => {
9974
10531
  };
9975
10532
  }
9976
10533
  case 'postgresql':
10534
+ case 'databricks': // TODO: check
9977
10535
  return {
9978
10536
  type: 'binary_expr',
9979
10537
  operator: '=',
@@ -10699,6 +11257,7 @@ export const filterToAst = (filter, db) => {
10699
11257
  parentheses: true,
10700
11258
  };
10701
11259
  case 'postgresql':
11260
+ case 'databricks': // TODO: check
10702
11261
  return {
10703
11262
  type: 'binary_expr',
10704
11263
  operator: 'AND',