@devrev/meerkat-node 0.0.122 → 0.0.124
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.
- package/__fixtures__/test-data-with-safe-alias.js +58 -0
- package/__fixtures__/test-data-with-safe-alias.js.map +1 -1
- package/__tests__/comprehensive/helpers/test-helpers.js +214 -0
- package/__tests__/comprehensive/helpers/test-helpers.js.map +1 -0
- package/__tests__/comprehensive/synthetic/schema-setup.js +256 -0
- package/__tests__/comprehensive/synthetic/schema-setup.js.map +1 -0
- package/__tests__/comprehensive/synthetic/table-schemas.js +453 -0
- package/__tests__/comprehensive/synthetic/table-schemas.js.map +1 -0
- package/ensure-table-schema-alias/ensure-table-schema-alias.js +39 -0
- package/ensure-table-schema-alias/ensure-table-schema-alias.js.map +1 -0
- package/index.js +1 -0
- package/index.js.map +1 -1
- package/package.json +2 -2
- package/src/__fixtures__/test-data-with-safe-alias.d.ts +22 -1
- package/src/__fixtures__/test-data.d.ts +22 -1
- package/src/__tests__/comprehensive/helpers/test-helpers.d.ts +106 -0
- package/src/__tests__/comprehensive/synthetic/schema-setup.d.ts +31 -0
- package/src/__tests__/comprehensive/synthetic/table-schemas.d.ts +123 -0
- package/src/ensure-table-schema-alias/ensure-table-schema-alias.d.ts +3 -0
- package/src/index.d.ts +1 -0
|
@@ -1427,6 +1427,64 @@ const TEST_DATA_WITH_SAFE_ALIAS = [
|
|
|
1427
1427
|
}
|
|
1428
1428
|
]
|
|
1429
1429
|
}
|
|
1430
|
+
],
|
|
1431
|
+
[
|
|
1432
|
+
{
|
|
1433
|
+
testName: 'In filter with number[] values',
|
|
1434
|
+
expectedSQL: `SELECT orders.* FROM (SELECT order_id AS orders__order_id, * FROM (select * from orders) AS orders) AS orders WHERE (orders__order_id IN (1, 2, 3))`,
|
|
1435
|
+
cubeInput: {
|
|
1436
|
+
measures: [
|
|
1437
|
+
'*'
|
|
1438
|
+
],
|
|
1439
|
+
filters: [
|
|
1440
|
+
{
|
|
1441
|
+
member: 'orders.order_id',
|
|
1442
|
+
operator: 'in',
|
|
1443
|
+
values: [
|
|
1444
|
+
1,
|
|
1445
|
+
2,
|
|
1446
|
+
3
|
|
1447
|
+
]
|
|
1448
|
+
}
|
|
1449
|
+
],
|
|
1450
|
+
dimensions: []
|
|
1451
|
+
},
|
|
1452
|
+
expectedOutput: [
|
|
1453
|
+
{
|
|
1454
|
+
order_id: 1,
|
|
1455
|
+
orders__order_id: 1,
|
|
1456
|
+
customer_id: '1',
|
|
1457
|
+
product_id: '1',
|
|
1458
|
+
order_date: '2022-01-01',
|
|
1459
|
+
order_amount: 50.0,
|
|
1460
|
+
vendors: [
|
|
1461
|
+
'myntra',
|
|
1462
|
+
'amazon',
|
|
1463
|
+
'flipkart'
|
|
1464
|
+
]
|
|
1465
|
+
},
|
|
1466
|
+
{
|
|
1467
|
+
order_id: 2,
|
|
1468
|
+
orders__order_id: 2,
|
|
1469
|
+
customer_id: '1',
|
|
1470
|
+
product_id: '2',
|
|
1471
|
+
order_date: '2022-01-02',
|
|
1472
|
+
order_amount: 80.0,
|
|
1473
|
+
vendors: [
|
|
1474
|
+
'myntra'
|
|
1475
|
+
]
|
|
1476
|
+
},
|
|
1477
|
+
{
|
|
1478
|
+
order_id: 3,
|
|
1479
|
+
orders__order_id: 3,
|
|
1480
|
+
customer_id: '2',
|
|
1481
|
+
product_id: '3',
|
|
1482
|
+
order_date: '2022-02-01',
|
|
1483
|
+
order_amount: 25.0,
|
|
1484
|
+
vendors: []
|
|
1485
|
+
}
|
|
1486
|
+
]
|
|
1487
|
+
}
|
|
1430
1488
|
]
|
|
1431
1489
|
];
|
|
1432
1490
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../meerkat-node/src/__fixtures__/test-data-with-safe-alias.ts"],"sourcesContent":["export const TEST_DATA_WITH_SAFE_ALIAS = [\n [\n {\n testName: 'GroupBySQLInnerQuery',\n expectedSQL: `SELECT SUM(order_amount) AS orders__total_order_amount , orders__order_month FROM (SELECT DATE_TRUNC('month', order_date) AS orders__order_month, * FROM (select * from orders) AS orders) AS orders GROUP BY orders__order_month LIMIT 1`,\n cubeInput: {\n measures: ['orders.total_order_amount'],\n filters: [],\n dimensions: ['orders.order_month'],\n limit: 1,\n },\n expectedOutput: [\n {\n orders__order_month: '2022-01-01T00:00:00.000Z',\n orders__total_order_amount: 130,\n },\n ],\n },\n ],\n [\n {\n testName: 'GroupBy',\n expectedSQL: `SELECT SUM(order_amount) AS orders__total_order_amount , orders__customer_id FROM (SELECT customer_id AS orders__customer_id, * FROM (select * from orders) AS orders) AS orders GROUP BY orders__customer_id ORDER BY orders__total_order_amount ASC, orders__customer_id ASC`,\n cubeInput: {\n measures: ['orders.total_order_amount'],\n filters: [],\n dimensions: ['orders.customer_id'],\n order: {\n 'orders.total_order_amount': 'asc',\n 'orders.customer_id': 'asc',\n },\n },\n expectedOutput: [\n {\n orders__customer_id: '6aa6',\n orders__total_order_amount: 0,\n },\n {\n orders__customer_id: '8',\n orders__total_order_amount: 50,\n },\n {\n orders__customer_id: '2',\n orders__total_order_amount: 100,\n },\n {\n orders__customer_id: '3',\n orders__total_order_amount: 100,\n },\n {\n orders__customer_id: '7',\n orders__total_order_amount: 100,\n },\n {\n orders__customer_id: null,\n orders__total_order_amount: 100,\n },\n {\n orders__customer_id: '6',\n orders__total_order_amount: 120,\n },\n {\n orders__customer_id: '1',\n orders__total_order_amount: 130,\n },\n {\n orders__customer_id: '4',\n orders__total_order_amount: 135,\n },\n {\n orders__customer_id: '5',\n orders__total_order_amount: 150,\n },\n ],\n },\n ],\n [\n {\n testName: 'Equals',\n expectedSQL: `SELECT orders.* FROM (SELECT customer_id AS orders__customer_id, * FROM (select * from orders) AS orders) AS orders WHERE (orders__customer_id = '1')`,\n cubeInput: {\n measures: ['*'],\n filters: [\n {\n member: 'orders.customer_id',\n operator: 'equals',\n values: ['1'],\n },\n ],\n dimensions: [],\n },\n expectedOutput: [\n {\n order_id: 1,\n customer_id: '1',\n orders__customer_id: '1',\n product_id: '1',\n order_date: '2022-01-01',\n order_amount: 50.0,\n vendors: ['myntra', 'amazon', 'flipkart'],\n },\n {\n order_id: 2,\n customer_id: '1',\n orders__customer_id: '1',\n product_id: '2',\n order_date: '2022-01-02',\n order_amount: 80.0,\n vendors: ['myntra'],\n },\n ],\n },\n {\n testName: 'Equals for multiple values',\n expectedSQL: `SELECT orders.* FROM (SELECT customer_id AS orders__customer_id, * FROM (select * from orders) AS orders) AS orders WHERE ((orders__customer_id = '1') AND (orders__customer_id = '2'))`,\n cubeInput: {\n measures: ['*'],\n filters: [\n {\n member: 'orders.customer_id',\n operator: 'equals',\n values: ['1', '2'],\n },\n ],\n dimensions: [],\n },\n expectedOutput: [],\n },\n ],\n [\n {\n testName: 'NotEquals',\n expectedSQL: `SELECT orders.* FROM (SELECT customer_id AS orders__customer_id, * FROM (select * from orders) AS orders) AS orders WHERE (orders__customer_id != '1')`,\n cubeInput: {\n measures: ['*'],\n filters: [\n {\n member: 'orders.customer_id',\n operator: 'notEquals',\n values: ['1'],\n },\n ],\n dimensions: [],\n },\n expectedOutput: [\n {\n order_id: 3,\n customer_id: '2',\n orders__customer_id: '2',\n product_id: '3',\n order_date: '2022-02-01',\n order_amount: 25.0,\n vendors: [],\n },\n {\n order_id: 4,\n customer_id: '2',\n orders__customer_id: '2',\n product_id: '1',\n order_date: '2022-03-01',\n order_amount: 75.0,\n vendors: ['flipkart'],\n },\n {\n order_id: 5,\n customer_id: '3',\n orders__customer_id: '3',\n product_id: '1',\n order_date: '2022-03-02',\n order_amount: 100.0,\n vendors: ['myntra', 'amazon', 'flipkart'],\n },\n {\n order_id: 6,\n customer_id: '4',\n orders__customer_id: '4',\n product_id: '2',\n order_date: '2022-04-01',\n order_amount: 45.0,\n vendors: [],\n },\n {\n order_id: 7,\n customer_id: '4',\n orders__customer_id: '4',\n product_id: '3',\n order_date: '2022-05-01',\n order_amount: 90.0,\n vendors: ['myntra', 'flipkart'],\n },\n {\n order_id: 8,\n customer_id: '5',\n orders__customer_id: '5',\n product_id: '1',\n order_date: '2022-05-02',\n order_amount: 65.0,\n vendors: ['amazon', 'flipkart'],\n },\n {\n order_id: 9,\n customer_id: '5',\n orders__customer_id: '5',\n product_id: '2',\n order_date: '2022-05-05',\n order_amount: 85.0,\n vendors: [],\n },\n {\n order_id: 10,\n customer_id: '6',\n orders__customer_id: '6',\n product_id: '3',\n order_date: '2022-06-01',\n order_amount: 120.0,\n vendors: ['myntra', 'amazon'],\n },\n {\n order_id: 11,\n customer_id: '6aa6',\n orders__customer_id: '6aa6',\n product_id: '3',\n order_date: '2024-06-01',\n order_amount: 0.0,\n vendors: ['amazon'],\n },\n {\n order_id: 13,\n customer_id: '7',\n orders__customer_id: '7',\n product_id: '6',\n order_date: '2024-08-01',\n order_amount: 100.0,\n vendors: [\"swiggy's\"],\n },\n {\n order_id: 14,\n customer_id: '8',\n orders__customer_id: '8',\n product_id: '1',\n order_date: '2024-09-01',\n order_amount: 50.0,\n vendors: null,\n },\n ],\n },\n ],\n [\n {\n testName: 'Contains',\n expectedSQL: `SELECT orders.* FROM (SELECT customer_id AS orders__customer_id, * FROM (select * from orders) AS orders) AS orders WHERE (orders__customer_id ~~* '%aa%')`,\n cubeInput: {\n measures: ['*'],\n filters: [\n {\n member: 'orders.customer_id',\n operator: 'contains',\n values: ['aa'],\n },\n ],\n dimensions: [],\n },\n expectedOutput: [\n {\n order_id: 11,\n customer_id: '6aa6',\n orders__customer_id: '6aa6',\n product_id: '3',\n order_date: '2024-06-01',\n order_amount: 0.0,\n vendors: ['amazon'],\n },\n ],\n },\n ],\n [\n {\n testName: 'NotContains',\n expectedSQL: `SELECT orders.* FROM (SELECT customer_id AS orders__customer_id, * FROM (select * from orders) AS orders) AS orders WHERE ((orders__customer_id !~~ '%1%') AND (orders__customer_id !~~ '%2%') AND (orders__customer_id !~~ '%3%') AND (orders__customer_id !~~ '%4%') AND (orders__customer_id !~~ '%5%') AND (orders__customer_id !~~ '%aa%'))`,\n cubeInput: {\n measures: ['*'],\n filters: [\n {\n and: [\n {\n member: 'orders.customer_id',\n operator: 'notContains',\n values: ['1'],\n },\n {\n member: 'orders.customer_id',\n operator: 'notContains',\n values: ['2'],\n },\n {\n member: 'orders.customer_id',\n operator: 'notContains',\n values: ['3'],\n },\n {\n member: 'orders.customer_id',\n operator: 'notContains',\n values: ['4'],\n },\n {\n member: 'orders.customer_id',\n operator: 'notContains',\n values: ['5'],\n },\n {\n member: 'orders.customer_id',\n operator: 'notContains',\n values: ['aa'],\n },\n ],\n },\n ],\n dimensions: [],\n },\n expectedOutput: [\n {\n order_id: 10,\n customer_id: '6',\n orders__customer_id: '6',\n product_id: '3',\n order_date: '2022-06-01',\n order_amount: 120,\n vendors: ['myntra', 'amazon'],\n },\n {\n customer_id: '7',\n order_amount: 100,\n order_date: '2024-08-01T00:00:00.000Z',\n order_id: 13,\n orders__customer_id: '7',\n orders__order_date: undefined,\n product_id: '6',\n vendors: [\"swiggy's\"],\n },\n {\n customer_id: '8',\n order_amount: 50,\n order_date: '2024-09-01T00:00:00.000Z',\n order_id: 14,\n orders__customer_id: '8',\n orders__order_date: undefined,\n product_id: '1',\n vendors: null,\n },\n ],\n },\n ],\n [\n {\n testName: 'GreaterThan',\n expectedSQL: `SELECT orders.* FROM (SELECT orders.order_amount AS orders__order_amount, * FROM (select * from orders) AS orders) AS orders WHERE (orders__order_amount > 50)`,\n cubeInput: {\n measures: ['*'],\n filters: [\n {\n member: 'orders.order_amount',\n operator: 'gt',\n values: ['50'],\n },\n ],\n dimensions: [],\n },\n expectedOutput: [\n {\n order_id: 2,\n customer_id: '1',\n product_id: '2',\n order_date: '2022-01-02',\n order_amount: 80.0,\n orders__order_amount: 80.0,\n vendors: ['myntra'],\n },\n {\n order_id: 4,\n customer_id: '2',\n product_id: '1',\n order_date: '2022-03-01',\n order_amount: 75.0,\n orders__order_amount: 75.0,\n vendors: ['flipkart'],\n },\n {\n order_id: 5,\n customer_id: '3',\n product_id: '1',\n order_date: '2022-03-02',\n order_amount: 100.0,\n orders__order_amount: 100.0,\n vendors: ['myntra', 'amazon', 'flipkart'],\n },\n {\n order_id: 7,\n customer_id: '4',\n product_id: '3',\n order_date: '2022-05-01',\n order_amount: 90.0,\n orders__order_amount: 90.0,\n vendors: ['myntra', 'flipkart'],\n },\n {\n order_id: 8,\n customer_id: '5',\n product_id: '1',\n order_date: '2022-05-02',\n order_amount: 65.0,\n orders__order_amount: 65.0,\n vendors: ['amazon', 'flipkart'],\n },\n {\n order_id: 9,\n customer_id: '5',\n product_id: '2',\n order_date: '2022-05-05',\n order_amount: 85.0,\n orders__order_amount: 85.0,\n vendors: [],\n },\n {\n order_id: 10,\n customer_id: '6',\n product_id: '3',\n order_date: '2022-06-01',\n order_amount: 120.0,\n orders__order_amount: 120.0,\n vendors: ['myntra', 'amazon'],\n },\n {\n customer_id: null,\n order_amount: 100,\n order_date: '2024-07-01T00:00:00.000Z',\n order_id: 12,\n orders__order_amount: 100,\n orders__order_date: undefined,\n product_id: '3',\n vendors: ['flipkart'],\n },\n {\n customer_id: '7',\n order_amount: 100,\n order_date: '2024-08-01T00:00:00.000Z',\n order_id: 13,\n orders__order_amount: 100,\n orders__order_date: undefined,\n product_id: '6',\n vendors: [\"swiggy's\"],\n },\n ],\n },\n ],\n [\n {\n testName: 'LessThan',\n expectedSQL: `SELECT orders.* FROM (SELECT orders.order_amount AS orders__order_amount, * FROM (select * from orders) AS orders) AS orders WHERE (orders__order_amount < 50)`,\n cubeInput: {\n measures: ['*'],\n filters: [\n {\n member: 'orders.order_amount',\n operator: 'lt',\n values: ['50'],\n },\n ],\n dimensions: [],\n },\n expectedOutput: [\n {\n order_id: 3,\n customer_id: '2',\n product_id: '3',\n order_date: '2022-02-01',\n order_amount: 25.0,\n orders__order_amount: 25.0,\n vendors: [],\n },\n {\n order_id: 6,\n customer_id: '4',\n product_id: '2',\n order_date: '2022-04-01',\n order_amount: 45.0,\n orders__order_amount: 45.0,\n vendors: [],\n },\n {\n order_id: 11,\n customer_id: '6aa6',\n product_id: '3',\n order_date: '2024-06-01',\n order_amount: 0.0,\n orders__order_amount: 0.0,\n vendors: ['amazon'],\n },\n ],\n },\n ],\n [\n {\n testName: 'InDateRange',\n expectedSQL: `SELECT orders.* FROM (SELECT order_date AS orders__order_date, * FROM (select * from orders) AS orders) AS orders WHERE ((orders__order_date >= '2022-02-01') AND (orders__order_date <= '2022-03-31'))`,\n cubeInput: {\n measures: ['*'],\n filters: [\n {\n member: 'orders.order_date',\n operator: 'inDateRange',\n values: ['2022-02-01', '2022-03-31'],\n },\n ],\n dimensions: [],\n },\n expectedOutput: [\n {\n order_id: 3,\n customer_id: '2',\n product_id: '3',\n order_date: '2022-02-01',\n orders__order_date: '2022-02-01',\n order_amount: 25.0,\n vendors: [],\n },\n {\n order_id: 4,\n customer_id: '2',\n product_id: '1',\n order_date: '2022-03-01',\n orders__order_date: '2022-03-01',\n order_amount: 75.0,\n vendors: ['flipkart'],\n },\n {\n order_id: 5,\n customer_id: '3',\n product_id: '1',\n order_date: '2022-03-02',\n orders__order_date: '2022-03-02',\n order_amount: 100.0,\n vendors: ['myntra', 'amazon', 'flipkart'],\n },\n ],\n },\n ],\n [\n {\n testName: 'NotInDateRange',\n expectedSQL: `SELECT orders.* FROM (SELECT order_date AS orders__order_date, * FROM (select * from orders) AS orders) AS orders WHERE ((orders__order_date < '2022-02-01') OR (orders__order_date > '2022-03-31'))`,\n cubeInput: {\n measures: ['*'],\n filters: [\n {\n member: 'orders.order_date',\n operator: 'notInDateRange',\n values: ['2022-02-01', '2022-03-31'],\n },\n ],\n dimensions: [],\n },\n expectedOutput: [\n {\n order_id: 1,\n customer_id: '1',\n product_id: '1',\n order_date: '2022-01-01',\n order_amount: 50.0,\n orders__order_date: '2022-01-01',\n vendors: ['myntra', 'amazon', 'flipkart'],\n },\n {\n order_id: 2,\n customer_id: '1',\n product_id: '2',\n order_date: '2022-01-02',\n order_amount: 80.0,\n orders__order_date: '2022-01-02',\n vendors: ['myntra'],\n },\n {\n order_id: 6,\n customer_id: '4',\n product_id: '2',\n order_date: '2022-04-01',\n orders__order_date: '2022-04-01',\n order_amount: 45.0,\n vendors: [],\n },\n {\n order_id: 7,\n customer_id: '4',\n product_id: '3',\n order_date: '2022-05-01',\n orders__order_date: '2022-05-01',\n order_amount: 90.0,\n vendors: ['myntra', 'flipkart'],\n },\n {\n order_id: 8,\n customer_id: '5',\n product_id: '1',\n order_date: '2022-05-02',\n orders__order_date: '2022-05-02',\n order_amount: 65.0,\n vendors: ['amazon', 'flipkart'],\n },\n {\n order_id: 9,\n customer_id: '5',\n product_id: '2',\n order_date: '2022-05-05',\n orders__order_date: '2022-05-05',\n order_amount: 85.0,\n vendors: [],\n },\n {\n order_id: 10,\n customer_id: '6',\n product_id: '3',\n order_date: '2022-06-01',\n orders__order_date: '2022-06-01',\n order_amount: 120.0,\n vendors: ['myntra', 'amazon'],\n },\n {\n order_id: 11,\n customer_id: '6aa6',\n product_id: '3',\n order_date: '2024-06-01',\n orders__order_date: '2024-06-01',\n order_amount: 0.0,\n vendors: ['amazon'],\n },\n {\n customer_id: null,\n order_amount: 100,\n order_date: '2024-07-01T00:00:00.000Z',\n order_id: 12,\n orders__order_date: '2024-07-01T00:00:00.000Z',\n product_id: '3',\n vendors: ['flipkart'],\n },\n {\n customer_id: '7',\n order_amount: 100,\n order_date: '2024-08-01T00:00:00.000Z',\n order_id: 13,\n orders__order_date: '2024-08-01T00:00:00.000Z',\n product_id: '6',\n vendors: [\"swiggy's\"],\n },\n {\n customer_id: '8',\n order_amount: 50,\n order_date: '2024-09-01T00:00:00.000Z',\n order_id: 14,\n orders__order_date: '2024-09-01T00:00:00.000Z',\n product_id: '1',\n vendors: null,\n },\n ],\n },\n ],\n // {\n // testName: 'Or',\n // expectedSQL: `SELECT orders.* FROM (select * from orders) AS orders WHERE ((orders.order_amount > 80) OR ((orders.order_date >= '2022-02-01') AND (orders.order_date <= '2022-03-01')))`,\n // cubeInput: {\n // measures: ['*'],\n // filters: [\n // {\n // or: [\n // {\n // member: 'orders.order_amount',\n // operator: 'gt',\n // values: ['80'],\n // },\n // {\n // member: 'orders.order_date',\n // operator: 'inDateRange',\n // values: ['2022-02-01', '2022-03-01'],\n // },\n // ],\n // },\n // ],\n // dimensions: [],\n // },\n // expectedOutput: [\n // {\n // order_id: 3,\n // customer_id: '2',\n // product_id: '3',\n // order_date: '2022-02-01',\n // order_amount: 25.0,\n // },\n // {\n // order_id: 4,\n // customer_id: '2',\n // product_id: '1',\n // order_date: '2022-03-01',\n // order_amount: 75.0,\n // },\n // {\n // order_id: 5,\n // customer_id: '3',\n // product_id: '1',\n // order_date: '2022-03-02',\n // order_amount: 100.0,\n // },\n // {\n // order_id: 7,\n // customer_id: '4',\n // product_id: '3',\n // order_date: '2022-05-01',\n // order_amount: 90.0,\n // },\n // {\n // order_id: 9,\n // customer_id: '5',\n // product_id: '2',\n // order_date: '2022-05-05',\n // order_amount: 85.0,\n // },\n // {\n // order_id: 10,\n // customer_id: '6',\n // product_id: '3',\n // order_date: '2022-06-01',\n // order_amount: 120.0,\n // },\n // ],\n // },\n [\n {\n testName: 'And',\n expectedSQL: `SELECT orders.* FROM (SELECT orders.order_amount AS orders__order_amount, order_date AS orders__order_date, * FROM (select * from orders) AS orders) AS orders WHERE ((orders__order_amount > 50) AND ((orders__order_date >= '2022-02-01') AND (orders__order_date <= '2022-06-01')))`,\n cubeInput: {\n measures: ['*'],\n filters: [\n {\n and: [\n {\n member: 'orders.order_amount',\n operator: 'gt',\n values: ['50'],\n },\n {\n member: 'orders.order_date',\n operator: 'inDateRange',\n values: ['2022-02-01', '2022-06-01'],\n },\n ],\n },\n ],\n dimensions: [],\n },\n expectedOutput: [\n {\n order_id: 4,\n customer_id: '2',\n product_id: '1',\n order_date: '2022-03-01',\n order_amount: 75.0,\n orders__order_amount: 75.0,\n orders__order_date: '2022-03-01',\n vendors: ['flipkart'],\n },\n {\n order_id: 5,\n customer_id: '3',\n product_id: '1',\n order_date: '2022-03-02',\n orders__order_date: '2022-03-02',\n order_amount: 100.0,\n orders__order_amount: 100.0,\n vendors: ['myntra', 'amazon', 'flipkart'],\n },\n {\n order_id: 7,\n customer_id: '4',\n product_id: '3',\n order_date: '2022-05-01',\n orders__order_date: '2022-05-01',\n order_amount: 90.0,\n orders__order_amount: 90.0,\n vendors: ['myntra', 'flipkart'],\n },\n {\n order_id: 8,\n customer_id: '5',\n product_id: '1',\n order_date: '2022-05-02',\n orders__order_date: '2022-05-02',\n order_amount: 65,\n orders__order_amount: 65,\n vendors: ['amazon', 'flipkart'],\n },\n {\n order_id: 9,\n customer_id: '5',\n product_id: '2',\n order_date: '2022-05-05',\n orders__order_date: '2022-05-05',\n order_amount: 85.0,\n orders__order_amount: 85.0,\n vendors: [],\n },\n {\n order_id: 10,\n customer_id: '6',\n product_id: '3',\n order_date: '2022-06-01',\n orders__order_date: '2022-06-01',\n order_amount: 120.0,\n orders__order_amount: 120.0,\n vendors: ['myntra', 'amazon'],\n },\n ],\n },\n ],\n [\n {\n testName: 'Set',\n expectedSQL: `SELECT orders.* FROM (SELECT orders.order_amount AS orders__order_amount, product_id AS orders__product_id, * FROM (select * from orders) AS orders) AS orders WHERE ((orders__order_amount IS NOT NULL) AND (orders__product_id = '3'))`,\n cubeInput: {\n measures: ['*'],\n filters: [\n {\n and: [\n {\n member: 'orders.order_amount',\n operator: 'set',\n },\n {\n member: 'orders.product_id',\n operator: 'equals',\n values: ['3'],\n },\n ],\n },\n ],\n dimensions: [],\n },\n expectedOutput: [\n {\n customer_id: '2',\n order_amount: 25,\n order_date: '2022-02-01T00:00:00.000Z',\n order_id: 3,\n orders__order_amount: 25,\n orders__order_date: undefined,\n orders__product_id: '3',\n product_id: '3',\n vendors: [],\n },\n {\n customer_id: '4',\n order_amount: 90,\n order_date: '2022-05-01T00:00:00.000Z',\n order_id: 7,\n orders__order_amount: 90,\n orders__order_date: undefined,\n orders__product_id: '3',\n product_id: '3',\n vendors: ['myntra', 'flipkart'],\n },\n {\n customer_id: '6',\n order_amount: 120,\n order_date: '2022-06-01T00:00:00.000Z',\n order_id: 10,\n orders__order_amount: 120,\n orders__order_date: undefined,\n orders__product_id: '3',\n product_id: '3',\n vendors: ['myntra', 'amazon'],\n },\n {\n customer_id: '6aa6',\n order_amount: 0,\n order_date: '2024-06-01T00:00:00.000Z',\n order_id: 11,\n orders__order_amount: 0,\n orders__order_date: undefined,\n orders__product_id: '3',\n product_id: '3',\n vendors: ['amazon'],\n },\n {\n customer_id: null,\n order_amount: 100,\n order_date: '2024-07-01T00:00:00.000Z',\n order_id: 12,\n orders__order_amount: 100,\n orders__order_date: undefined,\n orders__product_id: '3',\n product_id: '3',\n vendors: ['flipkart'],\n },\n ],\n },\n ],\n [\n {\n testName: 'Not Set',\n expectedSQL: `SELECT orders.* FROM (SELECT customer_id AS orders__customer_id, product_id AS orders__product_id, * FROM (select * from orders) AS orders) AS orders WHERE ((orders__customer_id IS NULL) AND (orders__product_id = '3'))`,\n cubeInput: {\n measures: ['*'],\n filters: [\n {\n and: [\n {\n member: 'orders.customer_id',\n operator: 'notSet',\n },\n {\n member: 'orders.product_id',\n operator: 'equals',\n values: ['3'],\n },\n ],\n },\n ],\n dimensions: [],\n },\n expectedOutput: [\n {\n orders__customer_id: null,\n customer_id: null,\n order_amount: 100,\n order_date: '2024-07-01T00:00:00.000Z',\n order_id: 12,\n orders__order_date: undefined,\n orders__product_id: '3',\n product_id: '3',\n vendors: ['flipkart'],\n },\n ],\n },\n ],\n [\n {\n testName: 'In',\n expectedSQL: `SELECT orders.* FROM (SELECT customer_id AS orders__customer_id, vendors AS orders__vendors, * FROM (select * from orders) AS orders) AS orders WHERE ((orders__customer_id IN ('1', '2')) AND (orders__vendors && (ARRAY['myntra', 'amazon'])))`,\n cubeInput: {\n measures: ['*'],\n filters: [\n {\n and: [\n {\n member: 'orders.customer_id',\n operator: 'in',\n values: ['1', '2'],\n },\n {\n member: 'orders.vendors',\n operator: 'in',\n values: ['myntra', 'amazon'],\n },\n ],\n },\n ],\n dimensions: [],\n },\n expectedOutput: [\n {\n customer_id: '1',\n order_amount: 50,\n order_date: '2022-01-01T00:00:00.000Z',\n order_id: 1,\n orders__customer_id: '1',\n orders__order_date: undefined,\n orders__vendors: ['myntra', 'amazon', 'flipkart'],\n product_id: '1',\n vendors: ['myntra', 'amazon', 'flipkart'],\n },\n {\n customer_id: '1',\n order_amount: 80,\n order_date: '2022-01-02T00:00:00.000Z',\n order_id: 2,\n orders__customer_id: '1',\n orders__order_date: undefined,\n orders__vendors: ['myntra'],\n product_id: '2',\n vendors: ['myntra'],\n },\n ],\n },\n {\n testName: 'In with single quotes',\n expectedSQL: `SELECT orders.* FROM (SELECT vendors AS orders__vendors, * FROM (select * from orders) AS orders) AS orders WHERE ((orders__vendors && (ARRAY['swiggy''s'])))`,\n cubeInput: {\n measures: ['*'],\n filters: [\n {\n and: [\n {\n member: 'orders.vendors',\n operator: 'in',\n values: [\"swiggy's\"],\n },\n ],\n },\n ],\n dimensions: [],\n },\n expectedOutput: [\n {\n customer_id: '7',\n order_amount: 100,\n order_date: '2024-08-01T00:00:00.000Z',\n order_id: 13,\n orders__order_date: undefined,\n orders__vendors: [\"swiggy's\"],\n product_id: '6',\n vendors: [\"swiggy's\"],\n },\n ],\n },\n ],\n [\n {\n testName: 'Not In',\n expectedSQL: `SELECT orders.* FROM (SELECT customer_id AS orders__customer_id, product_id AS orders__product_id, * FROM (select * from orders) AS orders) AS orders WHERE (((orders__customer_id NOT IN ('1', '2')) OR (orders__customer_id IS NULL)) AND (orders__product_id = '3'))`,\n cubeInput: {\n measures: ['*'],\n filters: [\n {\n and: [\n {\n member: 'orders.customer_id',\n operator: 'notIn',\n values: ['1', '2'],\n },\n {\n member: 'orders.product_id',\n operator: 'equals',\n values: ['3'],\n },\n ],\n },\n ],\n dimensions: [],\n },\n expectedOutput: [\n {\n customer_id: '4',\n order_amount: 90,\n order_date: '2022-05-01T00:00:00.000Z',\n order_id: 7,\n orders__customer_id: '4',\n orders__order_date: undefined,\n orders__product_id: '3',\n product_id: '3',\n vendors: ['myntra', 'flipkart'],\n },\n {\n customer_id: '6',\n order_amount: 120,\n order_date: '2022-06-01T00:00:00.000Z',\n order_id: 10,\n orders__customer_id: '6',\n orders__order_date: undefined,\n orders__product_id: '3',\n product_id: '3',\n vendors: ['myntra', 'amazon'],\n },\n {\n customer_id: '6aa6',\n order_amount: 0,\n order_date: '2024-06-01T00:00:00.000Z',\n order_id: 11,\n orders__customer_id: '6aa6',\n orders__order_date: undefined,\n orders__product_id: '3',\n product_id: '3',\n vendors: ['amazon'],\n },\n {\n customer_id: null,\n order_amount: 100,\n order_date: '2024-07-01T00:00:00.000Z',\n order_id: 12,\n orders__customer_id: null,\n orders__order_date: undefined,\n orders__product_id: '3',\n product_id: '3',\n vendors: ['flipkart'],\n },\n ],\n },\n {\n testName: 'Not In for array type',\n expectedSQL: `SELECT orders.* FROM (SELECT vendors AS orders__vendors, * FROM (select * from orders) AS orders) AS orders WHERE ((NOT (orders__vendors && (ARRAY['myntra', 'amazon']))) OR (orders__vendors IS NULL))`,\n cubeInput: {\n measures: ['*'],\n filters: [\n {\n member: 'orders.vendors',\n operator: 'notIn',\n values: ['myntra', 'amazon'],\n },\n ],\n dimensions: [],\n },\n expectedOutput: [\n {\n customer_id: '2',\n order_amount: 25,\n order_date: '2022-02-01T00:00:00.000Z',\n order_id: 3,\n orders__order_date: undefined,\n orders__vendors: [],\n product_id: '3',\n vendors: [],\n },\n {\n customer_id: '2',\n order_amount: 75,\n order_date: '2022-03-01T00:00:00.000Z',\n order_id: 4,\n orders__order_date: undefined,\n orders__vendors: ['flipkart'],\n product_id: '1',\n vendors: ['flipkart'],\n },\n {\n customer_id: '4',\n order_amount: 45,\n order_date: '2022-04-01T00:00:00.000Z',\n order_id: 6,\n orders__order_date: undefined,\n orders__vendors: [],\n product_id: '2',\n vendors: [],\n },\n {\n customer_id: '5',\n order_amount: 85,\n order_date: '2022-05-05T00:00:00.000Z',\n order_id: 9,\n orders__order_date: undefined,\n orders__vendors: [],\n product_id: '2',\n vendors: [],\n },\n {\n customer_id: null,\n order_amount: 100,\n order_date: '2024-07-01T00:00:00.000Z',\n order_id: 12,\n orders__order_date: undefined,\n orders__vendors: ['flipkart'],\n product_id: '3',\n vendors: ['flipkart'],\n },\n {\n customer_id: '7',\n order_amount: 100,\n order_date: '2024-08-01T00:00:00.000Z',\n order_id: 13,\n orders__order_date: undefined,\n orders__vendors: [\"swiggy's\"],\n product_id: '6',\n vendors: [\"swiggy's\"],\n },\n {\n customer_id: '8',\n order_amount: 50,\n order_date: '2024-09-01T00:00:00.000Z',\n order_id: 14,\n orders__order_date: undefined,\n orders__vendors: null,\n product_id: '1',\n vendors: null,\n },\n ],\n },\n ],\n];\n"],"names":["TEST_DATA_WITH_SAFE_ALIAS","testName","expectedSQL","cubeInput","measures","filters","dimensions","limit","expectedOutput","orders__order_month","orders__total_order_amount","order","orders__customer_id","member","operator","values","order_id","customer_id","product_id","order_date","order_amount","vendors","and","orders__order_date","undefined","orders__order_amount","orders__product_id","orders__vendors"],"mappings":";+BAAaA;;;eAAAA;;;AAAN,MAAMA,4BAA4B;IACvC;QACE;YACEC,UAAU;YACVC,aAAa,CAAC,2OAA2O,CAAC;YAC1PC,WAAW;gBACTC,UAAU;oBAAC;iBAA4B;gBACvCC,SAAS,EAAE;gBACXC,YAAY;oBAAC;iBAAqB;gBAClCC,OAAO;YACT;YACAC,gBAAgB;gBACd;oBACEC,qBAAqB;oBACrBC,4BAA4B;gBAC9B;aACD;QACH;KACD;IACD;QACE;YACET,UAAU;YACVC,aAAa,CAAC,gRAAgR,CAAC;YAC/RC,WAAW;gBACTC,UAAU;oBAAC;iBAA4B;gBACvCC,SAAS,EAAE;gBACXC,YAAY;oBAAC;iBAAqB;gBAClCK,OAAO;oBACL,6BAA6B;oBAC7B,sBAAsB;gBACxB;YACF;YACAH,gBAAgB;gBACd;oBACEI,qBAAqB;oBACrBF,4BAA4B;gBAC9B;gBACA;oBAC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B;wBAAC;qBAAW;oBAC7BT,YAAY;oBACZG,SAAS;wBAAC;qBAAW;gBACvB;gBACA;oBACEJ,aAAa;oBACbG,cAAc;oBACdD,YAAY;oBACZH,UAAU;oBACVO,oBAAoBC;oBACpBG,iBAAiB,EAAE;oBACnBT,YAAY;oBACZG,SAAS,EAAE;gBACb;gBACA;oBACEJ,aAAa;oBACbG,cAAc;oBACdD,YAAY;oBACZH,UAAU;oBACVO,oBAAoBC;oBACpBG,iBAAiB,EAAE;oBACnBT,YAAY;oBACZG,SAAS,EAAE;gBACb;gBACA;oBACEJ,aAAa;oBACbG,cAAc;oBACdD,YAAY;oBACZH,UAAU;oBACVO,oBAAoBC;oBACpBG,iBAAiB;wBAAC;qBAAW;oBAC7BT,YAAY;oBACZG,SAAS;wBAAC;qBAAW;gBACvB;gBACA;oBACEJ,aAAa;oBACbG,cAAc;oBACdD,YAAY;oBACZH,UAAU;oBACVO,oBAAoBC;oBACpBG,iBAAiB;wBAAC;qBAAW;oBAC7BT,YAAY;oBACZG,SAAS;wBAAC;qBAAW;gBACvB;gBACA;oBACEJ,aAAa;oBACbG,cAAc;oBACdD,YAAY;oBACZH,UAAU;oBACVO,oBAAoBC;oBACpBG,iBAAiB;oBACjBT,YAAY;oBACZG,SAAS;gBACX;aACD;QACH;KACD;CACF"}
|
|
1
|
+
{"version":3,"sources":["../../../meerkat-node/src/__fixtures__/test-data-with-safe-alias.ts"],"sourcesContent":["export const TEST_DATA_WITH_SAFE_ALIAS = [\n [\n {\n testName: 'GroupBySQLInnerQuery',\n expectedSQL: `SELECT SUM(order_amount) AS orders__total_order_amount , orders__order_month FROM (SELECT DATE_TRUNC('month', order_date) AS orders__order_month, * FROM (select * from orders) AS orders) AS orders GROUP BY orders__order_month LIMIT 1`,\n cubeInput: {\n measures: ['orders.total_order_amount'],\n filters: [],\n dimensions: ['orders.order_month'],\n limit: 1,\n },\n expectedOutput: [\n {\n orders__order_month: '2022-01-01T00:00:00.000Z',\n orders__total_order_amount: 130,\n },\n ],\n },\n ],\n [\n {\n testName: 'GroupBy',\n expectedSQL: `SELECT SUM(order_amount) AS orders__total_order_amount , orders__customer_id FROM (SELECT customer_id AS orders__customer_id, * FROM (select * from orders) AS orders) AS orders GROUP BY orders__customer_id ORDER BY orders__total_order_amount ASC, orders__customer_id ASC`,\n cubeInput: {\n measures: ['orders.total_order_amount'],\n filters: [],\n dimensions: ['orders.customer_id'],\n order: {\n 'orders.total_order_amount': 'asc',\n 'orders.customer_id': 'asc',\n },\n },\n expectedOutput: [\n {\n orders__customer_id: '6aa6',\n orders__total_order_amount: 0,\n },\n {\n orders__customer_id: '8',\n orders__total_order_amount: 50,\n },\n {\n orders__customer_id: '2',\n orders__total_order_amount: 100,\n },\n {\n orders__customer_id: '3',\n orders__total_order_amount: 100,\n },\n {\n orders__customer_id: '7',\n orders__total_order_amount: 100,\n },\n {\n orders__customer_id: null,\n orders__total_order_amount: 100,\n },\n {\n orders__customer_id: '6',\n orders__total_order_amount: 120,\n },\n {\n orders__customer_id: '1',\n orders__total_order_amount: 130,\n },\n {\n orders__customer_id: '4',\n orders__total_order_amount: 135,\n },\n {\n orders__customer_id: '5',\n orders__total_order_amount: 150,\n },\n ],\n },\n ],\n [\n {\n testName: 'Equals',\n expectedSQL: `SELECT orders.* FROM (SELECT customer_id AS orders__customer_id, * FROM (select * from orders) AS orders) AS orders WHERE (orders__customer_id = '1')`,\n cubeInput: {\n measures: ['*'],\n filters: [\n {\n member: 'orders.customer_id',\n operator: 'equals',\n values: ['1'],\n },\n ],\n dimensions: [],\n },\n expectedOutput: [\n {\n order_id: 1,\n customer_id: '1',\n orders__customer_id: '1',\n product_id: '1',\n order_date: '2022-01-01',\n order_amount: 50.0,\n vendors: ['myntra', 'amazon', 'flipkart'],\n },\n {\n order_id: 2,\n customer_id: '1',\n orders__customer_id: '1',\n product_id: '2',\n order_date: '2022-01-02',\n order_amount: 80.0,\n vendors: ['myntra'],\n },\n ],\n },\n {\n testName: 'Equals for multiple values',\n expectedSQL: `SELECT orders.* FROM (SELECT customer_id AS orders__customer_id, * FROM (select * from orders) AS orders) AS orders WHERE ((orders__customer_id = '1') AND (orders__customer_id = '2'))`,\n cubeInput: {\n measures: ['*'],\n filters: [\n {\n member: 'orders.customer_id',\n operator: 'equals',\n values: ['1', '2'],\n },\n ],\n dimensions: [],\n },\n expectedOutput: [],\n },\n ],\n [\n {\n testName: 'NotEquals',\n expectedSQL: `SELECT orders.* FROM (SELECT customer_id AS orders__customer_id, * FROM (select * from orders) AS orders) AS orders WHERE (orders__customer_id != '1')`,\n cubeInput: {\n measures: ['*'],\n filters: [\n {\n member: 'orders.customer_id',\n operator: 'notEquals',\n values: ['1'],\n },\n ],\n dimensions: [],\n },\n expectedOutput: [\n {\n order_id: 3,\n customer_id: '2',\n orders__customer_id: '2',\n product_id: '3',\n order_date: '2022-02-01',\n order_amount: 25.0,\n vendors: [],\n },\n {\n order_id: 4,\n customer_id: '2',\n orders__customer_id: '2',\n product_id: '1',\n order_date: '2022-03-01',\n order_amount: 75.0,\n vendors: ['flipkart'],\n },\n {\n order_id: 5,\n customer_id: '3',\n orders__customer_id: '3',\n product_id: '1',\n order_date: '2022-03-02',\n order_amount: 100.0,\n vendors: ['myntra', 'amazon', 'flipkart'],\n },\n {\n order_id: 6,\n customer_id: '4',\n orders__customer_id: '4',\n product_id: '2',\n order_date: '2022-04-01',\n order_amount: 45.0,\n vendors: [],\n },\n {\n order_id: 7,\n customer_id: '4',\n orders__customer_id: '4',\n product_id: '3',\n order_date: '2022-05-01',\n order_amount: 90.0,\n vendors: ['myntra', 'flipkart'],\n },\n {\n order_id: 8,\n customer_id: '5',\n orders__customer_id: '5',\n product_id: '1',\n order_date: '2022-05-02',\n order_amount: 65.0,\n vendors: ['amazon', 'flipkart'],\n },\n {\n order_id: 9,\n customer_id: '5',\n orders__customer_id: '5',\n product_id: '2',\n order_date: '2022-05-05',\n order_amount: 85.0,\n vendors: [],\n },\n {\n order_id: 10,\n customer_id: '6',\n orders__customer_id: '6',\n product_id: '3',\n order_date: '2022-06-01',\n order_amount: 120.0,\n vendors: ['myntra', 'amazon'],\n },\n {\n order_id: 11,\n customer_id: '6aa6',\n orders__customer_id: '6aa6',\n product_id: '3',\n order_date: '2024-06-01',\n order_amount: 0.0,\n vendors: ['amazon'],\n },\n {\n order_id: 13,\n customer_id: '7',\n orders__customer_id: '7',\n product_id: '6',\n order_date: '2024-08-01',\n order_amount: 100.0,\n vendors: [\"swiggy's\"],\n },\n {\n order_id: 14,\n customer_id: '8',\n orders__customer_id: '8',\n product_id: '1',\n order_date: '2024-09-01',\n order_amount: 50.0,\n vendors: null,\n },\n ],\n },\n ],\n [\n {\n testName: 'Contains',\n expectedSQL: `SELECT orders.* FROM (SELECT customer_id AS orders__customer_id, * FROM (select * from orders) AS orders) AS orders WHERE (orders__customer_id ~~* '%aa%')`,\n cubeInput: {\n measures: ['*'],\n filters: [\n {\n member: 'orders.customer_id',\n operator: 'contains',\n values: ['aa'],\n },\n ],\n dimensions: [],\n },\n expectedOutput: [\n {\n order_id: 11,\n customer_id: '6aa6',\n orders__customer_id: '6aa6',\n product_id: '3',\n order_date: '2024-06-01',\n order_amount: 0.0,\n vendors: ['amazon'],\n },\n ],\n },\n ],\n [\n {\n testName: 'NotContains',\n expectedSQL: `SELECT orders.* FROM (SELECT customer_id AS orders__customer_id, * FROM (select * from orders) AS orders) AS orders WHERE ((orders__customer_id !~~ '%1%') AND (orders__customer_id !~~ '%2%') AND (orders__customer_id !~~ '%3%') AND (orders__customer_id !~~ '%4%') AND (orders__customer_id !~~ '%5%') AND (orders__customer_id !~~ '%aa%'))`,\n cubeInput: {\n measures: ['*'],\n filters: [\n {\n and: [\n {\n member: 'orders.customer_id',\n operator: 'notContains',\n values: ['1'],\n },\n {\n member: 'orders.customer_id',\n operator: 'notContains',\n values: ['2'],\n },\n {\n member: 'orders.customer_id',\n operator: 'notContains',\n values: ['3'],\n },\n {\n member: 'orders.customer_id',\n operator: 'notContains',\n values: ['4'],\n },\n {\n member: 'orders.customer_id',\n operator: 'notContains',\n values: ['5'],\n },\n {\n member: 'orders.customer_id',\n operator: 'notContains',\n values: ['aa'],\n },\n ],\n },\n ],\n dimensions: [],\n },\n expectedOutput: [\n {\n order_id: 10,\n customer_id: '6',\n orders__customer_id: '6',\n product_id: '3',\n order_date: '2022-06-01',\n order_amount: 120,\n vendors: ['myntra', 'amazon'],\n },\n {\n customer_id: '7',\n order_amount: 100,\n order_date: '2024-08-01T00:00:00.000Z',\n order_id: 13,\n orders__customer_id: '7',\n orders__order_date: undefined,\n product_id: '6',\n vendors: [\"swiggy's\"],\n },\n {\n customer_id: '8',\n order_amount: 50,\n order_date: '2024-09-01T00:00:00.000Z',\n order_id: 14,\n orders__customer_id: '8',\n orders__order_date: undefined,\n product_id: '1',\n vendors: null,\n },\n ],\n },\n ],\n [\n {\n testName: 'GreaterThan',\n expectedSQL: `SELECT orders.* FROM (SELECT orders.order_amount AS orders__order_amount, * FROM (select * from orders) AS orders) AS orders WHERE (orders__order_amount > 50)`,\n cubeInput: {\n measures: ['*'],\n filters: [\n {\n member: 'orders.order_amount',\n operator: 'gt',\n values: ['50'],\n },\n ],\n dimensions: [],\n },\n expectedOutput: [\n {\n order_id: 2,\n customer_id: '1',\n product_id: '2',\n order_date: '2022-01-02',\n order_amount: 80.0,\n orders__order_amount: 80.0,\n vendors: ['myntra'],\n },\n {\n order_id: 4,\n customer_id: '2',\n product_id: '1',\n order_date: '2022-03-01',\n order_amount: 75.0,\n orders__order_amount: 75.0,\n vendors: ['flipkart'],\n },\n {\n order_id: 5,\n customer_id: '3',\n product_id: '1',\n order_date: '2022-03-02',\n order_amount: 100.0,\n orders__order_amount: 100.0,\n vendors: ['myntra', 'amazon', 'flipkart'],\n },\n {\n order_id: 7,\n customer_id: '4',\n product_id: '3',\n order_date: '2022-05-01',\n order_amount: 90.0,\n orders__order_amount: 90.0,\n vendors: ['myntra', 'flipkart'],\n },\n {\n order_id: 8,\n customer_id: '5',\n product_id: '1',\n order_date: '2022-05-02',\n order_amount: 65.0,\n orders__order_amount: 65.0,\n vendors: ['amazon', 'flipkart'],\n },\n {\n order_id: 9,\n customer_id: '5',\n product_id: '2',\n order_date: '2022-05-05',\n order_amount: 85.0,\n orders__order_amount: 85.0,\n vendors: [],\n },\n {\n order_id: 10,\n customer_id: '6',\n product_id: '3',\n order_date: '2022-06-01',\n order_amount: 120.0,\n orders__order_amount: 120.0,\n vendors: ['myntra', 'amazon'],\n },\n {\n customer_id: null,\n order_amount: 100,\n order_date: '2024-07-01T00:00:00.000Z',\n order_id: 12,\n orders__order_amount: 100,\n orders__order_date: undefined,\n product_id: '3',\n vendors: ['flipkart'],\n },\n {\n customer_id: '7',\n order_amount: 100,\n order_date: '2024-08-01T00:00:00.000Z',\n order_id: 13,\n orders__order_amount: 100,\n orders__order_date: undefined,\n product_id: '6',\n vendors: [\"swiggy's\"],\n },\n ],\n },\n ],\n [\n {\n testName: 'LessThan',\n expectedSQL: `SELECT orders.* FROM (SELECT orders.order_amount AS orders__order_amount, * FROM (select * from orders) AS orders) AS orders WHERE (orders__order_amount < 50)`,\n cubeInput: {\n measures: ['*'],\n filters: [\n {\n member: 'orders.order_amount',\n operator: 'lt',\n values: ['50'],\n },\n ],\n dimensions: [],\n },\n expectedOutput: [\n {\n order_id: 3,\n customer_id: '2',\n product_id: '3',\n order_date: '2022-02-01',\n order_amount: 25.0,\n orders__order_amount: 25.0,\n vendors: [],\n },\n {\n order_id: 6,\n customer_id: '4',\n product_id: '2',\n order_date: '2022-04-01',\n order_amount: 45.0,\n orders__order_amount: 45.0,\n vendors: [],\n },\n {\n order_id: 11,\n customer_id: '6aa6',\n product_id: '3',\n order_date: '2024-06-01',\n order_amount: 0.0,\n orders__order_amount: 0.0,\n vendors: ['amazon'],\n },\n ],\n },\n ],\n [\n {\n testName: 'InDateRange',\n expectedSQL: `SELECT orders.* FROM (SELECT order_date AS orders__order_date, * FROM (select * from orders) AS orders) AS orders WHERE ((orders__order_date >= '2022-02-01') AND (orders__order_date <= '2022-03-31'))`,\n cubeInput: {\n measures: ['*'],\n filters: [\n {\n member: 'orders.order_date',\n operator: 'inDateRange',\n values: ['2022-02-01', '2022-03-31'],\n },\n ],\n dimensions: [],\n },\n expectedOutput: [\n {\n order_id: 3,\n customer_id: '2',\n product_id: '3',\n order_date: '2022-02-01',\n orders__order_date: '2022-02-01',\n order_amount: 25.0,\n vendors: [],\n },\n {\n order_id: 4,\n customer_id: '2',\n product_id: '1',\n order_date: '2022-03-01',\n orders__order_date: '2022-03-01',\n order_amount: 75.0,\n vendors: ['flipkart'],\n },\n {\n order_id: 5,\n customer_id: '3',\n product_id: '1',\n order_date: '2022-03-02',\n orders__order_date: '2022-03-02',\n order_amount: 100.0,\n vendors: ['myntra', 'amazon', 'flipkart'],\n },\n ],\n },\n ],\n [\n {\n testName: 'NotInDateRange',\n expectedSQL: `SELECT orders.* FROM (SELECT order_date AS orders__order_date, * FROM (select * from orders) AS orders) AS orders WHERE ((orders__order_date < '2022-02-01') OR (orders__order_date > '2022-03-31'))`,\n cubeInput: {\n measures: ['*'],\n filters: [\n {\n member: 'orders.order_date',\n operator: 'notInDateRange',\n values: ['2022-02-01', '2022-03-31'],\n },\n ],\n dimensions: [],\n },\n expectedOutput: [\n {\n order_id: 1,\n customer_id: '1',\n product_id: '1',\n order_date: '2022-01-01',\n order_amount: 50.0,\n orders__order_date: '2022-01-01',\n vendors: ['myntra', 'amazon', 'flipkart'],\n },\n {\n order_id: 2,\n customer_id: '1',\n product_id: '2',\n order_date: '2022-01-02',\n order_amount: 80.0,\n orders__order_date: '2022-01-02',\n vendors: ['myntra'],\n },\n {\n order_id: 6,\n customer_id: '4',\n product_id: '2',\n order_date: '2022-04-01',\n orders__order_date: '2022-04-01',\n order_amount: 45.0,\n vendors: [],\n },\n {\n order_id: 7,\n customer_id: '4',\n product_id: '3',\n order_date: '2022-05-01',\n orders__order_date: '2022-05-01',\n order_amount: 90.0,\n vendors: ['myntra', 'flipkart'],\n },\n {\n order_id: 8,\n customer_id: '5',\n product_id: '1',\n order_date: '2022-05-02',\n orders__order_date: '2022-05-02',\n order_amount: 65.0,\n vendors: ['amazon', 'flipkart'],\n },\n {\n order_id: 9,\n customer_id: '5',\n product_id: '2',\n order_date: '2022-05-05',\n orders__order_date: '2022-05-05',\n order_amount: 85.0,\n vendors: [],\n },\n {\n order_id: 10,\n customer_id: '6',\n product_id: '3',\n order_date: '2022-06-01',\n orders__order_date: '2022-06-01',\n order_amount: 120.0,\n vendors: ['myntra', 'amazon'],\n },\n {\n order_id: 11,\n customer_id: '6aa6',\n product_id: '3',\n order_date: '2024-06-01',\n orders__order_date: '2024-06-01',\n order_amount: 0.0,\n vendors: ['amazon'],\n },\n {\n customer_id: null,\n order_amount: 100,\n order_date: '2024-07-01T00:00:00.000Z',\n order_id: 12,\n orders__order_date: '2024-07-01T00:00:00.000Z',\n product_id: '3',\n vendors: ['flipkart'],\n },\n {\n customer_id: '7',\n order_amount: 100,\n order_date: '2024-08-01T00:00:00.000Z',\n order_id: 13,\n orders__order_date: '2024-08-01T00:00:00.000Z',\n product_id: '6',\n vendors: [\"swiggy's\"],\n },\n {\n customer_id: '8',\n order_amount: 50,\n order_date: '2024-09-01T00:00:00.000Z',\n order_id: 14,\n orders__order_date: '2024-09-01T00:00:00.000Z',\n product_id: '1',\n vendors: null,\n },\n ],\n },\n ],\n // {\n // testName: 'Or',\n // expectedSQL: `SELECT orders.* FROM (select * from orders) AS orders WHERE ((orders.order_amount > 80) OR ((orders.order_date >= '2022-02-01') AND (orders.order_date <= '2022-03-01')))`,\n // cubeInput: {\n // measures: ['*'],\n // filters: [\n // {\n // or: [\n // {\n // member: 'orders.order_amount',\n // operator: 'gt',\n // values: ['80'],\n // },\n // {\n // member: 'orders.order_date',\n // operator: 'inDateRange',\n // values: ['2022-02-01', '2022-03-01'],\n // },\n // ],\n // },\n // ],\n // dimensions: [],\n // },\n // expectedOutput: [\n // {\n // order_id: 3,\n // customer_id: '2',\n // product_id: '3',\n // order_date: '2022-02-01',\n // order_amount: 25.0,\n // },\n // {\n // order_id: 4,\n // customer_id: '2',\n // product_id: '1',\n // order_date: '2022-03-01',\n // order_amount: 75.0,\n // },\n // {\n // order_id: 5,\n // customer_id: '3',\n // product_id: '1',\n // order_date: '2022-03-02',\n // order_amount: 100.0,\n // },\n // {\n // order_id: 7,\n // customer_id: '4',\n // product_id: '3',\n // order_date: '2022-05-01',\n // order_amount: 90.0,\n // },\n // {\n // order_id: 9,\n // customer_id: '5',\n // product_id: '2',\n // order_date: '2022-05-05',\n // order_amount: 85.0,\n // },\n // {\n // order_id: 10,\n // customer_id: '6',\n // product_id: '3',\n // order_date: '2022-06-01',\n // order_amount: 120.0,\n // },\n // ],\n // },\n [\n {\n testName: 'And',\n expectedSQL: `SELECT orders.* FROM (SELECT orders.order_amount AS orders__order_amount, order_date AS orders__order_date, * FROM (select * from orders) AS orders) AS orders WHERE ((orders__order_amount > 50) AND ((orders__order_date >= '2022-02-01') AND (orders__order_date <= '2022-06-01')))`,\n cubeInput: {\n measures: ['*'],\n filters: [\n {\n and: [\n {\n member: 'orders.order_amount',\n operator: 'gt',\n values: ['50'],\n },\n {\n member: 'orders.order_date',\n operator: 'inDateRange',\n values: ['2022-02-01', '2022-06-01'],\n },\n ],\n },\n ],\n dimensions: [],\n },\n expectedOutput: [\n {\n order_id: 4,\n customer_id: '2',\n product_id: '1',\n order_date: '2022-03-01',\n order_amount: 75.0,\n orders__order_amount: 75.0,\n orders__order_date: '2022-03-01',\n vendors: ['flipkart'],\n },\n {\n order_id: 5,\n customer_id: '3',\n product_id: '1',\n order_date: '2022-03-02',\n orders__order_date: '2022-03-02',\n order_amount: 100.0,\n orders__order_amount: 100.0,\n vendors: ['myntra', 'amazon', 'flipkart'],\n },\n {\n order_id: 7,\n customer_id: '4',\n product_id: '3',\n order_date: '2022-05-01',\n orders__order_date: '2022-05-01',\n order_amount: 90.0,\n orders__order_amount: 90.0,\n vendors: ['myntra', 'flipkart'],\n },\n {\n order_id: 8,\n customer_id: '5',\n product_id: '1',\n order_date: '2022-05-02',\n orders__order_date: '2022-05-02',\n order_amount: 65,\n orders__order_amount: 65,\n vendors: ['amazon', 'flipkart'],\n },\n {\n order_id: 9,\n customer_id: '5',\n product_id: '2',\n order_date: '2022-05-05',\n orders__order_date: '2022-05-05',\n order_amount: 85.0,\n orders__order_amount: 85.0,\n vendors: [],\n },\n {\n order_id: 10,\n customer_id: '6',\n product_id: '3',\n order_date: '2022-06-01',\n orders__order_date: '2022-06-01',\n order_amount: 120.0,\n orders__order_amount: 120.0,\n vendors: ['myntra', 'amazon'],\n },\n ],\n },\n ],\n [\n {\n testName: 'Set',\n expectedSQL: `SELECT orders.* FROM (SELECT orders.order_amount AS orders__order_amount, product_id AS orders__product_id, * FROM (select * from orders) AS orders) AS orders WHERE ((orders__order_amount IS NOT NULL) AND (orders__product_id = '3'))`,\n cubeInput: {\n measures: ['*'],\n filters: [\n {\n and: [\n {\n member: 'orders.order_amount',\n operator: 'set',\n },\n {\n member: 'orders.product_id',\n operator: 'equals',\n values: ['3'],\n },\n ],\n },\n ],\n dimensions: [],\n },\n expectedOutput: [\n {\n customer_id: '2',\n order_amount: 25,\n order_date: '2022-02-01T00:00:00.000Z',\n order_id: 3,\n orders__order_amount: 25,\n orders__order_date: undefined,\n orders__product_id: '3',\n product_id: '3',\n vendors: [],\n },\n {\n customer_id: '4',\n order_amount: 90,\n order_date: '2022-05-01T00:00:00.000Z',\n order_id: 7,\n orders__order_amount: 90,\n orders__order_date: undefined,\n orders__product_id: '3',\n product_id: '3',\n vendors: ['myntra', 'flipkart'],\n },\n {\n customer_id: '6',\n order_amount: 120,\n order_date: '2022-06-01T00:00:00.000Z',\n order_id: 10,\n orders__order_amount: 120,\n orders__order_date: undefined,\n orders__product_id: '3',\n product_id: '3',\n vendors: ['myntra', 'amazon'],\n },\n {\n customer_id: '6aa6',\n order_amount: 0,\n order_date: '2024-06-01T00:00:00.000Z',\n order_id: 11,\n orders__order_amount: 0,\n orders__order_date: undefined,\n orders__product_id: '3',\n product_id: '3',\n vendors: ['amazon'],\n },\n {\n customer_id: null,\n order_amount: 100,\n order_date: '2024-07-01T00:00:00.000Z',\n order_id: 12,\n orders__order_amount: 100,\n orders__order_date: undefined,\n orders__product_id: '3',\n product_id: '3',\n vendors: ['flipkart'],\n },\n ],\n },\n ],\n [\n {\n testName: 'Not Set',\n expectedSQL: `SELECT orders.* FROM (SELECT customer_id AS orders__customer_id, product_id AS orders__product_id, * FROM (select * from orders) AS orders) AS orders WHERE ((orders__customer_id IS NULL) AND (orders__product_id = '3'))`,\n cubeInput: {\n measures: ['*'],\n filters: [\n {\n and: [\n {\n member: 'orders.customer_id',\n operator: 'notSet',\n },\n {\n member: 'orders.product_id',\n operator: 'equals',\n values: ['3'],\n },\n ],\n },\n ],\n dimensions: [],\n },\n expectedOutput: [\n {\n orders__customer_id: null,\n customer_id: null,\n order_amount: 100,\n order_date: '2024-07-01T00:00:00.000Z',\n order_id: 12,\n orders__order_date: undefined,\n orders__product_id: '3',\n product_id: '3',\n vendors: ['flipkart'],\n },\n ],\n },\n ],\n [\n {\n testName: 'In',\n expectedSQL: `SELECT orders.* FROM (SELECT customer_id AS orders__customer_id, vendors AS orders__vendors, * FROM (select * from orders) AS orders) AS orders WHERE ((orders__customer_id IN ('1', '2')) AND (orders__vendors && (ARRAY['myntra', 'amazon'])))`,\n cubeInput: {\n measures: ['*'],\n filters: [\n {\n and: [\n {\n member: 'orders.customer_id',\n operator: 'in',\n values: ['1', '2'],\n },\n {\n member: 'orders.vendors',\n operator: 'in',\n values: ['myntra', 'amazon'],\n },\n ],\n },\n ],\n dimensions: [],\n },\n expectedOutput: [\n {\n customer_id: '1',\n order_amount: 50,\n order_date: '2022-01-01T00:00:00.000Z',\n order_id: 1,\n orders__customer_id: '1',\n orders__order_date: undefined,\n orders__vendors: ['myntra', 'amazon', 'flipkart'],\n product_id: '1',\n vendors: ['myntra', 'amazon', 'flipkart'],\n },\n {\n customer_id: '1',\n order_amount: 80,\n order_date: '2022-01-02T00:00:00.000Z',\n order_id: 2,\n orders__customer_id: '1',\n orders__order_date: undefined,\n orders__vendors: ['myntra'],\n product_id: '2',\n vendors: ['myntra'],\n },\n ],\n },\n {\n testName: 'In with single quotes',\n expectedSQL: `SELECT orders.* FROM (SELECT vendors AS orders__vendors, * FROM (select * from orders) AS orders) AS orders WHERE ((orders__vendors && (ARRAY['swiggy''s'])))`,\n cubeInput: {\n measures: ['*'],\n filters: [\n {\n and: [\n {\n member: 'orders.vendors',\n operator: 'in',\n values: [\"swiggy's\"],\n },\n ],\n },\n ],\n dimensions: [],\n },\n expectedOutput: [\n {\n customer_id: '7',\n order_amount: 100,\n order_date: '2024-08-01T00:00:00.000Z',\n order_id: 13,\n orders__order_date: undefined,\n orders__vendors: [\"swiggy's\"],\n product_id: '6',\n vendors: [\"swiggy's\"],\n },\n ],\n },\n ],\n [\n {\n testName: 'Not In',\n expectedSQL: `SELECT orders.* FROM (SELECT customer_id AS orders__customer_id, product_id AS orders__product_id, * FROM (select * from orders) AS orders) AS orders WHERE (((orders__customer_id NOT IN ('1', '2')) OR (orders__customer_id IS NULL)) AND (orders__product_id = '3'))`,\n cubeInput: {\n measures: ['*'],\n filters: [\n {\n and: [\n {\n member: 'orders.customer_id',\n operator: 'notIn',\n values: ['1', '2'],\n },\n {\n member: 'orders.product_id',\n operator: 'equals',\n values: ['3'],\n },\n ],\n },\n ],\n dimensions: [],\n },\n expectedOutput: [\n {\n customer_id: '4',\n order_amount: 90,\n order_date: '2022-05-01T00:00:00.000Z',\n order_id: 7,\n orders__customer_id: '4',\n orders__order_date: undefined,\n orders__product_id: '3',\n product_id: '3',\n vendors: ['myntra', 'flipkart'],\n },\n {\n customer_id: '6',\n order_amount: 120,\n order_date: '2022-06-01T00:00:00.000Z',\n order_id: 10,\n orders__customer_id: '6',\n orders__order_date: undefined,\n orders__product_id: '3',\n product_id: '3',\n vendors: ['myntra', 'amazon'],\n },\n {\n customer_id: '6aa6',\n order_amount: 0,\n order_date: '2024-06-01T00:00:00.000Z',\n order_id: 11,\n orders__customer_id: '6aa6',\n orders__order_date: undefined,\n orders__product_id: '3',\n product_id: '3',\n vendors: ['amazon'],\n },\n {\n customer_id: null,\n order_amount: 100,\n order_date: '2024-07-01T00:00:00.000Z',\n order_id: 12,\n orders__customer_id: null,\n orders__order_date: undefined,\n orders__product_id: '3',\n product_id: '3',\n vendors: ['flipkart'],\n },\n ],\n },\n {\n testName: 'Not In for array type',\n expectedSQL: `SELECT orders.* FROM (SELECT vendors AS orders__vendors, * FROM (select * from orders) AS orders) AS orders WHERE ((NOT (orders__vendors && (ARRAY['myntra', 'amazon']))) OR (orders__vendors IS NULL))`,\n cubeInput: {\n measures: ['*'],\n filters: [\n {\n member: 'orders.vendors',\n operator: 'notIn',\n values: ['myntra', 'amazon'],\n },\n ],\n dimensions: [],\n },\n expectedOutput: [\n {\n customer_id: '2',\n order_amount: 25,\n order_date: '2022-02-01T00:00:00.000Z',\n order_id: 3,\n orders__order_date: undefined,\n orders__vendors: [],\n product_id: '3',\n vendors: [],\n },\n {\n customer_id: '2',\n order_amount: 75,\n order_date: '2022-03-01T00:00:00.000Z',\n order_id: 4,\n orders__order_date: undefined,\n orders__vendors: ['flipkart'],\n product_id: '1',\n vendors: ['flipkart'],\n },\n {\n customer_id: '4',\n order_amount: 45,\n order_date: '2022-04-01T00:00:00.000Z',\n order_id: 6,\n orders__order_date: undefined,\n orders__vendors: [],\n product_id: '2',\n vendors: [],\n },\n {\n customer_id: '5',\n order_amount: 85,\n order_date: '2022-05-05T00:00:00.000Z',\n order_id: 9,\n orders__order_date: undefined,\n orders__vendors: [],\n product_id: '2',\n vendors: [],\n },\n {\n customer_id: null,\n order_amount: 100,\n order_date: '2024-07-01T00:00:00.000Z',\n order_id: 12,\n orders__order_date: undefined,\n orders__vendors: ['flipkart'],\n product_id: '3',\n vendors: ['flipkart'],\n },\n {\n customer_id: '7',\n order_amount: 100,\n order_date: '2024-08-01T00:00:00.000Z',\n order_id: 13,\n orders__order_date: undefined,\n orders__vendors: [\"swiggy's\"],\n product_id: '6',\n vendors: [\"swiggy's\"],\n },\n {\n customer_id: '8',\n order_amount: 50,\n order_date: '2024-09-01T00:00:00.000Z',\n order_id: 14,\n orders__order_date: undefined,\n orders__vendors: null,\n product_id: '1',\n vendors: null,\n },\n ],\n },\n ],\n [\n {\n testName: 'In filter with number[] values',\n expectedSQL: `SELECT orders.* FROM (SELECT order_id AS orders__order_id, * FROM (select * from orders) AS orders) AS orders WHERE (orders__order_id IN (1, 2, 3))`,\n cubeInput: {\n measures: ['*'],\n filters: [\n {\n member: 'orders.order_id',\n operator: 'in',\n values: [1, 2, 3],\n },\n ],\n dimensions: [],\n },\n expectedOutput: [\n {\n order_id: 1,\n orders__order_id: 1,\n customer_id: '1',\n product_id: '1',\n order_date: '2022-01-01',\n order_amount: 50.0,\n vendors: ['myntra', 'amazon', 'flipkart'],\n },\n {\n order_id: 2,\n orders__order_id: 2,\n customer_id: '1',\n product_id: '2',\n order_date: '2022-01-02',\n order_amount: 80.0,\n vendors: ['myntra'],\n },\n {\n order_id: 3,\n orders__order_id: 3,\n customer_id: '2',\n product_id: '3',\n order_date: '2022-02-01',\n order_amount: 25.0,\n vendors: [],\n },\n ],\n },\n ],\n];\n"],"names":["TEST_DATA_WITH_SAFE_ALIAS","testName","expectedSQL","cubeInput","measures","filters","dimensions","limit","expectedOutput","orders__order_month","orders__total_order_amount","order","orders__customer_id","member","operator","values","order_id","customer_id","product_id","order_date","order_amount","vendors","and","orders__order_date","undefined","orders__order_amount","orders__product_id","orders__vendors","orders__order_id"],"mappings":";+BAAaA;;;eAAAA;;;AAAN,MAAMA,4BAA4B;IACvC;QACE;YACEC,UAAU;YACVC,aAAa,CAAC,2OAA2O,CAAC;YAC1PC,WAAW;gBACTC,UAAU;oBAAC;iBAA4B;gBACvCC,SAAS,EAAE;gBACXC,YAAY;oBAAC;iBAAqB;gBAClCC,OAAO;YACT;YACAC,gBAAgB;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iBAAI;gBACfC,SAAS;oBACP;wBACEQ,QAAQ;wBACRC,UAAU;wBACVC,QAAQ;4BAAC;4BAAG;4BAAG;yBAAE;oBACnB;iBACD;gBACDT,YAAY,EAAE;YAChB;YACAE,gBAAgB;gBACd;oBACEQ,UAAU;oBACVY,kBAAkB;oBAClBX,aAAa;oBACbC,YAAY;oBACZC,YAAY;oBACZC,cAAc;oBACdC,SAAS;wBAAC;wBAAU;wBAAU;qBAAW;gBAC3C;gBACA;oBACEL,UAAU;oBACVY,kBAAkB;oBAClBX,aAAa;oBACbC,YAAY;oBACZC,YAAY;oBACZC,cAAc;oBACdC,SAAS;wBAAC;qBAAS;gBACrB;gBACA;oBACEL,UAAU;oBACVY,kBAAkB;oBAClBX,aAAa;oBACbC,YAAY;oBACZC,YAAY;oBACZC,cAAc;oBACdC,SAAS,EAAE;gBACb;aACD;QACH;KACD;CACF"}
|
|
@@ -0,0 +1,214 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Test Helper Utilities
|
|
3
|
+
*
|
|
4
|
+
* Common utilities for Vitest-based comprehensive tests
|
|
5
|
+
*/ "use strict";
|
|
6
|
+
function _export(target, all) {
|
|
7
|
+
for(var name in all)Object.defineProperty(target, name, {
|
|
8
|
+
enumerable: true,
|
|
9
|
+
get: all[name]
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
_export(exports, {
|
|
13
|
+
BatchErrorReporter: function() {
|
|
14
|
+
return BatchErrorReporter;
|
|
15
|
+
},
|
|
16
|
+
compareNumbers: function() {
|
|
17
|
+
return compareNumbers;
|
|
18
|
+
},
|
|
19
|
+
compareResults: function() {
|
|
20
|
+
return compareResults;
|
|
21
|
+
},
|
|
22
|
+
createReferenceSQL: function() {
|
|
23
|
+
return createReferenceSQL;
|
|
24
|
+
},
|
|
25
|
+
formatSQL: function() {
|
|
26
|
+
return formatSQL;
|
|
27
|
+
},
|
|
28
|
+
generateTestCases: function() {
|
|
29
|
+
return generateTestCases;
|
|
30
|
+
},
|
|
31
|
+
measureExecutionTime: function() {
|
|
32
|
+
return measureExecutionTime;
|
|
33
|
+
},
|
|
34
|
+
retryWithBackoff: function() {
|
|
35
|
+
return retryWithBackoff;
|
|
36
|
+
},
|
|
37
|
+
validateAgainstReference: function() {
|
|
38
|
+
return validateAgainstReference;
|
|
39
|
+
},
|
|
40
|
+
validatePerformance: function() {
|
|
41
|
+
return validatePerformance;
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
const _extends = require("@swc/helpers/_/_extends");
|
|
45
|
+
const _duckdbexec = require("../../../duckdb-exec");
|
|
46
|
+
let BatchErrorReporter = class BatchErrorReporter {
|
|
47
|
+
/**
|
|
48
|
+
* Add an error to the batch
|
|
49
|
+
*/ addError(testCase, error, context) {
|
|
50
|
+
this.errors.push({
|
|
51
|
+
testCase,
|
|
52
|
+
error,
|
|
53
|
+
context
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Check if there are any errors
|
|
58
|
+
*/ hasErrors() {
|
|
59
|
+
return this.errors.length > 0;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Get count of errors
|
|
63
|
+
*/ getErrorCount() {
|
|
64
|
+
return this.errors.length;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Get all errors
|
|
68
|
+
*/ getErrors() {
|
|
69
|
+
return this.errors;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Throw if there are any errors, with a comprehensive report
|
|
73
|
+
*/ throwIfErrors() {
|
|
74
|
+
if (this.errors.length === 0) {
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
const report = this.errors.map((e, idx)=>{
|
|
78
|
+
let msg = `\n${idx + 1}. ❌ ${e.testCase}\n Error: ${e.error.message}`;
|
|
79
|
+
if (e.context) {
|
|
80
|
+
msg += `\n Context: ${JSON.stringify(e.context, null, 2)}`;
|
|
81
|
+
}
|
|
82
|
+
if (e.error.stack) {
|
|
83
|
+
const stackLines = e.error.stack.split('\n').slice(1, 3);
|
|
84
|
+
msg += `\n ${stackLines.join('\n ')}`;
|
|
85
|
+
}
|
|
86
|
+
return msg;
|
|
87
|
+
}).join('\n');
|
|
88
|
+
throw new Error(`\n${'='.repeat(80)}\n` + `${this.errors.length} TEST(S) FAILED:\n` + `${'='.repeat(80)}` + report + `\n${'='.repeat(80)}\n`);
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Clear all errors
|
|
92
|
+
*/ clear() {
|
|
93
|
+
this.errors = [];
|
|
94
|
+
}
|
|
95
|
+
constructor(){
|
|
96
|
+
this.errors = [];
|
|
97
|
+
}
|
|
98
|
+
};
|
|
99
|
+
function compareNumbers(actual, expected, tolerance = 0.0001) {
|
|
100
|
+
return Math.abs(actual - expected) <= tolerance;
|
|
101
|
+
}
|
|
102
|
+
function compareResults(actual, expected, options = {}) {
|
|
103
|
+
const { numericTolerance = 0.0001, ignoreOrder = false, ignoreFields = [] } = options;
|
|
104
|
+
if (actual.length !== expected.length) {
|
|
105
|
+
return {
|
|
106
|
+
match: false,
|
|
107
|
+
diff: `Row count mismatch: expected ${expected.length}, got ${actual.length}`
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
// Sort if ignoring order
|
|
111
|
+
const actualSorted = ignoreOrder ? [
|
|
112
|
+
...actual
|
|
113
|
+
].sort() : actual;
|
|
114
|
+
const expectedSorted = ignoreOrder ? [
|
|
115
|
+
...expected
|
|
116
|
+
].sort() : expected;
|
|
117
|
+
for(let i = 0; i < actualSorted.length; i++){
|
|
118
|
+
const actualRow = actualSorted[i];
|
|
119
|
+
const expectedRow = expectedSorted[i];
|
|
120
|
+
for(const key in expectedRow){
|
|
121
|
+
if (ignoreFields.includes(key)) continue;
|
|
122
|
+
const actualVal = actualRow[key];
|
|
123
|
+
const expectedVal = expectedRow[key];
|
|
124
|
+
// Handle null/undefined
|
|
125
|
+
if (actualVal === null && expectedVal === null) continue;
|
|
126
|
+
if (actualVal === undefined && expectedVal === undefined) continue;
|
|
127
|
+
if (actualVal === null && expectedVal === undefined) continue;
|
|
128
|
+
if (actualVal === undefined && expectedVal === null) continue;
|
|
129
|
+
// Handle numeric comparison with tolerance
|
|
130
|
+
if (typeof expectedVal === 'number' && typeof actualVal === 'number') {
|
|
131
|
+
if (!compareNumbers(actualVal, expectedVal, numericTolerance)) {
|
|
132
|
+
return {
|
|
133
|
+
match: false,
|
|
134
|
+
diff: `Row ${i}, field '${key}': expected ${expectedVal}, got ${actualVal} (diff: ${Math.abs(actualVal - expectedVal)})`
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
} else if (actualVal !== expectedVal) {
|
|
138
|
+
return {
|
|
139
|
+
match: false,
|
|
140
|
+
diff: `Row ${i}, field '${key}': expected ${JSON.stringify(expectedVal)}, got ${JSON.stringify(actualVal)}`
|
|
141
|
+
};
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
return {
|
|
146
|
+
match: true
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
function createReferenceSQL(options) {
|
|
150
|
+
const { select, from, where, groupBy, orderBy, limit } = options;
|
|
151
|
+
let sql = `SELECT ${select.join(', ')} FROM ${from}`;
|
|
152
|
+
if (where) {
|
|
153
|
+
sql += ` WHERE ${where}`;
|
|
154
|
+
}
|
|
155
|
+
if (groupBy && groupBy.length > 0) {
|
|
156
|
+
sql += ` GROUP BY ${groupBy.join(', ')}`;
|
|
157
|
+
}
|
|
158
|
+
if (orderBy && orderBy.length > 0) {
|
|
159
|
+
sql += ` ORDER BY ${orderBy.join(', ')}`;
|
|
160
|
+
}
|
|
161
|
+
if (limit) {
|
|
162
|
+
sql += ` LIMIT ${limit}`;
|
|
163
|
+
}
|
|
164
|
+
return sql;
|
|
165
|
+
}
|
|
166
|
+
async function measureExecutionTime(fn) {
|
|
167
|
+
const startTime = Date.now();
|
|
168
|
+
const result = await fn();
|
|
169
|
+
const duration = Date.now() - startTime;
|
|
170
|
+
return {
|
|
171
|
+
result,
|
|
172
|
+
duration
|
|
173
|
+
};
|
|
174
|
+
}
|
|
175
|
+
function validatePerformance(duration, budgetMs, queryDescription) {
|
|
176
|
+
if (duration > budgetMs) {
|
|
177
|
+
throw new Error(`Performance budget exceeded for "${queryDescription}": ` + `expected < ${budgetMs}ms, got ${duration}ms`);
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
async function validateAgainstReference(meerkatResult, referenceSQL, options) {
|
|
181
|
+
const referenceResult = await (0, _duckdbexec.duckdbExec)(referenceSQL);
|
|
182
|
+
const comparison = compareResults(meerkatResult, referenceResult, options);
|
|
183
|
+
if (!comparison.match) {
|
|
184
|
+
throw new Error(`Result mismatch with reference SQL:\n` + ` Reference SQL: ${referenceSQL}\n` + ` Difference: ${comparison.diff}\n` + ` Meerkat rows: ${meerkatResult.length}\n` + ` Reference rows: ${referenceResult.length}`);
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
function generateTestCases(template, variations) {
|
|
188
|
+
return variations.map((variation)=>_extends._({}, template, variation));
|
|
189
|
+
}
|
|
190
|
+
function formatSQL(sql, maxLength = 200) {
|
|
191
|
+
if (sql.length <= maxLength) {
|
|
192
|
+
return sql;
|
|
193
|
+
}
|
|
194
|
+
return sql.substring(0, maxLength) + '...';
|
|
195
|
+
}
|
|
196
|
+
async function retryWithBackoff(fn, options = {}) {
|
|
197
|
+
const { maxRetries = 3, initialDelay = 100, maxDelay = 5000, backoffMultiplier = 2 } = options;
|
|
198
|
+
let lastError;
|
|
199
|
+
let delay = initialDelay;
|
|
200
|
+
for(let attempt = 0; attempt <= maxRetries; attempt++){
|
|
201
|
+
try {
|
|
202
|
+
return await fn();
|
|
203
|
+
} catch (error) {
|
|
204
|
+
lastError = error;
|
|
205
|
+
if (attempt < maxRetries) {
|
|
206
|
+
await new Promise((resolve)=>setTimeout(resolve, delay));
|
|
207
|
+
delay = Math.min(delay * backoffMultiplier, maxDelay);
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
throw lastError;
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
//# sourceMappingURL=test-helpers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../meerkat-node/src/__tests__/comprehensive/helpers/test-helpers.ts"],"sourcesContent":["/**\n * Test Helper Utilities\n *\n * Common utilities for Vitest-based comprehensive tests\n */\n\nimport { duckdbExec } from '../../../duckdb-exec';\n\n/**\n * Batch Error Reporter\n *\n * Collects multiple test failures and reports them together\n * instead of failing on the first error. Useful for data-driven tests.\n */\nexport class BatchErrorReporter {\n private errors: Array<{ testCase: string; error: Error; context?: any }> = [];\n\n /**\n * Add an error to the batch\n */\n addError(testCase: string, error: Error, context?: any): void {\n this.errors.push({ testCase, error, context });\n }\n\n /**\n * Check if there are any errors\n */\n hasErrors(): boolean {\n return this.errors.length > 0;\n }\n\n /**\n * Get count of errors\n */\n getErrorCount(): number {\n return this.errors.length;\n }\n\n /**\n * Get all errors\n */\n getErrors() {\n return this.errors;\n }\n\n /**\n * Throw if there are any errors, with a comprehensive report\n */\n throwIfErrors(): void {\n if (this.errors.length === 0) {\n return;\n }\n\n const report = this.errors\n .map((e, idx) => {\n let msg = `\\n${idx + 1}. ❌ ${e.testCase}\\n Error: ${\n e.error.message\n }`;\n if (e.context) {\n msg += `\\n Context: ${JSON.stringify(e.context, null, 2)}`;\n }\n if (e.error.stack) {\n const stackLines = e.error.stack.split('\\n').slice(1, 3);\n msg += `\\n ${stackLines.join('\\n ')}`;\n }\n return msg;\n })\n .join('\\n');\n\n throw new Error(\n `\\n${'='.repeat(80)}\\n` +\n `${this.errors.length} TEST(S) FAILED:\\n` +\n `${'='.repeat(80)}` +\n report +\n `\\n${'='.repeat(80)}\\n`\n );\n }\n\n /**\n * Clear all errors\n */\n clear(): void {\n this.errors = [];\n }\n}\n\n/**\n * Compare numeric values with tolerance for floating-point precision\n */\nexport function compareNumbers(\n actual: number,\n expected: number,\n tolerance = 0.0001\n): boolean {\n return Math.abs(actual - expected) <= tolerance;\n}\n\n/**\n * Compare query results with tolerance for numeric fields\n */\nexport function compareResults(\n actual: any[],\n expected: any[],\n options: {\n numericTolerance?: number;\n ignoreOrder?: boolean;\n ignoreFields?: string[];\n } = {}\n): { match: boolean; diff?: string } {\n const {\n numericTolerance = 0.0001,\n ignoreOrder = false,\n ignoreFields = [],\n } = options;\n\n if (actual.length !== expected.length) {\n return {\n match: false,\n diff: `Row count mismatch: expected ${expected.length}, got ${actual.length}`,\n };\n }\n\n // Sort if ignoring order\n const actualSorted = ignoreOrder ? [...actual].sort() : actual;\n const expectedSorted = ignoreOrder ? [...expected].sort() : expected;\n\n for (let i = 0; i < actualSorted.length; i++) {\n const actualRow = actualSorted[i];\n const expectedRow = expectedSorted[i];\n\n for (const key in expectedRow) {\n if (ignoreFields.includes(key)) continue;\n\n const actualVal = actualRow[key];\n const expectedVal = expectedRow[key];\n\n // Handle null/undefined\n if (actualVal === null && expectedVal === null) continue;\n if (actualVal === undefined && expectedVal === undefined) continue;\n if (actualVal === null && expectedVal === undefined) continue;\n if (actualVal === undefined && expectedVal === null) continue;\n\n // Handle numeric comparison with tolerance\n if (typeof expectedVal === 'number' && typeof actualVal === 'number') {\n if (!compareNumbers(actualVal, expectedVal, numericTolerance)) {\n return {\n match: false,\n diff: `Row ${i}, field '${key}': expected ${expectedVal}, got ${actualVal} (diff: ${Math.abs(\n actualVal - expectedVal\n )})`,\n };\n }\n } else if (actualVal !== expectedVal) {\n return {\n match: false,\n diff: `Row ${i}, field '${key}': expected ${JSON.stringify(\n expectedVal\n )}, got ${JSON.stringify(actualVal)}`,\n };\n }\n }\n }\n\n return { match: true };\n}\n\n/**\n * Create a reference SQL query for validation\n * This is the \"oracle\" pattern - we create direct SQL to validate Meerkat's output\n */\nexport function createReferenceSQL(options: {\n select: string[];\n from: string;\n where?: string;\n groupBy?: string[];\n orderBy?: string[];\n limit?: number;\n}): string {\n const { select, from, where, groupBy, orderBy, limit } = options;\n\n let sql = `SELECT ${select.join(', ')} FROM ${from}`;\n\n if (where) {\n sql += ` WHERE ${where}`;\n }\n\n if (groupBy && groupBy.length > 0) {\n sql += ` GROUP BY ${groupBy.join(', ')}`;\n }\n\n if (orderBy && orderBy.length > 0) {\n sql += ` ORDER BY ${orderBy.join(', ')}`;\n }\n\n if (limit) {\n sql += ` LIMIT ${limit}`;\n }\n\n return sql;\n}\n\n/**\n * Measure execution time of a function\n */\nexport async function measureExecutionTime<T>(\n fn: () => Promise<T>\n): Promise<{ result: T; duration: number }> {\n const startTime = Date.now();\n const result = await fn();\n const duration = Date.now() - startTime;\n\n return { result, duration };\n}\n\n/**\n * Validate query performance against a budget\n */\nexport function validatePerformance(\n duration: number,\n budgetMs: number,\n queryDescription: string\n): void {\n if (duration > budgetMs) {\n throw new Error(\n `Performance budget exceeded for \"${queryDescription}\": ` +\n `expected < ${budgetMs}ms, got ${duration}ms`\n );\n }\n}\n\n/**\n * Execute a reference SQL and validate against Meerkat result\n */\nexport async function validateAgainstReference(\n meerkatResult: any[],\n referenceSQL: string,\n options?: {\n numericTolerance?: number;\n ignoreOrder?: boolean;\n ignoreFields?: string[];\n }\n): Promise<void> {\n const referenceResult = await duckdbExec<any[]>(referenceSQL);\n const comparison = compareResults(meerkatResult, referenceResult, options);\n\n if (!comparison.match) {\n throw new Error(\n `Result mismatch with reference SQL:\\n` +\n ` Reference SQL: ${referenceSQL}\\n` +\n ` Difference: ${comparison.diff}\\n` +\n ` Meerkat rows: ${meerkatResult.length}\\n` +\n ` Reference rows: ${referenceResult.length}`\n );\n }\n}\n\n/**\n * Generate test cases for a data-driven test\n */\nexport function generateTestCases<T>(\n template: T,\n variations: Array<Partial<T>>\n): T[] {\n return variations.map((variation) => ({ ...template, ...variation }));\n}\n\n/**\n * Format SQL for error messages (truncate if too long)\n */\nexport function formatSQL(sql: string, maxLength = 200): string {\n if (sql.length <= maxLength) {\n return sql;\n }\n return sql.substring(0, maxLength) + '...';\n}\n\n/**\n * Retry a function with exponential backoff\n * Useful for flaky operations\n */\nexport async function retryWithBackoff<T>(\n fn: () => Promise<T>,\n options: {\n maxRetries?: number;\n initialDelay?: number;\n maxDelay?: number;\n backoffMultiplier?: number;\n } = {}\n): Promise<T> {\n const {\n maxRetries = 3,\n initialDelay = 100,\n maxDelay = 5000,\n backoffMultiplier = 2,\n } = options;\n\n let lastError: Error | undefined;\n let delay = initialDelay;\n\n for (let attempt = 0; attempt <= maxRetries; attempt++) {\n try {\n return await fn();\n } catch (error) {\n lastError = error as Error;\n\n if (attempt < maxRetries) {\n await new Promise((resolve) => setTimeout(resolve, delay));\n delay = Math.min(delay * backoffMultiplier, maxDelay);\n }\n }\n }\n\n throw lastError;\n}\n"],"names":["BatchErrorReporter","compareNumbers","compareResults","createReferenceSQL","formatSQL","generateTestCases","measureExecutionTime","retryWithBackoff","validateAgainstReference","validatePerformance","addError","testCase","error","context","errors","push","hasErrors","length","getErrorCount","getErrors","throwIfErrors","report","map","e","idx","msg","message","JSON","stringify","stack","stackLines","split","slice","join","Error","repeat","clear","actual","expected","tolerance","Math","abs","options","numericTolerance","ignoreOrder","ignoreFields","match","diff","actualSorted","sort","expectedSorted","i","actualRow","expectedRow","key","includes","actualVal","expectedVal","undefined","select","from","where","groupBy","orderBy","limit","sql","fn","startTime","Date","now","result","duration","budgetMs","queryDescription","meerkatResult","referenceSQL","referenceResult","duckdbExec","comparison","template","variations","variation","maxLength","substring","maxRetries","initialDelay","maxDelay","backoffMultiplier","lastError","delay","attempt","Promise","resolve","setTimeout","min"],"mappings":"AAAA;;;;CAIC;;;;;;;;IAUYA,kBAAkB;eAAlBA;;IA2EGC,cAAc;eAAdA;;IAWAC,cAAc;eAAdA;;IAsEAC,kBAAkB;eAAlBA;;IAmGAC,SAAS;eAATA;;IAVAC,iBAAiB;eAAjBA;;IAvDMC,oBAAoB;eAApBA;;IA4EAC,gBAAgB;eAAhBA;;IA/CAC,wBAAwB;eAAxBA;;IAhBNC,mBAAmB;eAA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