Skip to content

Commit

Permalink
fix(native-filters): Assume that temporal columns exist if column_typ…
Browse files Browse the repository at this point in the history
…es is undefined (apache#15324)

* fix(native-filters): Assume that temporal columns exist if column_types is undefined

* Allow column_types to be an empty array
  • Loading branch information
kgabryje authored and cccs-RyanS committed Dec 17, 2021
1 parent 9d5a233 commit 90c8daf
Showing 1 changed file with 8 additions and 1 deletion.
Expand Up @@ -27,6 +27,7 @@ import {
SupersetApiError,
t,
GenericDataType,
ensureIsArray,
} from '@superset-ui/core';
import {
ColumnMeta,
Expand Down Expand Up @@ -275,9 +276,15 @@ const FILTER_TYPE_NAME_MAPPING = {
};

// TODO: add column_types field to DatasourceMeta
// We return true if column_types is undefined or empty as a precaution against backend failing to return column_types
const hasTemporalColumns = (
dataset: DatasourceMeta & { column_types: GenericDataType[] },
) => dataset?.column_types?.includes(GenericDataType.TEMPORAL);
) => {
const columnTypes = ensureIsArray(dataset?.column_types);
return (
columnTypes.length === 0 || columnTypes.includes(GenericDataType.TEMPORAL)
);
};

/**
* The configuration form for a specific filter.
Expand Down

0 comments on commit 90c8daf

Please sign in to comment.