Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
waybi opened this issue Feb 24, 2021 · 0 comments
Open

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

waybi opened this issue Feb 24, 2021 · 0 comments

Comments

@waybi
Copy link

waybi commented Feb 24, 2021

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant