mirror of
https://github.com/apache/superset.git
synced 2024-09-06 13:57:40 -04:00
chore: fix grammar error (#19740)
This commit is contained in:
parent
3c28cd4625
commit
4f997cd9ac
@ -1,4 +1,3 @@
|
|||||||
/* eslint-disable camelcase */
|
|
||||||
/**
|
/**
|
||||||
* Licensed to the Apache Software Foundation (ASF) under one
|
* Licensed to the Apache Software Foundation (ASF) under one
|
||||||
* or more contributor license agreements. See the NOTICE file
|
* or more contributor license agreements. See the NOTICE file
|
||||||
|
@ -24,7 +24,7 @@ import {
|
|||||||
ComparisionType,
|
ComparisionType,
|
||||||
} from '@superset-ui/core';
|
} from '@superset-ui/core';
|
||||||
import { PostProcessingFactory } from './types';
|
import { PostProcessingFactory } from './types';
|
||||||
import { getMetricOffsetsMap, isValidTimeCompare } from './utils';
|
import { getMetricOffsetsMap, isTimeComparison } from './utils';
|
||||||
|
|
||||||
export const renameOperator: PostProcessingFactory<PostProcessingRename> = (
|
export const renameOperator: PostProcessingFactory<PostProcessingRename> = (
|
||||||
formData,
|
formData,
|
||||||
@ -45,7 +45,7 @@ export const renameOperator: PostProcessingFactory<PostProcessingRename> = (
|
|||||||
!(
|
!(
|
||||||
// todo: we should provide an approach to handle derived metrics
|
// todo: we should provide an approach to handle derived metrics
|
||||||
(
|
(
|
||||||
isValidTimeCompare(formData, queryObject) &&
|
isTimeComparison(formData, queryObject) &&
|
||||||
[
|
[
|
||||||
ComparisionType.Difference,
|
ComparisionType.Difference,
|
||||||
ComparisionType.Ratio,
|
ComparisionType.Ratio,
|
||||||
@ -60,7 +60,7 @@ export const renameOperator: PostProcessingFactory<PostProcessingRename> = (
|
|||||||
// "actual values" will add derived metric.
|
// "actual values" will add derived metric.
|
||||||
// we will rename the "metric" from the metricWithOffset label
|
// we will rename the "metric" from the metricWithOffset label
|
||||||
// for example: "count__1 year ago" => "1 year ago"
|
// for example: "count__1 year ago" => "1 year ago"
|
||||||
isValidTimeCompare(formData, queryObject) &&
|
isTimeComparison(formData, queryObject) &&
|
||||||
formData.comparison_type === ComparisionType.Values
|
formData.comparison_type === ComparisionType.Values
|
||||||
) {
|
) {
|
||||||
const metricOffsetMap = getMetricOffsetsMap(formData, queryObject);
|
const metricOffsetMap = getMetricOffsetsMap(formData, queryObject);
|
||||||
|
@ -24,14 +24,14 @@ import {
|
|||||||
PostProcessingRolling,
|
PostProcessingRolling,
|
||||||
RollingType,
|
RollingType,
|
||||||
} from '@superset-ui/core';
|
} from '@superset-ui/core';
|
||||||
import { getMetricOffsetsMap, isValidTimeCompare } from './utils';
|
import { getMetricOffsetsMap, isTimeComparison } from './utils';
|
||||||
import { PostProcessingFactory } from './types';
|
import { PostProcessingFactory } from './types';
|
||||||
|
|
||||||
export const rollingWindowOperator: PostProcessingFactory<
|
export const rollingWindowOperator: PostProcessingFactory<
|
||||||
PostProcessingRolling | PostProcessingCum
|
PostProcessingRolling | PostProcessingCum
|
||||||
> = (formData, queryObject) => {
|
> = (formData, queryObject) => {
|
||||||
let columns: (string | undefined)[];
|
let columns: (string | undefined)[];
|
||||||
if (isValidTimeCompare(formData, queryObject)) {
|
if (isTimeComparison(formData, queryObject)) {
|
||||||
const metricsMap = getMetricOffsetsMap(formData, queryObject);
|
const metricsMap = getMetricOffsetsMap(formData, queryObject);
|
||||||
columns = [
|
columns = [
|
||||||
...Array.from(metricsMap.values()),
|
...Array.from(metricsMap.values()),
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
import { ComparisionType, PostProcessingCompare } from '@superset-ui/core';
|
import { ComparisionType, PostProcessingCompare } from '@superset-ui/core';
|
||||||
import { getMetricOffsetsMap, isValidTimeCompare } from './utils';
|
import { getMetricOffsetsMap, isTimeComparison } from './utils';
|
||||||
import { PostProcessingFactory } from './types';
|
import { PostProcessingFactory } from './types';
|
||||||
|
|
||||||
export const timeCompareOperator: PostProcessingFactory<PostProcessingCompare> =
|
export const timeCompareOperator: PostProcessingFactory<PostProcessingCompare> =
|
||||||
@ -27,7 +27,7 @@ export const timeCompareOperator: PostProcessingFactory<PostProcessingCompare> =
|
|||||||
const metricOffsetMap = getMetricOffsetsMap(formData, queryObject);
|
const metricOffsetMap = getMetricOffsetsMap(formData, queryObject);
|
||||||
|
|
||||||
if (
|
if (
|
||||||
isValidTimeCompare(formData, queryObject) &&
|
isTimeComparison(formData, queryObject) &&
|
||||||
comparisonType !== ComparisionType.Values
|
comparisonType !== ComparisionType.Values
|
||||||
) {
|
) {
|
||||||
return {
|
return {
|
||||||
|
@ -24,14 +24,14 @@ import {
|
|||||||
NumpyFunction,
|
NumpyFunction,
|
||||||
PostProcessingPivot,
|
PostProcessingPivot,
|
||||||
} from '@superset-ui/core';
|
} from '@superset-ui/core';
|
||||||
import { getMetricOffsetsMap, isValidTimeCompare } from './utils';
|
import { getMetricOffsetsMap, isTimeComparison } from './utils';
|
||||||
import { PostProcessingFactory } from './types';
|
import { PostProcessingFactory } from './types';
|
||||||
|
|
||||||
export const timeComparePivotOperator: PostProcessingFactory<PostProcessingPivot> =
|
export const timeComparePivotOperator: PostProcessingFactory<PostProcessingPivot> =
|
||||||
(formData, queryObject) => {
|
(formData, queryObject) => {
|
||||||
const metricOffsetMap = getMetricOffsetsMap(formData, queryObject);
|
const metricOffsetMap = getMetricOffsetsMap(formData, queryObject);
|
||||||
|
|
||||||
if (isValidTimeCompare(formData, queryObject)) {
|
if (isTimeComparison(formData, queryObject)) {
|
||||||
const aggregates = Object.fromEntries(
|
const aggregates = Object.fromEntries(
|
||||||
[...metricOffsetMap.values(), ...metricOffsetMap.keys()].map(metric => [
|
[...metricOffsetMap.values(), ...metricOffsetMap.keys()].map(metric => [
|
||||||
metric,
|
metric,
|
||||||
|
@ -18,5 +18,5 @@
|
|||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
export { getMetricOffsetsMap } from './getMetricOffsetsMap';
|
export { getMetricOffsetsMap } from './getMetricOffsetsMap';
|
||||||
export { isValidTimeCompare } from './isValidTimeCompare';
|
export { isTimeComparison } from './isTimeComparison';
|
||||||
export { TIME_COMPARISON_SEPARATOR } from './constants';
|
export { TIME_COMPARISON_SEPARATOR } from './constants';
|
||||||
|
@ -21,7 +21,7 @@ import { ComparisionType } from '@superset-ui/core';
|
|||||||
import { getMetricOffsetsMap } from './getMetricOffsetsMap';
|
import { getMetricOffsetsMap } from './getMetricOffsetsMap';
|
||||||
import { PostProcessingFactory } from '../types';
|
import { PostProcessingFactory } from '../types';
|
||||||
|
|
||||||
export const isValidTimeCompare: PostProcessingFactory<boolean> = (
|
export const isTimeComparison: PostProcessingFactory<boolean> = (
|
||||||
formData,
|
formData,
|
||||||
queryObject,
|
queryObject,
|
||||||
) => {
|
) => {
|
@ -27,7 +27,7 @@ import {
|
|||||||
import {
|
import {
|
||||||
rollingWindowOperator,
|
rollingWindowOperator,
|
||||||
timeCompareOperator,
|
timeCompareOperator,
|
||||||
isValidTimeCompare,
|
isTimeComparison,
|
||||||
pivotOperator,
|
pivotOperator,
|
||||||
resampleOperator,
|
resampleOperator,
|
||||||
renameOperator,
|
renameOperator,
|
||||||
@ -61,7 +61,7 @@ export default function buildQuery(formData: QueryFormData) {
|
|||||||
2015-03-01 318.0 0.0
|
2015-03-01 318.0 0.0
|
||||||
|
|
||||||
*/
|
*/
|
||||||
const pivotOperatorInRuntime: PostProcessingPivot = isValidTimeCompare(
|
const pivotOperatorInRuntime: PostProcessingPivot = isTimeComparison(
|
||||||
formData,
|
formData,
|
||||||
baseQueryObject,
|
baseQueryObject,
|
||||||
)
|
)
|
||||||
@ -80,7 +80,7 @@ export default function buildQuery(formData: QueryFormData) {
|
|||||||
is_timeseries,
|
is_timeseries,
|
||||||
// todo: move `normalizeOrderBy to extractQueryFields`
|
// todo: move `normalizeOrderBy to extractQueryFields`
|
||||||
orderby: normalizeOrderBy(baseQueryObject).orderby,
|
orderby: normalizeOrderBy(baseQueryObject).orderby,
|
||||||
time_offsets: isValidTimeCompare(formData, baseQueryObject)
|
time_offsets: isTimeComparison(formData, baseQueryObject)
|
||||||
? formData.time_compare
|
? formData.time_compare
|
||||||
: [],
|
: [],
|
||||||
/* Note that:
|
/* Note that:
|
||||||
|
Loading…
Reference in New Issue
Block a user