@devrev/meerkat-node 0.0.93 → 0.0.95
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/__tests__/test-data.js +1061 -1010
- package/__tests__/test-data.js.map +1 -1
- package/cube-to-sql/cube-to-sql.js.map +1 -1
- package/cube-to-sql-with-resolution/cube-to-sql-with-resolution.js +38 -0
- package/cube-to-sql-with-resolution/cube-to-sql-with-resolution.js.map +1 -0
- package/package.json +1 -1
- package/src/__tests__/test-data.d.ts +10 -28
- package/src/cube-to-sql/cube-to-sql.d.ts +1 -2
- package/src/cube-to-sql-with-resolution/cube-to-sql-with-resolution.d.ts +8 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../meerkat-node/src/__tests__/test-data.ts"],"sourcesContent":["export const CREATE_TEST_TABLE = `\nCREATE TABLE orders (\n order_id INTEGER,\n customer_id VARCHAR,\n product_id VARCHAR,\n order_date DATE,\n order_amount FLOAT,\n vendors VARCHAR[]\n);\n`;\n\nexport const INPUT_DATA_QUERY = `\nINSERT INTO orders VALUES\n(1, '1', '1', '2022-01-01', 50, ['myntra', 'amazon', 'flipkart']),\n(2, '1', '2', '2022-01-02', 80, ['myntra']),\n(3, '2', '3', '2022-02-01', 25, []),\n(4, '2', '1', '2022-03-01', 75, ['flipkart']),\n(5, '3', '1', '2022-03-02', 100, ['myntra', 'amazon', 'flipkart']),\n(6, '4', '2', '2022-04-01', 45, []),\n(7, '4', '3', '2022-05-01', 90, ['myntra', 'flipkart']),\n(8, '5', '1', '2022-05-02', 65, ['amazon', 'flipkart']),\n(9, '5', '2', '2022-05-05', 85, []),\n(10, '6', '3', '2022-06-01', 120, ['myntra', 'amazon']),\n(11, '6aa6', '3', '2024-06-01', 0, ['amazon']),\n(12, NULL, '3', '2024-07-01', 100, ['flipkart']);\n`;\n\nexport const TABLE_SCHEMA = {\n name: 'orders',\n sql: 'select * from orders',\n measures: [\n {\n name: 'order_amount',\n sql: 'order_amount',\n type: 'number',\n },\n {\n name: 'total_order_amount',\n sql: 'SUM(order_amount)',\n type: 'number',\n },\n ],\n dimensions: [\n {\n name: 'order_date',\n sql: 'order_date',\n type: 'time',\n },\n {\n name: 'order_id',\n sql: 'order_id',\n type: 'number',\n },\n {\n name: 'customer_id',\n sql: 'customer_id',\n type: 'string',\n },\n {\n name: 'product_id',\n sql: 'product_id',\n type: 'string',\n },\n {\n name: 'order_month',\n sql: `DATE_TRUNC('month', order_date)`,\n type: 'string',\n },\n {\n name: 'vendors',\n sql: 'vendors',\n type: 'string_array',\n }\n ],\n};\n\nexport const TEST_DATA = [\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 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\": \"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\": 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 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: [\n \"myntra\",\n \"amazon\",\n \"flipkart\",\n ],\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: [\n \"myntra\",\n ],\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\": [\n \"flipkart\",\n ],\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: [\n \"myntra\",\n \"amazon\",\n \"flipkart\",\n ],\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\": [\n \"myntra\",\n \"flipkart\",\n ],\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: [\n \"amazon\",\n \"flipkart\",\n ],\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\": [\n \"myntra\",\n \"amazon\",\n ],\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\": [\n \"amazon\",\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 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: [\n \"myntra\",\n \"amazon\",\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\": [\n \"myntra\",\n ],\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\": [\n \"flipkart\",\n ],\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\": [\n \"myntra\",\n \"amazon\",\n \"flipkart\",\n ],\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\": [\n \"myntra\",\n \"flipkart\",\n ],\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\": [\n \"amazon\",\n \"flipkart\",\n ],\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\": [\n \"myntra\",\n \"amazon\",\n ],\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\": [\n \"flipkart\",\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\": [\n \"amazon\",\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\": [\n \"flipkart\",\n ],\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\": [\n \"myntra\",\n \"amazon\",\n \"flipkart\",\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\": [\n \"myntra\",\n \"amazon\",\n \"flipkart\",\n ],\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\": [\n \"myntra\",\n ],\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\": [\n \"myntra\",\n \"flipkart\",\n ],\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\": [\n \"amazon\",\n \"flipkart\",\n ],\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\": [\n \"myntra\",\n \"amazon\",\n ],\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\": [\n \"amazon\",\n ],\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\": [\n \"flipkart\",\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 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\": [\n \"flipkart\",\n ],\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\": [\n \"myntra\",\n \"amazon\",\n \"flipkart\",\n ],\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\": [\n \"myntra\",\n \"flipkart\",\n ],\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\": [\n \"amazon\",\n \"flipkart\",\n ],\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\": [\n \"myntra\",\n \"amazon\",\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\": [\n \"myntra\",\n \"flipkart\",\n ],\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\": [\n \"myntra\",\n \"amazon\",\n ],\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\": [\n \"amazon\",\n ],\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\": [\n \"flipkart\",\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 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: [\n \"myntra\",\n \"amazon\",\n \"flipkart\",\n ],\n product_id: \"1\",\n vendors: [\n \"myntra\",\n \"amazon\",\n \"flipkart\",\n ],\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: [\n \"myntra\",\n ],\n product_id: \"2\",\n vendors: [\n \"myntra\",\n ],\n },\n ],\n },\n {\n testName: 'Not 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 NOT IN ('1', '2')) AND (NOT (orders__vendors && (ARRAY['myntra', 'flipkart']))))`,\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.vendors',\n operator: 'notIn',\n values: ['myntra', 'flipkart'],\n }\n ]\n }\n ],\n dimensions: [],\n },\n expectedOutput:[\n {\n \"customer_id\": \"4\",\n \"order_amount\": 45,\n \"order_date\": \"2022-04-01T00:00:00.000Z\",\n \"order_id\": 6,\n \"orders__customer_id\": \"4\",\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__customer_id\": \"5\",\n \"orders__order_date\": undefined,\n \"orders__vendors\": [],\n \"product_id\": \"2\",\n \"vendors\": [],\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__vendors\": [\n \"amazon\",\n ],\n \"product_id\": \"3\",\n \"vendors\": [\n \"amazon\",\n ],\n },\n ],\n },\n];\n"],"names":["CREATE_TEST_TABLE","INPUT_DATA_QUERY","TABLE_SCHEMA","TEST_DATA","name","sql","measures","type","dimensions","testName","expectedSQL","cubeInput","filters","limit","expectedOutput","orders__order_month","orders__total_order_amount","order","member","operator","values","order_id","customer_id","orders__customer_id","product_id","order_date","order_amount","vendors","and","orders__order_amount","undefined","orders__order_date","orders__vendors"],"mappings":";;;;;;;;IAAaA,iBAAiB;eAAjBA;;IAWAC,gBAAgB;eAAhBA;;IAgBAC,YAAY;eAAZA;;IAiDAC,SAAS;eAATA;;;AA5EN,MAAMH,oBAAoB,CAAC;;;;;;;;;AASlC,CAAC;AAEM,MAAMC,mBAAmB,CAAC;;;;;;;;;;;;;;AAcjC,CAAC;AAEM,MAAMC,eAAe;IAC1BE,MAAM;IACNC,KAAK;IACLC,UAAU;QACR;YACEF,MAAM;YACNC,KAAK;YACLE,MAAM;QACR;QACA;YACEH,MAAM;YACNC,KAAK;YACLE,MAAM;QACR;KACD;IACDC,YAAY;QACV;YACEJ,MAAM;YACNC,KAAK;YACLE,MAAM;QACR;QACA;YACEH,MAAM;YACNC,KAAK;YACLE,MAAM;QACR;QACA;YACEH,MAAM;YACNC,KAAK;YACLE,MAAM;QACR;QACA;YACEH,MAAM;YACNC,KAAK;YACLE,MAAM;QACR;QACA;YACEH,MAAM;YACNC,KAAK,CAAC,+BAA+B,CAAC;YACtCE,MAAM;QACR;QACA;YACEH,MAAM;YACNC,KAAK;YACLE,MAAM;QACR;KACD;AACH;AAEO,MAAMJ,YAAY;IACvB;QACEM,UAAU;QACVC,aAAa,CAAC,2OAA2O,CAAC;QAC1PC,WAAW;Y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WAAW;YACTL,UAAU;gBAAC;aAAI;YACfM,SAAS;gBACP;oBACEM,QAAQ;oBACRC,UAAU;oBACVC,QAAQ;wBAAC;qBAAI;gBACf;aACD;YACDZ,YAAY,EAAE;QAChB;QACAM,gBAAgB;YACd;gBACEO,UAAU;gBACVC,aAAa;gBACbC,qBAAqB;gBACrBC,YAAY;gBACZC,YAAY;gBACZC,cAAc;gBACdC,SAAS,EAAE;YACb;YACA;gBACEN,UAAU;gBACVC,aAAa;gBACbC,qBAAqB;gBACrBC,YAAY;gBACZC,YAAY;gBACZC,cAAc;gBACd,WAAY;oBACV;iBACD;YACH;YACA;gBACEL,UAAU;gBACVC,aAAa;gBACbC,qBAAqB;gBACrBC,YAAY;gBACZC,YAAY;gBACZC,cAAc;gBACdC,SAAU;oBACR;oBACA;oBACA;iBACD;YACH;YACA;gBACEN,UAAU;gBACVC,aAAa;gBACbC,qBAAqB;gBACrBC,YAAY;gBACZC,YAAY;gBACZC,cAAc;gBACdC,SAAS,EAAE;YACb;YACA;gBACEN,UAAU;gBACVC,aAAa;gBACbC,qBAAqB;gBACrBC,YAAY;gBACZC,YAAY;gBACZC,cAAc;gBACd,WAAW;oBACT;oBACA;iBACD;YACH;YACA;gBACEL,UAAU;gBACVC,aAAa;gBACbC,qBAAqB;gBACrBC,YAAY;gBACZC,YAAY;gBACZC,cAAc;gBACdC,SAAU;oBACR;oBACA;iBACD;YACH;YACA;gBACEN,UAAU;gBACVC,aAAa;gBACbC,qBAAqB;gBACrBC,YAAY;gBACZC,YAAY;gBACZC,cAAc;gBACd,WAAW,EAAE;YACf;YACA;gBACEL,UAAU;gBACVC,aAAa;gBACbC,qBAAqB;gBACrBC,YAAY;gBACZC,YAAY;gBACZC,cAAc;gBACd,WAAY;oBACV;oBACA;iBACD;YACH;YACA;gBACEL,UAAU;gBACVC,aAAa;gBACbC,qBAAqB;gBACrBC,YAAY;gBACZC,YAAY;gBACZC,cAAc;gBACd,WAAY;oBACV;iBACD;YACH;SACD;IACH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AK;gBAChB;aACD;YACDZ,YAAY,EAAE;QAChB;QACAM,gBAAgB;YACd;gBACEO,UAAU;gBACVC,aAAa;gBACbE,YAAY;gBACZC,YAAY;gBACZC,cAAc;gBACdG,sBAAsB;gBACtB,WAAY;oBACV;iBACD;YACH;YACA;gBACER,UAAU;gBACVC,aAAa;gBACbE,YAAY;gBACZC,YAAY;gBACZC,cAAc;gBACdG,sBAAsB;gBACtB,WAAY;oBACV;iBACD;YACH;YACA;gBACER,UAAU;gBACVC,aAAa;gBACbE,YAAY;gBACZC,YAAY;gBACZC,cAAc;gBACdG,sBAAsB;gBACtB,WAAW;oBACT;oBACA;oBACA;iBACD;YACH;YACA;gBACER,UAAU;gBACVC,aAAa;gBACbE,YAAY;gBACZC,YAAY;gBACZC,cAAc;gBACdG,sBAAsB;gBACtB,WAAW;oBACT;oBACA;iBACD;YACH;YACA;gBACER,UAAU;gBACVC,aAAa;gBACbE,YAAY;gBACZC,YAAY;gBACZC,cAAc;gBACdG,sBAAsB;gBACtB,WAAW;oBACT;oBACA;iBACD;YACH;YACA;gBACER,UAAU;gBACVC,aAAa;gBACbE,YAAY;gBACZC,YAAY;gBACZC,cAAc;gBACdG,sBAAsB;gBACtB,WAAW,EAAE;YACf;YACA;gBACER,UAAU;gBACVC,aAAa;gBACbE,YAAY;gBACZC,YAAY;gBACZC,cAAc;gBACdG,sBAAsB;gBACtB,WAAY;oBACV;oBACA;iBACD;YACH;YACA;gBACE,eAAe;gBACf,gBAAgB;gBAChB,cAAc;gBACd,YAAY;gBACZ,wBAAwB;gBACxB,sBAAsBC;gBACtB,cAAc;gBACd,WAAW;oBACT;iBACD;YACH;SACD;IACH;IACA;QACErB,UAAU;QACVC,aAAa,CAAC,8JAA8J,CAAC;QAC7KC,WAAW;YACTL,UAAU;gBAAC;aAAI;YACfM,SAAS;gBACP;oBACEM,QAAQ;oBACRC,UAAU;oBACVC,QAAQ;wBAAC;qBAAK;gBAChB;aACD;YACDZ,YAAY,EAAE;QAChB;Q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C,cAAc;gBACdK,oBAAoB;gBACpB,WAAW;oBACT;oBACA;oBACA;iBACD;YACH;YACA;gBACEV,UAAU;gBACVC,aAAa;gBACbE,YAAY;gBACZC,YAAY;gBACZC,cAAc;gBACdK,oBAAoB;gBACpB,WAAW;oBACT;iBACD;YACH;YACA;gBACEV,UAAU;gBACVC,aAAa;gBACbE,YAAY;gBACZC,YAAY;gBACZM,oBAAoB;gBACpBL,cAAc;gBACd,WAAW,EAAE;YACf;YACA;gBACEL,UAAU;gBACVC,aAAa;gBACbE,YAAY;gBACZC,YAAY;gBACZM,oBAAoB;gBACpBL,cAAc;gBACd,WAAW;oBACT;oBACA;iBACD;YACH;YACA;gBACEL,UAAU;gBACVC,aAAa;gBACbE,YAAY;gBACZC,YAAY;gBACZM,oBAAoB;gBACpBL,cAAc;gBACd,WAAW;oBACT;oBACA;iBACD;YACH;YACA;gBACEL,UAAU;gBACVC,aAAa;gBACbE,YAAY;gBACZC,YAAY;gBACZM,oBAAoB;gBACpBL,cAAc;gBACd,WAAW,EAAE;YACf;YACA;gBACEL,UAAU;gBACVC,aAAa;gBACbE,YAAY;gBACZC,YAAY;gBACZM,oBAAoB;gBACpBL,cAAc;gBACd,WAAW;oBACT;oBACA;iBACD;YACH;YACA;gBACEL,UAAU;gBACVC,aAAa;gBACbE,YAAY;gBACZC,YAAY;gBACZM,oBAAoB;gBACpBL,cAAc;gBACd,WAAW;oBACT;iBACD;YACH;YACA;gBACE,eAAe;gBACf,gBAAgB;gBAChB,cAAc;gBACd,YAAY;gBACZ,sBAAsB;gBACtB,cAAc;gBACd,WAAY;oBACV;iBACD;YACH;SACD;IACH;IACA,IAAI;IACJ,oBAAoB;IACpB,8LAA8L;IAC9L,iBAAiB;IACjB,uBAAuB;IACvB,iBAAiB;IACjB,UAAU;IACV,gBAAgB;IAChB,cAAc;IACd,6CAA6C;IAC7C,8BAA8B;IAC9B,8BAA8B;IAC9B,eAAe;IACf,cAAc;IACd,2CAA2C;IAC3C,uCAAuC;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AoB;gBACpBL,cAAc;gBACdG,sBAAsB;gBACtB,WAAY;oBACV;oBACA;oBACA;iBACD;YACH;YACA;gBACER,UAAU;gBACVC,aAAa;gBACbE,YAAY;gBACZC,YAAY;gBACZM,oBAAoB;gBACpBL,cAAc;gBACdG,sBAAsB;gBACtB,WAAW;oBACT;oBACA;iBACD;YACH;YACA;gBACER,UAAU;gBACVC,aAAa;gBACbE,YAAY;gBACZC,YAAY;gBACZM,oBAAoB;gBACpBL,cAAc;gBACdG,sBAAsB;gBACtB,WAAW;oBACT;oBACA;iBACD;YACH;YACA;gBACER,UAAU;gBACVC,aAAa;gBACbE,YAAY;gBACZC,YAAY;gBACZM,oBAAoB;gBACpBL,cAAc;gBACdG,sBAAsB;gBACtB,WAAW,EAAE;YACf;YACA;gBACER,UAAU;gBACVC,aAAa;gBACbE,YAAY;gBACZC,YAAY;gBACZM,oBAAoB;gBACpBL,cAAc;gBACdG,sBAAsB;gBACtB,WAAY;oBACV;oBACA;iBACD;YACH;SACD;IACH;IACA;QACEpB,UAAU;QACVC,aAAa,CAAC,wOAAwO,CAAC;QACvPC,WAAW;YACTL,UAAU;gBAAC;aAAI;YACfM,SAAS;gBACP;oBACEgB,KAAK;wBACH;4BACEV,QAAQ;4BACRC,UAAU;wBACZ;wBACA;4BACED,QAAQ;4BACRC,UAAU;4BACVC,QAAQ;gCAAC;6BAAI;wBACf;qBACH;gBACD;aACD;YACDZ,YAAY,EAAE;QAChB;QACAM,gBAAgB;YACd;gBACE,eAAe;gBACf,gBAAgB;gBAChB,cAAc;gBACd,YAAY;gBACZ,wBAAwB;gBACxB,sBAAsBgB;gBACtB,sBAAsB;gBACtB,cAAc;gBACd,WAAW,EAAE;YACf;YACA;gBACE,eAAe;gBACf,gBAAgB;gBAChB,cAAc;gBACd,YAAY;gBACZ,wBAAwB;gBACxB,sBAAsBA;gBACtB,sBAAsB;gBACtB,cAAc;gBACd,WAAW;oBACT;oBACA;iBACD;YACH;YACA;gBACE,eAAe;gBACf,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;gBACbI,cAAc;gBACdD,YAAY;gBACZJ,UAAU;gBACVE,qBAAqB;gBACrBQ,oBAAoBD;gBACpBE,iBAAkB;oBAChB;oBACA;oBACA;iBACD;gBACDR,YAAY;gBACZG,SAAU;oBACR;oBACA;oBACA;iBACD;YACH;YACA;gBACEL,aAAa;gBACbI,cAAc;gBACdD,YAAY;gBACZJ,UAAU;gBACVE,qBAAqB;gBACrBQ,oBAAoBD;gBACpBE,iBAAkB;oBAChB;iBACD;gBACDR,YAAY;gBACZG,SAAU;oBACR;iBACD;YACH;SACD;IACH;IACA;QACElB,UAAU;QACVC,aAAa,CAAC,4PAA4P,CAAC;QAC3QC,WAAW;YACTL,UAAU;gBAAC;aAAI;YACfM,SAAS;gBACP;oBACEgB,KAAK;wBACH;4BACEV,QAAQ;4BACRC,UAAU;4BACVC,QAAQ;gCAAC;gCAAK;6BAAI;wBACpB;wBACA;4BACEF,QAAQ;4BACRC,UAAU;4BACVC,QAAQ;gCAAC;gCAAU;6BAAW;wBAChC;qBACD;gBACH;aACD;YACDZ,YAAY,EAAE;QAChB;QACAM,gBAAe;YACb;gBACG,eAAe;gBACf,gBAAgB;gBAChB,cAAc;gBACd,YAAY;gBACZ,uBAAuB;gBACvB,sBAAsBgB;gBACtB,mBAAoB,EAAE;gBACtB,cAAc;gBACd,WAAY,EAAE;YACjB;YACA;gBACE,eAAe;gBACf,gBAAgB;gBAChB,cAAc;gBACd,YAAY;gBACZ,uBAAuB;gBACvB,sBAAsBA;gBACtB,mBAAoB,EAAE;gBACtB,cAAc;gBACd,WAAY,EAAE;YAClB;YACE;gBACE,eAAe;gBACf,gBAAgB;gBAChB,cAAc;gBACd,YAAY;gBACZ,uBAAuB;gBACvB,sBAAsBA;gBACtB,mBAAoB;oBAClB;iBACD;gBACD,cAAc;gBACd,WAAY;oBACV;iBACD;YACH;SACD;IACH;CACD"}
|
|
1
|
+
{"version":3,"sources":["../../../meerkat-node/src/__tests__/test-data.ts"],"sourcesContent":["export const CREATE_TEST_TABLE = `\nCREATE TABLE orders (\n order_id INTEGER,\n customer_id VARCHAR,\n product_id VARCHAR,\n order_date DATE,\n order_amount FLOAT,\n vendors VARCHAR[]\n);\n`;\n\nexport const INPUT_DATA_QUERY = `\nINSERT INTO orders VALUES\n(1, '1', '1', '2022-01-01', 50, ['myntra', 'amazon', 'flipkart']),\n(2, '1', '2', '2022-01-02', 80, ['myntra']),\n(3, '2', '3', '2022-02-01', 25, []),\n(4, '2', '1', '2022-03-01', 75, ['flipkart']),\n(5, '3', '1', '2022-03-02', 100, ['myntra', 'amazon', 'flipkart']),\n(6, '4', '2', '2022-04-01', 45, []),\n(7, '4', '3', '2022-05-01', 90, ['myntra', 'flipkart']),\n(8, '5', '1', '2022-05-02', 65, ['amazon', 'flipkart']),\n(9, '5', '2', '2022-05-05', 85, []),\n(10, '6', '3', '2022-06-01', 120, ['myntra', 'amazon']),\n(11, '6aa6', '3', '2024-06-01', 0, ['amazon']),\n(12, NULL, '3', '2024-07-01', 100, ['flipkart']);\n`;\n\nexport const TABLE_SCHEMA = {\n name: 'orders',\n sql: 'select * from orders',\n measures: [\n {\n name: 'order_amount',\n sql: 'order_amount',\n type: 'number',\n },\n {\n name: 'total_order_amount',\n sql: 'SUM(order_amount)',\n type: 'number',\n },\n ],\n dimensions: [\n {\n name: 'order_date',\n sql: 'order_date',\n type: 'time',\n },\n {\n name: 'order_id',\n sql: 'order_id',\n type: 'number',\n },\n {\n name: 'customer_id',\n sql: 'customer_id',\n type: 'string',\n },\n {\n name: 'product_id',\n sql: 'product_id',\n type: 'string',\n },\n {\n name: 'order_month',\n sql: `DATE_TRUNC('month', order_date)`,\n type: 'string',\n },\n {\n name: 'vendors',\n sql: 'vendors',\n type: 'string_array',\n },\n ],\n};\n\nexport const TEST_DATA = [\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: '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: 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 },\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 },\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 },\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 },\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 [\n {\n testName: 'Not 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 NOT IN ('1', '2')) AND (NOT (orders__vendors && (ARRAY['myntra', 'flipkart']))))`,\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.vendors',\n operator: 'notIn',\n values: ['myntra', 'flipkart'],\n },\n ],\n },\n ],\n dimensions: [],\n },\n expectedOutput: [\n {\n customer_id: '4',\n order_amount: 45,\n order_date: '2022-04-01T00:00:00.000Z',\n order_id: 6,\n orders__customer_id: '4',\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__customer_id: '5',\n orders__order_date: undefined,\n orders__vendors: [],\n product_id: '2',\n vendors: [],\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__vendors: ['amazon'],\n product_id: '3',\n vendors: ['amazon'],\n },\n ],\n },\n ],\n];\n"],"names":["CREATE_TEST_TABLE","INPUT_DATA_QUERY","TABLE_SCHEMA","TEST_DATA","name","sql","measures","type","dimensions","testName","expectedSQL","cubeInput","filters","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_amount","orders__order_date","undefined","orders__product_id","orders__vendors"],"mappings":";;;;;;;;IAAaA,iBAAiB;eAAjBA;;IAWAC,gBAAgB;eAAhBA;;IAgBAC,YAAY;eAAZA;;IAiDAC,SAAS;eAATA;;;AA5EN,MAAMH,oBAAoB,CAAC;;;;;;;;;AASlC,CAAC;AAEM,MAAMC,mBAAmB,CAAC;;;;;;;;;;;;;;AAcjC,CAAC;AAEM,MAAMC,eAAe;IAC1BE,MAAM;IACNC,KAAK;IACLC,UAAU;QACR;YACEF,MAAM;YACNC,KAAK;YACLE,MAAM;QACR;QACA;YACEH,MAAM;YACNC,KAAK;YACLE,MAAM;QACR;KACD;IACDC,YAAY;QACV;YACEJ,MAAM;YACNC,KAAK;YACLE,MAAM;QACR;QACA;YACEH,MAAM;YACNC,KAAK;YACLE,MAAM;QACR;QACA;YACEH,MAAM;YACNC,KAAK;YACLE,MAAM;QACR;QACA;YACEH,MAAM;YACNC,KAAK;YACLE,MAAM;QACR;QACA;YACEH,MAAM;YACNC,KAAK,CAAC,+BAA+B,CAAC;YACtCE,MAAM;QACR;QACA;YACEH,MAAM;YACNC,KAAK;YACLE,MAAM;QACR;KACD;AACH;AAEO,MAAMJ,YAAY;IACvB;QACE;YACEM,UAAU;YACVC,aAAa,CAAC,2OAA2O,CAAC;YAC1PC,WAAW;gBACTL,UAA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qBAAS;gBACrB;aACD;QACH;KACD;IACD;QACE;YACElB,UAAU;YACVC,aAAa,CAAC,4PAA4P,CAAC;YAC3QC,WAAW;gBACTL,UAAU;oBAAC;iBAAI;gBACfM,SAAS;oBACP;wBACEgB,KAAK;4BACH;gCACET,QAAQ;gCACRC,UAAU;gCACVC,QAAQ;oCAAC;oCAAK;iCAAI;4BACpB;4BACA;gCACEF,QAAQ;gCACRC,UAAU;gCACVC,QAAQ;oCAAC;oCAAU;iCAAW;4BAChC;yBACD;oBACH;iBACD;gBACDb,YAAY,EAAE;YAChB;YACAM,gBAAgB;gBACd;oBACES,aAAa;oBACbG,cAAc;oBACdD,YAAY;oBACZH,UAAU;oBACVJ,qBAAqB;oBACrBY,oBAAoBC;oBACpBE,iBAAiB,EAAE;oBACnBT,YAAY;oBACZG,SAAS,EAAE;gBACb;gBACA;oBACEJ,aAAa;oBACbG,cAAc;oBACdD,YAAY;oBACZH,UAAU;oBACVJ,qBAAqB;oBACrBY,oBAAoBC;oBACpBE,iBAAiB,EAAE;oBACnBT,YAAY;oBACZG,SAAS,EAAE;gBACb;gBACA;oBACEJ,aAAa;oBACbG,cAAc;oBACdD,YAAY;oBACZH,UAAU;oBACVJ,qBAAqB;oBACrBY,oBAAoBC;oBACpBE,iBAAiB;wBAAC;qBAAS;oBAC3BT,YAAY;oBACZG,SAAS;wBAAC;qBAAS;gBACrB;aACD;QACH;KACD;CACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../meerkat-node/src/cube-to-sql/cube-to-sql.ts"],"sourcesContent":["import {\n BASE_TABLE_NAME,\n ContextParams,\n Query,\n TableSchema,\n applyFilterParamsToBaseSQL,\n applyProjectionToSQLQuery,\n astDeserializerQuery,\n cubeToDuckdbAST,\n deserializeQuery,\n detectApplyContextParamsToBaseSQL,\n getCombinedTableSchema,\n getFilterParamsSQL,\n getFinalBaseSQL,\n} from '@devrev/meerkat-core';\nimport { duckdbExec } from '../duckdb-exec';\n\
|
|
1
|
+
{"version":3,"sources":["../../../meerkat-node/src/cube-to-sql/cube-to-sql.ts"],"sourcesContent":["import {\n BASE_TABLE_NAME,\n ContextParams,\n Query,\n TableSchema,\n applyFilterParamsToBaseSQL,\n applyProjectionToSQLQuery,\n astDeserializerQuery,\n cubeToDuckdbAST,\n deserializeQuery,\n detectApplyContextParamsToBaseSQL,\n getCombinedTableSchema,\n getFilterParamsSQL,\n getFinalBaseSQL,\n} from '@devrev/meerkat-core';\nimport { duckdbExec } from '../duckdb-exec';\n\nexport interface CubeQueryToSQLParams {\n query: Query;\n tableSchemas: TableSchema[];\n contextParams?: ContextParams;\n}\n\nexport const cubeQueryToSQL = async ({\n query,\n tableSchemas,\n contextParams,\n}: CubeQueryToSQLParams) => {\n const updatedTableSchemas: TableSchema[] = await Promise.all(\n tableSchemas.map(async (schema: TableSchema) => {\n const baseFilterParamsSQL = await getFinalBaseSQL({\n query,\n tableSchema: schema,\n getQueryOutput: duckdbExec,\n });\n return {\n ...schema,\n sql: baseFilterParamsSQL,\n };\n })\n );\n\n const updatedTableSchema = await getCombinedTableSchema(\n updatedTableSchemas,\n query\n );\n\n const ast = cubeToDuckdbAST(query, updatedTableSchema);\n if (!ast) {\n throw new Error('Could not generate AST');\n }\n\n const queryTemp = astDeserializerQuery(ast);\n\n const queryOutput = (await duckdbExec(queryTemp)) as Record<string, string>[];\n const preBaseQuery = deserializeQuery(queryOutput);\n\n const filterParamsSQL = await getFilterParamsSQL({\n query,\n tableSchema: updatedTableSchema,\n getQueryOutput: duckdbExec,\n });\n\n const filterParamQuery = applyFilterParamsToBaseSQL(\n updatedTableSchema.sql,\n filterParamsSQL\n );\n\n /**\n * Replace CONTEXT_PARAMS with context params\n */\n const baseQuery = detectApplyContextParamsToBaseSQL(\n filterParamQuery,\n contextParams || {}\n );\n\n /**\n * Replace BASE_TABLE_NAME with cube query\n */\n const replaceBaseTableName = preBaseQuery.replace(\n BASE_TABLE_NAME,\n `(${baseQuery}) AS ${updatedTableSchema.name}`\n );\n\n /**\n * Add measures to the query\n */\n const measures = query.measures;\n const dimensions = query.dimensions || [];\n const finalQuery = applyProjectionToSQLQuery(\n dimensions,\n measures,\n updatedTableSchema,\n replaceBaseTableName\n );\n\n return finalQuery;\n};\n"],"names":["cubeQueryToSQL","query","tableSchemas","contextParams","updatedTableSchemas","Promise","all","map","schema","baseFilterParamsSQL","getFinalBaseSQL","tableSchema","getQueryOutput","duckdbExec","sql","updatedTableSchema","getCombinedTableSchema","ast","cubeToDuckdbAST","Error","queryTemp","astDeserializerQuery","queryOutput","preBaseQuery","deserializeQuery","filterParamsSQL","getFilterParamsSQL","filterParamQuery","applyFilterParamsToBaseSQL","baseQuery","detectApplyContextParamsToBaseSQL","replaceBaseTableName","replace","BASE_TABLE_NAME","name","measures","dimensions","finalQuery","applyProjectionToSQLQuery"],"mappings":";+BAuBaA;;;eAAAA;;;;6BATN;4BACoB;AAQpB,MAAMA,iBAAiB,OAAO,EACnCC,KAAK,EACLC,YAAY,EACZC,aAAa,EACQ;IACrB,MAAMC,sBAAqC,MAAMC,QAAQC,GAAG,CAC1DJ,aAAaK,GAAG,CAAC,OAAOC;QACtB,MAAMC,sBAAsB,MAAMC,IAAAA,4BAAe,EAAC;YAChDT;YACAU,aAAaH;YACbI,gBAAgBC,sBAAU;QAC5B;QACA,OAAO,eACFL;YACHM,KAAKL;;IAET;IAGF,MAAMM,qBAAqB,MAAMC,IAAAA,mCAAsB,EACrDZ,qBACAH;IAGF,MAAMgB,MAAMC,IAAAA,4BAAe,EAACjB,OAAOc;IACnC,IAAI,CAACE,KAAK;QACR,MAAM,IAAIE,MAAM;IAClB;IAEA,MAAMC,YAAYC,IAAAA,iCAAoB,EAACJ;IAEvC,MAAMK,cAAe,MAAMT,IAAAA,sBAAU,EAACO;IACtC,MAAMG,eAAeC,IAAAA,6BAAgB,EAACF;IAEtC,MAAMG,kBAAkB,MAAMC,IAAAA,+BAAkB,EAAC;QAC/CzB;QACAU,aAAaI;QACbH,gBAAgBC,sBAAU;IAC5B;IAEA,MAAMc,mBAAmBC,IAAAA,uCAA0B,EACjDb,mBAAmBD,GAAG,EACtBW;IAGF;;GAEC,GACD,MAAMI,YAAYC,IAAAA,8CAAiC,EACjDH,kBACAxB,iBAAiB,CAAC;IAGpB;;GAEC,GACD,MAAM4B,uBAAuBR,aAAaS,OAAO,CAC/CC,4BAAe,EACf,CAAC,CAAC,EAAEJ,UAAU,KAAK,EAAEd,mBAAmBmB,IAAI,CAAC,CAAC;IAGhD;;GAEC,GACD,MAAMC,WAAWlC,MAAMkC,QAAQ;IAC/B,MAAMC,aAAanC,MAAMmC,UAAU,IAAI,EAAE;IACzC,MAAMC,aAAaC,IAAAA,sCAAyB,EAC1CF,YACAD,UACApB,oBACAgB;IAGF,OAAOM;AACT"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "cubeQueryToSQLWithResolution", {
|
|
3
|
+
enumerable: true,
|
|
4
|
+
get: function() {
|
|
5
|
+
return cubeQueryToSQLWithResolution;
|
|
6
|
+
}
|
|
7
|
+
});
|
|
8
|
+
const _meerkatcore = require("@devrev/meerkat-core");
|
|
9
|
+
const _cubetosql = require("../cube-to-sql/cube-to-sql");
|
|
10
|
+
const cubeQueryToSQLWithResolution = async ({ query, tableSchemas, resolutionConfig, contextParams })=>{
|
|
11
|
+
const baseSql = await (0, _cubetosql.cubeQueryToSQL)({
|
|
12
|
+
query,
|
|
13
|
+
tableSchemas,
|
|
14
|
+
contextParams
|
|
15
|
+
});
|
|
16
|
+
if (resolutionConfig.columnConfigs.length === 0) {
|
|
17
|
+
// If no resolution is needed, return the base SQL.
|
|
18
|
+
return baseSql;
|
|
19
|
+
}
|
|
20
|
+
// Create a table schema for the base query.
|
|
21
|
+
const baseTable = (0, _meerkatcore.createBaseTableSchema)(baseSql, tableSchemas, resolutionConfig, query.measures, query.dimensions);
|
|
22
|
+
const resolutionSchemas = (0, _meerkatcore.generateResolutionSchemas)(resolutionConfig);
|
|
23
|
+
const resolveParams = {
|
|
24
|
+
query: {
|
|
25
|
+
measures: [],
|
|
26
|
+
dimensions: (0, _meerkatcore.generateResolvedDimensions)(query, resolutionConfig),
|
|
27
|
+
joinPaths: (0, _meerkatcore.generateResolutionJoinPaths)(resolutionConfig)
|
|
28
|
+
},
|
|
29
|
+
tableSchemas: [
|
|
30
|
+
baseTable,
|
|
31
|
+
...resolutionSchemas
|
|
32
|
+
]
|
|
33
|
+
};
|
|
34
|
+
const sql = await (0, _cubetosql.cubeQueryToSQL)(resolveParams);
|
|
35
|
+
return sql;
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
//# sourceMappingURL=cube-to-sql-with-resolution.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../meerkat-node/src/cube-to-sql-with-resolution/cube-to-sql-with-resolution.ts"],"sourcesContent":["import {\n ContextParams,\n createBaseTableSchema,\n generateResolutionJoinPaths,\n generateResolutionSchemas,\n generateResolvedDimensions,\n Query,\n ResolutionConfig,\n TableSchema,\n} from '@devrev/meerkat-core';\nimport {\n cubeQueryToSQL,\n CubeQueryToSQLParams,\n} from '../cube-to-sql/cube-to-sql';\n\nexport interface CubeQueryToSQLWithResolutionParams {\n query: Query;\n tableSchemas: TableSchema[];\n resolutionConfig: ResolutionConfig;\n contextParams?: ContextParams;\n}\n\nexport const cubeQueryToSQLWithResolution = async ({\n query,\n tableSchemas,\n resolutionConfig,\n contextParams,\n}: CubeQueryToSQLWithResolutionParams) => {\n const baseSql = await cubeQueryToSQL({\n query,\n tableSchemas,\n contextParams,\n });\n\n if (resolutionConfig.columnConfigs.length === 0) {\n // If no resolution is needed, return the base SQL.\n return baseSql;\n }\n\n // Create a table schema for the base query.\n const baseTable: TableSchema = createBaseTableSchema(\n baseSql,\n tableSchemas,\n resolutionConfig,\n query.measures,\n query.dimensions\n );\n\n const resolutionSchemas: TableSchema[] =\n generateResolutionSchemas(resolutionConfig);\n\n const resolveParams: CubeQueryToSQLParams = {\n query: {\n measures: [],\n dimensions: generateResolvedDimensions(query, resolutionConfig),\n joinPaths: generateResolutionJoinPaths(resolutionConfig),\n },\n tableSchemas: [baseTable, ...resolutionSchemas],\n };\n const sql = await cubeQueryToSQL(resolveParams);\n\n return sql;\n};\n"],"names":["cubeQueryToSQLWithResolution","query","tableSchemas","resolutionConfig","contextParams","baseSql","cubeQueryToSQL","columnConfigs","length","baseTable","createBaseTableSchema","measures","dimensions","resolutionSchemas","generateResolutionSchemas","resolveParams","generateResolvedDimensions","joinPaths","generateResolutionJoinPaths","sql"],"mappings":";+BAsBaA;;;eAAAA;;;6BAbN;2BAIA;AASA,MAAMA,+BAA+B,OAAO,EACjDC,KAAK,EACLC,YAAY,EACZC,gBAAgB,EAChBC,aAAa,EACsB;IACnC,MAAMC,UAAU,MAAMC,IAAAA,yBAAc,EAAC;QACnCL;QACAC;QACAE;IACF;IAEA,IAAID,iBAAiBI,aAAa,CAACC,MAAM,KAAK,GAAG;QAC/C,mDAAmD;QACnD,OAAOH;IACT;IAEA,4CAA4C;IAC5C,MAAMI,YAAyBC,IAAAA,kCAAqB,EAClDL,SACAH,cACAC,kBACAF,MAAMU,QAAQ,EACdV,MAAMW,UAAU;IAGlB,MAAMC,oBACJC,IAAAA,sCAAyB,EAACX;IAE5B,MAAMY,gBAAsC;QAC1Cd,OAAO;YACLU,UAAU,EAAE;YACZC,YAAYI,IAAAA,uCAA0B,EAACf,OAAOE;YAC9Cc,WAAWC,IAAAA,wCAA2B,EAACf;QACzC;QACAD,cAAc;YAACO;eAAcI;SAAkB;IACjD;IACA,MAAMM,MAAM,MAAMb,IAAAA,yBAAc,EAACS;IAEjC,OAAOI;AACT"}
|
package/package.json
CHANGED
|
@@ -22,13 +22,12 @@ export declare const TEST_DATA: ({
|
|
|
22
22
|
filters: never[];
|
|
23
23
|
dimensions: string[];
|
|
24
24
|
limit: number;
|
|
25
|
-
order?: undefined;
|
|
26
25
|
};
|
|
27
26
|
expectedOutput: {
|
|
28
27
|
orders__order_month: string;
|
|
29
28
|
orders__total_order_amount: number;
|
|
30
29
|
}[];
|
|
31
|
-
} | {
|
|
30
|
+
}[] | {
|
|
32
31
|
testName: string;
|
|
33
32
|
expectedSQL: string;
|
|
34
33
|
cubeInput: {
|
|
@@ -39,7 +38,6 @@ export declare const TEST_DATA: ({
|
|
|
39
38
|
'orders.total_order_amount': string;
|
|
40
39
|
'orders.customer_id': string;
|
|
41
40
|
};
|
|
42
|
-
limit?: undefined;
|
|
43
41
|
};
|
|
44
42
|
expectedOutput: ({
|
|
45
43
|
orders__customer_id: string;
|
|
@@ -48,7 +46,7 @@ export declare const TEST_DATA: ({
|
|
|
48
46
|
orders__customer_id: null;
|
|
49
47
|
orders__total_order_amount: number;
|
|
50
48
|
})[];
|
|
51
|
-
} | {
|
|
49
|
+
}[] | {
|
|
52
50
|
testName: string;
|
|
53
51
|
expectedSQL: string;
|
|
54
52
|
cubeInput: {
|
|
@@ -59,8 +57,6 @@ export declare const TEST_DATA: ({
|
|
|
59
57
|
values: string[];
|
|
60
58
|
}[];
|
|
61
59
|
dimensions: never[];
|
|
62
|
-
limit?: undefined;
|
|
63
|
-
order?: undefined;
|
|
64
60
|
};
|
|
65
61
|
expectedOutput: {
|
|
66
62
|
order_id: number;
|
|
@@ -71,7 +67,7 @@ export declare const TEST_DATA: ({
|
|
|
71
67
|
order_amount: number;
|
|
72
68
|
vendors: string[];
|
|
73
69
|
}[];
|
|
74
|
-
} | {
|
|
70
|
+
}[] | {
|
|
75
71
|
testName: string;
|
|
76
72
|
expectedSQL: string;
|
|
77
73
|
cubeInput: {
|
|
@@ -84,8 +80,6 @@ export declare const TEST_DATA: ({
|
|
|
84
80
|
}[];
|
|
85
81
|
}[];
|
|
86
82
|
dimensions: never[];
|
|
87
|
-
limit?: undefined;
|
|
88
|
-
order?: undefined;
|
|
89
83
|
};
|
|
90
84
|
expectedOutput: {
|
|
91
85
|
order_id: number;
|
|
@@ -96,7 +90,7 @@ export declare const TEST_DATA: ({
|
|
|
96
90
|
order_amount: number;
|
|
97
91
|
vendors: string[];
|
|
98
92
|
}[];
|
|
99
|
-
} | {
|
|
93
|
+
}[] | {
|
|
100
94
|
testName: string;
|
|
101
95
|
expectedSQL: string;
|
|
102
96
|
cubeInput: {
|
|
@@ -107,8 +101,6 @@ export declare const TEST_DATA: ({
|
|
|
107
101
|
values: string[];
|
|
108
102
|
}[];
|
|
109
103
|
dimensions: never[];
|
|
110
|
-
limit?: undefined;
|
|
111
|
-
order?: undefined;
|
|
112
104
|
};
|
|
113
105
|
expectedOutput: ({
|
|
114
106
|
order_id: number;
|
|
@@ -129,7 +121,7 @@ export declare const TEST_DATA: ({
|
|
|
129
121
|
product_id: string;
|
|
130
122
|
vendors: string[];
|
|
131
123
|
})[];
|
|
132
|
-
} | {
|
|
124
|
+
}[] | {
|
|
133
125
|
testName: string;
|
|
134
126
|
expectedSQL: string;
|
|
135
127
|
cubeInput: {
|
|
@@ -140,8 +132,6 @@ export declare const TEST_DATA: ({
|
|
|
140
132
|
values: string[];
|
|
141
133
|
}[];
|
|
142
134
|
dimensions: never[];
|
|
143
|
-
limit?: undefined;
|
|
144
|
-
order?: undefined;
|
|
145
135
|
};
|
|
146
136
|
expectedOutput: ({
|
|
147
137
|
order_id: number;
|
|
@@ -160,7 +150,7 @@ export declare const TEST_DATA: ({
|
|
|
160
150
|
product_id: string;
|
|
161
151
|
vendors: string[];
|
|
162
152
|
})[];
|
|
163
|
-
} | {
|
|
153
|
+
}[] | {
|
|
164
154
|
testName: string;
|
|
165
155
|
expectedSQL: string;
|
|
166
156
|
cubeInput: {
|
|
@@ -173,8 +163,6 @@ export declare const TEST_DATA: ({
|
|
|
173
163
|
}[];
|
|
174
164
|
}[];
|
|
175
165
|
dimensions: never[];
|
|
176
|
-
limit?: undefined;
|
|
177
|
-
order?: undefined;
|
|
178
166
|
};
|
|
179
167
|
expectedOutput: {
|
|
180
168
|
order_id: number;
|
|
@@ -186,7 +174,7 @@ export declare const TEST_DATA: ({
|
|
|
186
174
|
orders__order_date: string;
|
|
187
175
|
vendors: string[];
|
|
188
176
|
}[];
|
|
189
|
-
} | {
|
|
177
|
+
}[] | {
|
|
190
178
|
testName: string;
|
|
191
179
|
expectedSQL: string;
|
|
192
180
|
cubeInput: {
|
|
@@ -203,8 +191,6 @@ export declare const TEST_DATA: ({
|
|
|
203
191
|
})[];
|
|
204
192
|
}[];
|
|
205
193
|
dimensions: never[];
|
|
206
|
-
limit?: undefined;
|
|
207
|
-
order?: undefined;
|
|
208
194
|
};
|
|
209
195
|
expectedOutput: ({
|
|
210
196
|
customer_id: string;
|
|
@@ -227,7 +213,7 @@ export declare const TEST_DATA: ({
|
|
|
227
213
|
product_id: string;
|
|
228
214
|
vendors: string[];
|
|
229
215
|
})[];
|
|
230
|
-
} | {
|
|
216
|
+
}[] | {
|
|
231
217
|
testName: string;
|
|
232
218
|
expectedSQL: string;
|
|
233
219
|
cubeInput: {
|
|
@@ -244,8 +230,6 @@ export declare const TEST_DATA: ({
|
|
|
244
230
|
})[];
|
|
245
231
|
}[];
|
|
246
232
|
dimensions: never[];
|
|
247
|
-
limit?: undefined;
|
|
248
|
-
order?: undefined;
|
|
249
233
|
};
|
|
250
234
|
expectedOutput: {
|
|
251
235
|
orders__customer_id: null;
|
|
@@ -258,7 +242,7 @@ export declare const TEST_DATA: ({
|
|
|
258
242
|
product_id: string;
|
|
259
243
|
vendors: string[];
|
|
260
244
|
}[];
|
|
261
|
-
} | {
|
|
245
|
+
}[] | {
|
|
262
246
|
testName: string;
|
|
263
247
|
expectedSQL: string;
|
|
264
248
|
cubeInput: {
|
|
@@ -271,8 +255,6 @@ export declare const TEST_DATA: ({
|
|
|
271
255
|
}[];
|
|
272
256
|
}[];
|
|
273
257
|
dimensions: never[];
|
|
274
|
-
limit?: undefined;
|
|
275
|
-
order?: undefined;
|
|
276
258
|
};
|
|
277
259
|
expectedOutput: {
|
|
278
260
|
customer_id: string;
|
|
@@ -285,4 +267,4 @@ export declare const TEST_DATA: ({
|
|
|
285
267
|
product_id: string;
|
|
286
268
|
vendors: string[];
|
|
287
269
|
}[];
|
|
288
|
-
})[];
|
|
270
|
+
}[])[];
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { ContextParams, Query, TableSchema } from '@devrev/meerkat-core';
|
|
2
|
-
interface CubeQueryToSQLParams {
|
|
2
|
+
export interface CubeQueryToSQLParams {
|
|
3
3
|
query: Query;
|
|
4
4
|
tableSchemas: TableSchema[];
|
|
5
5
|
contextParams?: ContextParams;
|
|
6
6
|
}
|
|
7
7
|
export declare const cubeQueryToSQL: ({ query, tableSchemas, contextParams, }: CubeQueryToSQLParams) => Promise<string>;
|
|
8
|
-
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ContextParams, Query, ResolutionConfig, TableSchema } from '@devrev/meerkat-core';
|
|
2
|
+
export interface CubeQueryToSQLWithResolutionParams {
|
|
3
|
+
query: Query;
|
|
4
|
+
tableSchemas: TableSchema[];
|
|
5
|
+
resolutionConfig: ResolutionConfig;
|
|
6
|
+
contextParams?: ContextParams;
|
|
7
|
+
}
|
|
8
|
+
export declare const cubeQueryToSQLWithResolution: ({ query, tableSchemas, resolutionConfig, contextParams, }: CubeQueryToSQLWithResolutionParams) => Promise<string>;
|