Skip to content

Pre-aggregations with elasticsearch as datasource are not timezone aware  #7700

Open
@ernriveron

Description

@ernriveron

When creating pre-aggregations with different time zones and elasticsearch as a data source, the time dimension of the results is not converted to each applicable time zone because 'convertTz' is not implemented in the "ElasticSearchQuery" adapter. The convertTz function code can be as follows:

public convertTz(field: string): string {
    const tz = moment().tz(this.timezone);
    // TODO respect day light saving
    const [hour, minute] = tz.format('Z').split(':');
    const [hourInt, minuteInt] = [parseInt(hour, 10), parseInt(minute, 10) * Math.sign(parseInt(hour, 10))];
    let result = field;
    if (hourInt !== 0) {
      result = `TIMESTAMPADD('hour', ${hourInt}, ${result})`;
    }
    if (minuteInt !== 0) {
      result = `TIMESTAMPADD('minute', ${minuteInt}, ${result})`;
    }
    return result;
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    driver:elasticsearchIssues relating to the ElasticSearch driverenhancementNew feature proposalhelp wantedCommunity contributions are welcome.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions