turnilo icon indicating copy to clipboard operation
turnilo copied to clipboard

How can I modify the start day of the week after selecting time shift

Open waybi opened this issue 4 years ago • 1 comments

screenshot-20210224-114153

when select time shift i want to start from sunday.

query:

{ queryType: 'topN',
  dataSource: 'dataSource1',
  intervals: '2020-12-13T00Z/2020-12-27T00Z',
  granularity: 'all',
  context: { timeout: 600000 },
  virtualColumns:
   [ { type: 'expression',
       name: 'v:***__time',
       expression:
        'timestamp_floor(nvl(if((1608422400000<=__time && __time<1609027200000),__time,\'\'),timestamp_shift(__time,\'P1W\',1,\'Etc\\u002fUTC\')),\'P1W\',\'\',\'Etc\\u002fUTC\')',
       outputType: 'LONG' } ],
  dimension:
   { type: 'default',
     dimension: 'v:***__time',
     outputName: '***__time',
     outputType: 'LONG' },
  aggregations:
   [ { type: 'filtered',
       name: '!T_0',
       filter: [Object],
       aggregator: [Object] },
     { type: 'filtered',
       name: '!T_1',
       filter: [Object],
       aggregator: [Object] },
     { type: 'filtered',
       name: '!T_2',
       filter: [Object],
       aggregator: [Object] },
     { type: 'filtered',
       name: '!T_3',
       filter: [Object],
       aggregator: [Object] },
     { type: 'filtered',
       name: '!T_4',
       filter: [Object],
       aggregator: [Object] },
     { type: 'filtered',
       name: '!T_5',
       filter: [Object],
       aggregator: [Object] } ],
  postAggregations:
   [ { type: 'expression',
       expression: '604800000',
       name: 'MillisecondsInInterval' },
     { type: 'expression',
       expression:
        '((cast((("!T_0"+"!T_1")-"!T_2"),\'DOUBLE\')/604800000)*86400000)',
       name: 'elte_d' },
     { type: 'expression',
       expression:
        '((cast((("!T_3"+"!T_4")-"!T_5"),\'DOUBLE\')/604800000)*86400000)',
       name: '_previous__elte_d' },
     { type: 'expression',
       expression:
        '(((cast((("!T_0"+"!T_1")-"!T_2"),\'DOUBLE\')/604800000)*86400000)-((cast((("!T_3"+"!T_4")-"!T_5"),\'DOUBLE\')/604800000)*86400000))',
       name: '_delta__elte_d' } ],
  metric: { type: 'dimension', ordering: 'lexicographic' },
  threshold: 100 }

After modifying the dimension in the request parameters, it can start from Sunday.

Value of the modified dimension:

dimension:
   { type: 'extraction',
     dimension: '__time',
     outputName: '***__time',
     extractionFn:
      { type: 'timeFormat',
        granularity: { type: 'period', period: 'P1W', timeZone: 'Etc/UTC', origin: '1970-01-04T00Z' },  // add origin
        format: 'yyyy-MM-dd\'T\'HH:mm:ss\'Z',
        timeZone: 'Etc/UTC' } },

change default DimensionSpec to Extraction DimensionSpec, it work. But the result set is incorrect,how can I do to keep it from Sunday and the result is right, thanks!

waybi avatar Feb 24 '21 05:02 waybi

Duplicate of #708

We can't specify origin because plywood does not support it.

adrianmroz-allegro avatar Feb 24 '21 08:02 adrianmroz-allegro