Skip to content

Commit

Permalink
Removes column_types
Browse files Browse the repository at this point in the history
  • Loading branch information
michael-s-molina committed Jul 8, 2022
1 parent b105035 commit 096bbf7
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ import type {
QueryFormData,
QueryFormMetric,
QueryResponse,
GenericDataType,
} from '@superset-ui/core';
import { sharedControls } from './shared-controls';
import sharedControlComponents from './shared-controls/components';
Expand Down Expand Up @@ -67,7 +66,6 @@ export interface Dataset {
id: number;
type: DatasourceType;
columns: ColumnMeta[];
column_types?: GenericDataType[];
metrics: Metric[];
column_format: Record<string, string>;
verbose_map: Record<string, string>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,14 +86,10 @@ export const datasetToSelectOption = (
label: item.table_name,
});

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

export const doesColumnMatchFilterType = (filterType: string, column: Column) =>
!column.type_generic ||
Expand Down
1 change: 0 additions & 1 deletion superset-frontend/src/dashboard/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ export const PLACEHOLDER_DATASOURCE: Dataset = {
datasource_name: '',
table_name: '',
columns: [],
column_types: [],
metrics: [],
column_format: {},
verbose_map: {},
Expand Down

0 comments on commit 096bbf7

Please sign in to comment.