@@ -1579,7 +1579,7 @@ export function testQueries(type: string, { includeIncrementalSchemaSuite, exten
15791579 expect ( response . rawData ( ) ) . toMatchSnapshot ( ) ;
15801580 } ) ;
15811581
1582- execute ( 'querying BigECommerce: rolling window YTD' , async ( ) => {
1582+ execute ( 'querying BigECommerce: rolling window YTD (month) ' , async ( ) => {
15831583 const response = await client . load ( {
15841584 measures : [
15851585 'BigECommerce.rollingCountYTD' ,
@@ -1589,6 +1589,107 @@ export function testQueries(type: string, { includeIncrementalSchemaSuite, exten
15891589 granularity : 'month' ,
15901590 dateRange : [ '2020-01-01' , '2020-12-31' ] ,
15911591 } ] ,
1592+ order : [
1593+ [ 'BigECommerce.orderDate' , 'asc' ] ,
1594+ ] ,
1595+ } ) ;
1596+ expect ( response . rawData ( ) ) . toMatchSnapshot ( ) ;
1597+ } ) ;
1598+
1599+ execute ( 'querying BigECommerce: rolling window YTD (month + week)' , async ( ) => {
1600+ const response = await client . load ( {
1601+ measures : [
1602+ 'BigECommerce.rollingCountYTD' ,
1603+ ] ,
1604+ timeDimensions : [ {
1605+ dimension : 'BigECommerce.orderDate' ,
1606+ granularity : 'month' ,
1607+ dateRange : [ '2020-01-01' , '2020-12-31' ] ,
1608+ } , {
1609+ dimension : 'BigECommerce.orderDate' ,
1610+ granularity : 'week' ,
1611+ dateRange : [ '2020-01-01' , '2020-12-31' ] ,
1612+ } ] ,
1613+ order : [
1614+ [ 'BigECommerce.orderDate' , 'asc' ] ,
1615+ ] ,
1616+ } ) ;
1617+ expect ( response . rawData ( ) ) . toMatchSnapshot ( ) ;
1618+ } ) ;
1619+
1620+ execute ( 'querying BigECommerce: rolling window YTD (month + week + no gran)' , async ( ) => {
1621+ const response = await client . load ( {
1622+ measures : [
1623+ 'BigECommerce.rollingCountYTD' ,
1624+ ] ,
1625+ timeDimensions : [ {
1626+ dimension : 'BigECommerce.orderDate' ,
1627+ granularity : 'month' ,
1628+ dateRange : [ '2020-01-01' , '2020-12-31' ] ,
1629+ } , {
1630+ dimension : 'BigECommerce.orderDate' ,
1631+ granularity : 'week' ,
1632+ dateRange : [ '2020-01-01' , '2020-12-31' ] ,
1633+ } , {
1634+ dimension : 'BigECommerce.orderDate' ,
1635+ dateRange : [ '2020-01-01' , '2020-12-31' ] ,
1636+ } ] ,
1637+ order : [
1638+ [ 'BigECommerce.orderDate' , 'asc' ] ,
1639+ ] ,
1640+ } ) ;
1641+ expect ( response . rawData ( ) ) . toMatchSnapshot ( ) ;
1642+ } ) ;
1643+
1644+ execute ( 'querying BigECommerce: rolling window YTD (month + week + day)' , async ( ) => {
1645+ const response = await client . load ( {
1646+ measures : [
1647+ 'BigECommerce.rollingCountYTD' ,
1648+ ] ,
1649+ timeDimensions : [ {
1650+ dimension : 'BigECommerce.orderDate' ,
1651+ granularity : 'month' ,
1652+ dateRange : [ '2020-01-01' , '2020-03-01' ] ,
1653+ } , {
1654+ dimension : 'BigECommerce.orderDate' ,
1655+ granularity : 'week' ,
1656+ dateRange : [ '2020-01-01' , '2020-03-01' ] ,
1657+ } , {
1658+ dimension : 'BigECommerce.orderDate' ,
1659+ granularity : 'day' ,
1660+ dateRange : [ '2020-01-01' , '2020-03-01' ] ,
1661+ } ] ,
1662+ order : [
1663+ [ 'BigECommerce.orderDate' , 'asc' ] ,
1664+ ] ,
1665+ } ) ;
1666+ expect ( response . rawData ( ) ) . toMatchSnapshot ( ) ;
1667+ } ) ;
1668+
1669+ execute ( 'querying BigECommerce: rolling window YTD (month + week + day + no gran)' , async ( ) => {
1670+ const response = await client . load ( {
1671+ measures : [
1672+ 'BigECommerce.rollingCountYTD' ,
1673+ ] ,
1674+ timeDimensions : [ {
1675+ dimension : 'BigECommerce.orderDate' ,
1676+ granularity : 'month' ,
1677+ dateRange : [ '2020-01-01' , '2020-03-01' ] ,
1678+ } , {
1679+ dimension : 'BigECommerce.orderDate' ,
1680+ granularity : 'week' ,
1681+ dateRange : [ '2020-01-01' , '2020-03-01' ] ,
1682+ } , {
1683+ dimension : 'BigECommerce.orderDate' ,
1684+ granularity : 'day' ,
1685+ dateRange : [ '2020-01-01' , '2020-03-01' ] ,
1686+ } , {
1687+ dimension : 'BigECommerce.orderDate' ,
1688+ dateRange : [ '2020-01-01' , '2020-03-01' ] ,
1689+ } ] ,
1690+ order : [
1691+ [ 'BigECommerce.orderDate' , 'asc' ] ,
1692+ ] ,
15921693 } ) ;
15931694 expect ( response . rawData ( ) ) . toMatchSnapshot ( ) ;
15941695 } ) ;
@@ -1606,6 +1707,19 @@ export function testQueries(type: string, { includeIncrementalSchemaSuite, exten
16061707 expect ( response . rawData ( ) ) . toMatchSnapshot ( ) ;
16071708 } ) ;
16081709
1710+ execute ( 'querying BigECommerce: rolling window YTD without granularity' , async ( ) => {
1711+ const response = await client . load ( {
1712+ measures : [
1713+ 'BigECommerce.rollingCountYTD' ,
1714+ ] ,
1715+ timeDimensions : [ {
1716+ dimension : 'BigECommerce.orderDate' ,
1717+ dateRange : [ '2020-01-01' , '2020-03-01' ] ,
1718+ } ] ,
1719+ } ) ;
1720+ expect ( response . rawData ( ) ) . toMatchSnapshot ( ) ;
1721+ } ) ;
1722+
16091723 if ( includeHLLSuite ) {
16101724 execute ( 'querying BigECommerce: rolling count_distinct_approx window by 2 day' , async ( ) => {
16111725 const response = await client . load ( {
@@ -2093,6 +2207,38 @@ from
20932207 expect ( res . rows ) . toMatchSnapshot ( ) ;
20942208 } ) ;
20952209
2210+ executePg ( 'SQL API: Rolling Window YTD (year + month + day + date_trunc equal)' , async ( connection ) => {
2211+ // It's important to use day granularity - it tests for ambiguous names
2212+ const res = await connection . query ( `
2213+ SELECT
2214+ DATE_TRUNC('year', orderDate) AS "orderDateY",
2215+ DATE_TRUNC('month', orderDate) AS "orderDateM",
2216+ DATE_TRUNC('day', orderDate) AS "orderDateD",
2217+ MEASURE(rollingCountYTD) AS "rollingCountYTD"
2218+ FROM "BigECommerce"
2219+ WHERE DATE_TRUNC('year', orderDate) = CAST('2020-01-01' AS DATE)
2220+ GROUP BY 1, 2, 3
2221+ ORDER BY 3 ASC NULLS FIRST;
2222+ ` ) ;
2223+ expect ( res . rows ) . toMatchSnapshot ( ) ;
2224+ } ) ;
2225+
2226+ executePg ( 'SQL API: Rolling Window YTD (year + month + day + date_trunc IN)' , async ( connection ) => {
2227+ // It's important to use day granularity - it tests for ambiguous names
2228+ const res = await connection . query ( `
2229+ SELECT
2230+ DATE_TRUNC('year', orderDate) AS "orderDateY",
2231+ DATE_TRUNC('month', orderDate) AS "orderDateM",
2232+ DATE_TRUNC('day', orderDate) AS "orderDateD",
2233+ MEASURE(rollingCountYTD) AS "rollingCountYTD"
2234+ FROM "BigECommerce"
2235+ WHERE DATE_TRUNC('year', orderDate) IN (CAST('2020-01-01' AS DATE))
2236+ GROUP BY 1, 2, 3
2237+ ORDER BY 3 ASC NULLS FIRST;
2238+ ` ) ;
2239+ expect ( res . rows ) . toMatchSnapshot ( ) ;
2240+ } ) ;
2241+
20962242 executePg ( 'SQL API: SQL push down push to cube quoted alias' , async ( connection ) => {
20972243 const res = await connection . query ( `
20982244 SELECT
0 commit comments