You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by GitBox <gi...@apache.org> on 2022/07/08 03:34:59 UTC

[GitHub] [superset] zhaoyongjie commented on a diff in pull request #20645: refactor: Unify shared datasources reducers and actions

zhaoyongjie commented on code in PR #20645:
URL: https://github.com/apache/superset/pull/20645#discussion_r916432864


##########
superset-frontend/packages/superset-ui-chart-controls/src/types.ts:
##########
@@ -79,6 +81,7 @@ export interface Dataset {
   description: string | null;
   uid?: string;
   owners?: Owner[];
+  table_name?: string;

Review Comment:
   I'm curious, why do we need to append table_name to a column?



##########
superset-frontend/packages/superset-ui-chart-controls/src/types.ts:
##########
@@ -66,6 +67,7 @@ export interface Dataset {
   id: number;
   type: DatasourceType;
   columns: ColumnMeta[];
+  column_types?: GenericDataType[];

Review Comment:
   the `GenericDataType` has been in ColumnMeta.



##########
superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/FiltersConfigForm/utils.ts:
##########
@@ -88,9 +88,7 @@ export const datasetToSelectOption = (
 
 // 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 & { column_types: GenericDataType[] },
-) => {
+export const hasTemporalColumns = (dataset: Dataset) => {
   const columnTypes = ensureIsArray(dataset?.column_types);
   return (
     columnTypes.length === 0 || columnTypes.includes(GenericDataType.TEMPORAL)

Review Comment:
   Refactor this function by looping through the `dataset.columns`.
   
   ```
    ensureIsArray(dataset.columns).some((column) => column.type_generic === GenericDataType.TEMPORAL)
   
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org