Skip to content

Commit 13cac82

Browse files
committed
fix
1 parent 21806ee commit 13cac82

File tree

3 files changed

+280
-18
lines changed

3 files changed

+280
-18
lines changed

.github/workflows/drivers-tests.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -271,6 +271,8 @@ jobs:
271271
use_tesseract_sql_planner: true
272272
- database: bigquery-export-bucket-gcs
273273
use_tesseract_sql_planner: true
274+
- database: athena-export-bucket-s3
275+
use_tesseract_sql_planner: true
274276
fail-fast: false
275277

276278
steps:

packages/cubejs-schema-compiler/src/adapter/PostgresQuery.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,10 +84,10 @@ export class PostgresQuery extends BaseQuery {
8484
templates.operators.is_not_distinct_from = 'IS NOT DISTINCT FROM';
8585
templates.statements.generated_time_series_select = 'SELECT d AS "date_from",\n' +
8686
'd + interval {{ granularity }} - interval \'1 millisecond\' AS "date_to" \n' +
87-
'FROM generate_series({{ start }}::timestamp, {{ end }}:: timestamp, \'{{ granularity }}\'::interval) d ';
87+
'FROM generate_series({{ start }}::timestamp, {{ end }}:: timestamp, {{ granularity }}::interval) d ';
8888
templates.statements.generated_time_series_with_cte_range_source = 'SELECT d AS "date_from",\n' +
8989
'd + interval {{ granularity }} - interval \'1 millisecond\' AS "date_to" \n' +
90-
'FROM {{ range_source }}, LATERAL generate_series({{ range_source }}.{{ min_name }}, {{ range_source }}.{{ max_name }}, \'{{ granularity }}\'::interval) d ';
90+
'FROM {{ range_source }}, LATERAL generate_series({{ range_source }}.{{ min_name }}, {{ range_source }}.{{ max_name }}, {{ granularity }}::interval) d ';
9191
return templates;
9292
}
9393

packages/cubejs-testing-drivers/test/__snapshots__/athena-export-bucket-s3-full.test.ts.snap

Lines changed: 276 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,21 @@
11
// Jest Snapshot v1, https://goo.gl/fbAQLP
22

3+
exports[`Queries with the @cubejs-backend/athena-driver SQL API: Date/time comparison with SQL push down 1`] = `
4+
Array [
5+
Object {
6+
"measure(BigECommerce.rollingCountBy2Day)": "12",
7+
},
8+
]
9+
`;
10+
11+
exports[`Queries with the @cubejs-backend/athena-driver SQL API: Date/time comparison with date_trunc with SQL push down 1`] = `
12+
Array [
13+
Object {
14+
"measure(BigECommerce.rollingCountBy2Week)": "12",
15+
},
16+
]
17+
`;
18+
319
exports[`Queries with the @cubejs-backend/athena-driver SQL API: NULLS FIRST/LAST SQL push down: nulls_first_last_sql_push_down 1`] = `
420
Array [
521
Object {
@@ -2846,6 +2862,136 @@ Array [
28462862
]
28472863
`;
28482864

2865+
exports[`Queries with the @cubejs-backend/athena-driver querying BigECommerce: rolling window YTD 1`] = `
2866+
Array [
2867+
Object {
2868+
"BigECommerce.orderDate": "2020-01-01T00:00:00.000",
2869+
"BigECommerce.orderDate.month": "2020-01-01T00:00:00.000",
2870+
"BigECommerce.rollingCountYTD": "2",
2871+
},
2872+
Object {
2873+
"BigECommerce.orderDate": "2020-02-01T00:00:00.000",
2874+
"BigECommerce.orderDate.month": "2020-02-01T00:00:00.000",
2875+
"BigECommerce.rollingCountYTD": "3",
2876+
},
2877+
Object {
2878+
"BigECommerce.orderDate": "2020-03-01T00:00:00.000",
2879+
"BigECommerce.orderDate.month": "2020-03-01T00:00:00.000",
2880+
"BigECommerce.rollingCountYTD": "5",
2881+
},
2882+
Object {
2883+
"BigECommerce.orderDate": "2020-04-01T00:00:00.000",
2884+
"BigECommerce.orderDate.month": "2020-04-01T00:00:00.000",
2885+
"BigECommerce.rollingCountYTD": "6",
2886+
},
2887+
Object {
2888+
"BigECommerce.orderDate": "2020-05-01T00:00:00.000",
2889+
"BigECommerce.orderDate.month": "2020-05-01T00:00:00.000",
2890+
"BigECommerce.rollingCountYTD": "11",
2891+
},
2892+
Object {
2893+
"BigECommerce.orderDate": "2020-06-01T00:00:00.000",
2894+
"BigECommerce.orderDate.month": "2020-06-01T00:00:00.000",
2895+
"BigECommerce.rollingCountYTD": "18",
2896+
},
2897+
Object {
2898+
"BigECommerce.orderDate": "2020-07-01T00:00:00.000",
2899+
"BigECommerce.orderDate.month": "2020-07-01T00:00:00.000",
2900+
"BigECommerce.rollingCountYTD": "18",
2901+
},
2902+
Object {
2903+
"BigECommerce.orderDate": "2020-08-01T00:00:00.000",
2904+
"BigECommerce.orderDate.month": "2020-08-01T00:00:00.000",
2905+
"BigECommerce.rollingCountYTD": "18",
2906+
},
2907+
Object {
2908+
"BigECommerce.orderDate": "2020-09-01T00:00:00.000",
2909+
"BigECommerce.orderDate.month": "2020-09-01T00:00:00.000",
2910+
"BigECommerce.rollingCountYTD": "24",
2911+
},
2912+
Object {
2913+
"BigECommerce.orderDate": "2020-10-01T00:00:00.000",
2914+
"BigECommerce.orderDate.month": "2020-10-01T00:00:00.000",
2915+
"BigECommerce.rollingCountYTD": "28",
2916+
},
2917+
Object {
2918+
"BigECommerce.orderDate": "2020-11-01T00:00:00.000",
2919+
"BigECommerce.orderDate.month": "2020-11-01T00:00:00.000",
2920+
"BigECommerce.rollingCountYTD": "37",
2921+
},
2922+
Object {
2923+
"BigECommerce.orderDate": "2020-12-01T00:00:00.000",
2924+
"BigECommerce.orderDate.month": "2020-12-01T00:00:00.000",
2925+
"BigECommerce.rollingCountYTD": "44",
2926+
},
2927+
]
2928+
`;
2929+
2930+
exports[`Queries with the @cubejs-backend/athena-driver querying BigECommerce: rolling window YTD without date range 1`] = `
2931+
Array [
2932+
Object {
2933+
"BigECommerce.orderDate": "2020-01-01T00:00:00.000",
2934+
"BigECommerce.orderDate.month": "2020-01-01T00:00:00.000",
2935+
"BigECommerce.rollingCountYTD": "2",
2936+
},
2937+
Object {
2938+
"BigECommerce.orderDate": "2020-02-01T00:00:00.000",
2939+
"BigECommerce.orderDate.month": "2020-02-01T00:00:00.000",
2940+
"BigECommerce.rollingCountYTD": "3",
2941+
},
2942+
Object {
2943+
"BigECommerce.orderDate": "2020-03-01T00:00:00.000",
2944+
"BigECommerce.orderDate.month": "2020-03-01T00:00:00.000",
2945+
"BigECommerce.rollingCountYTD": "5",
2946+
},
2947+
Object {
2948+
"BigECommerce.orderDate": "2020-04-01T00:00:00.000",
2949+
"BigECommerce.orderDate.month": "2020-04-01T00:00:00.000",
2950+
"BigECommerce.rollingCountYTD": "6",
2951+
},
2952+
Object {
2953+
"BigECommerce.orderDate": "2020-05-01T00:00:00.000",
2954+
"BigECommerce.orderDate.month": "2020-05-01T00:00:00.000",
2955+
"BigECommerce.rollingCountYTD": "11",
2956+
},
2957+
Object {
2958+
"BigECommerce.orderDate": "2020-06-01T00:00:00.000",
2959+
"BigECommerce.orderDate.month": "2020-06-01T00:00:00.000",
2960+
"BigECommerce.rollingCountYTD": "18",
2961+
},
2962+
Object {
2963+
"BigECommerce.orderDate": "2020-07-01T00:00:00.000",
2964+
"BigECommerce.orderDate.month": "2020-07-01T00:00:00.000",
2965+
"BigECommerce.rollingCountYTD": "18",
2966+
},
2967+
Object {
2968+
"BigECommerce.orderDate": "2020-08-01T00:00:00.000",
2969+
"BigECommerce.orderDate.month": "2020-08-01T00:00:00.000",
2970+
"BigECommerce.rollingCountYTD": "18",
2971+
},
2972+
Object {
2973+
"BigECommerce.orderDate": "2020-09-01T00:00:00.000",
2974+
"BigECommerce.orderDate.month": "2020-09-01T00:00:00.000",
2975+
"BigECommerce.rollingCountYTD": "24",
2976+
},
2977+
Object {
2978+
"BigECommerce.orderDate": "2020-10-01T00:00:00.000",
2979+
"BigECommerce.orderDate.month": "2020-10-01T00:00:00.000",
2980+
"BigECommerce.rollingCountYTD": "28",
2981+
},
2982+
Object {
2983+
"BigECommerce.orderDate": "2020-11-01T00:00:00.000",
2984+
"BigECommerce.orderDate.month": "2020-11-01T00:00:00.000",
2985+
"BigECommerce.rollingCountYTD": "37",
2986+
},
2987+
Object {
2988+
"BigECommerce.orderDate": "2020-12-01T00:00:00.000",
2989+
"BigECommerce.orderDate.month": "2020-12-01T00:00:00.000",
2990+
"BigECommerce.rollingCountYTD": "44",
2991+
},
2992+
]
2993+
`;
2994+
28492995
exports[`Queries with the @cubejs-backend/athena-driver querying BigECommerce: rolling window by 2 day 1`] = `
28502996
Array [
28512997
Object {
@@ -2911,6 +3057,71 @@ Array [
29113057
]
29123058
`;
29133059

3060+
exports[`Queries with the @cubejs-backend/athena-driver querying BigECommerce: rolling window by 2 day without date range 1`] = `
3061+
Array [
3062+
Object {
3063+
"BigECommerce.orderDate": "2020-01-01T00:00:00.000",
3064+
"BigECommerce.orderDate.month": "2020-01-01T00:00:00.000",
3065+
"BigECommerce.rollingCountBy2Day": null,
3066+
},
3067+
Object {
3068+
"BigECommerce.orderDate": "2020-02-01T00:00:00.000",
3069+
"BigECommerce.orderDate.month": "2020-02-01T00:00:00.000",
3070+
"BigECommerce.rollingCountBy2Day": null,
3071+
},
3072+
Object {
3073+
"BigECommerce.orderDate": "2020-03-01T00:00:00.000",
3074+
"BigECommerce.orderDate.month": "2020-03-01T00:00:00.000",
3075+
"BigECommerce.rollingCountBy2Day": null,
3076+
},
3077+
Object {
3078+
"BigECommerce.orderDate": "2020-04-01T00:00:00.000",
3079+
"BigECommerce.orderDate.month": "2020-04-01T00:00:00.000",
3080+
"BigECommerce.rollingCountBy2Day": null,
3081+
},
3082+
Object {
3083+
"BigECommerce.orderDate": "2020-05-01T00:00:00.000",
3084+
"BigECommerce.orderDate.month": "2020-05-01T00:00:00.000",
3085+
"BigECommerce.rollingCountBy2Day": null,
3086+
},
3087+
Object {
3088+
"BigECommerce.orderDate": "2020-06-01T00:00:00.000",
3089+
"BigECommerce.orderDate.month": "2020-06-01T00:00:00.000",
3090+
"BigECommerce.rollingCountBy2Day": null,
3091+
},
3092+
Object {
3093+
"BigECommerce.orderDate": "2020-07-01T00:00:00.000",
3094+
"BigECommerce.orderDate.month": "2020-07-01T00:00:00.000",
3095+
"BigECommerce.rollingCountBy2Day": null,
3096+
},
3097+
Object {
3098+
"BigECommerce.orderDate": "2020-08-01T00:00:00.000",
3099+
"BigECommerce.orderDate.month": "2020-08-01T00:00:00.000",
3100+
"BigECommerce.rollingCountBy2Day": null,
3101+
},
3102+
Object {
3103+
"BigECommerce.orderDate": "2020-09-01T00:00:00.000",
3104+
"BigECommerce.orderDate.month": "2020-09-01T00:00:00.000",
3105+
"BigECommerce.rollingCountBy2Day": null,
3106+
},
3107+
Object {
3108+
"BigECommerce.orderDate": "2020-10-01T00:00:00.000",
3109+
"BigECommerce.orderDate.month": "2020-10-01T00:00:00.000",
3110+
"BigECommerce.rollingCountBy2Day": "1",
3111+
},
3112+
Object {
3113+
"BigECommerce.orderDate": "2020-11-01T00:00:00.000",
3114+
"BigECommerce.orderDate.month": "2020-11-01T00:00:00.000",
3115+
"BigECommerce.rollingCountBy2Day": null,
3116+
},
3117+
Object {
3118+
"BigECommerce.orderDate": "2020-12-01T00:00:00.000",
3119+
"BigECommerce.orderDate.month": "2020-12-01T00:00:00.000",
3120+
"BigECommerce.rollingCountBy2Day": null,
3121+
},
3122+
]
3123+
`;
3124+
29143125
exports[`Queries with the @cubejs-backend/athena-driver querying BigECommerce: rolling window by 2 month 1`] = `
29153126
Array [
29163127
Object {
@@ -2976,6 +3187,71 @@ Array [
29763187
]
29773188
`;
29783189

3190+
exports[`Queries with the @cubejs-backend/athena-driver querying BigECommerce: rolling window by 2 month without date range 1`] = `
3191+
Array [
3192+
Object {
3193+
"BigECommerce.orderDate": "2020-01-01T00:00:00.000",
3194+
"BigECommerce.orderDate.month": "2020-01-01T00:00:00.000",
3195+
"BigECommerce.rollingCountBy2Month": "2",
3196+
},
3197+
Object {
3198+
"BigECommerce.orderDate": "2020-02-01T00:00:00.000",
3199+
"BigECommerce.orderDate.month": "2020-02-01T00:00:00.000",
3200+
"BigECommerce.rollingCountBy2Month": "3",
3201+
},
3202+
Object {
3203+
"BigECommerce.orderDate": "2020-03-01T00:00:00.000",
3204+
"BigECommerce.orderDate.month": "2020-03-01T00:00:00.000",
3205+
"BigECommerce.rollingCountBy2Month": "3",
3206+
},
3207+
Object {
3208+
"BigECommerce.orderDate": "2020-04-01T00:00:00.000",
3209+
"BigECommerce.orderDate.month": "2020-04-01T00:00:00.000",
3210+
"BigECommerce.rollingCountBy2Month": "3",
3211+
},
3212+
Object {
3213+
"BigECommerce.orderDate": "2020-05-01T00:00:00.000",
3214+
"BigECommerce.orderDate.month": "2020-05-01T00:00:00.000",
3215+
"BigECommerce.rollingCountBy2Month": "6",
3216+
},
3217+
Object {
3218+
"BigECommerce.orderDate": "2020-06-01T00:00:00.000",
3219+
"BigECommerce.orderDate.month": "2020-06-01T00:00:00.000",
3220+
"BigECommerce.rollingCountBy2Month": "12",
3221+
},
3222+
Object {
3223+
"BigECommerce.orderDate": "2020-07-01T00:00:00.000",
3224+
"BigECommerce.orderDate.month": "2020-07-01T00:00:00.000",
3225+
"BigECommerce.rollingCountBy2Month": "7",
3226+
},
3227+
Object {
3228+
"BigECommerce.orderDate": "2020-08-01T00:00:00.000",
3229+
"BigECommerce.orderDate.month": "2020-08-01T00:00:00.000",
3230+
"BigECommerce.rollingCountBy2Month": null,
3231+
},
3232+
Object {
3233+
"BigECommerce.orderDate": "2020-09-01T00:00:00.000",
3234+
"BigECommerce.orderDate.month": "2020-09-01T00:00:00.000",
3235+
"BigECommerce.rollingCountBy2Month": "6",
3236+
},
3237+
Object {
3238+
"BigECommerce.orderDate": "2020-10-01T00:00:00.000",
3239+
"BigECommerce.orderDate.month": "2020-10-01T00:00:00.000",
3240+
"BigECommerce.rollingCountBy2Month": "10",
3241+
},
3242+
Object {
3243+
"BigECommerce.orderDate": "2020-11-01T00:00:00.000",
3244+
"BigECommerce.orderDate.month": "2020-11-01T00:00:00.000",
3245+
"BigECommerce.rollingCountBy2Month": "13",
3246+
},
3247+
Object {
3248+
"BigECommerce.orderDate": "2020-12-01T00:00:00.000",
3249+
"BigECommerce.orderDate.month": "2020-12-01T00:00:00.000",
3250+
"BigECommerce.rollingCountBy2Month": "16",
3251+
},
3252+
]
3253+
`;
3254+
29793255
exports[`Queries with the @cubejs-backend/athena-driver querying BigECommerce: totalProfitYearAgo 1`] = `Array []`;
29803256

29813257
exports[`Queries with the @cubejs-backend/athena-driver querying Customers: dimensions + limit 1`] = `
@@ -8007,19 +8283,3 @@ Array [
80078283
},
80088284
]
80098285
`;
8010-
8011-
exports[`Queries with the @cubejs-backend/athena-driver SQL API: Date/time comparison with SQL push down 1`] = `
8012-
Array [
8013-
Object {
8014-
"measure(BigECommerce.rollingCountBy2Day)": "12",
8015-
},
8016-
]
8017-
`;
8018-
8019-
exports[`Queries with the @cubejs-backend/athena-driver SQL API: Date/time comparison with date_trunc with SQL push down 1`] = `
8020-
Array [
8021-
Object {
8022-
"measure(BigECommerce.rollingCountBy2Week)": "12",
8023-
},
8024-
]
8025-
`;

0 commit comments

Comments
 (0)