zhaoyongjie commented on a change in pull request #14969:
URL: https://github.com/apache/superset/pull/14969#discussion_r647586458



##########
File path: 
superset-frontend/src/explore/components/controls/DatasourceControl/index.jsx
##########
@@ -117,6 +118,15 @@ class DatasourceControl extends React.PureComponent {
 
   onDatasourceSave(datasource) {
     this.props.actions.setDatasource(datasource);
+    // remove time column in the form_data
+    const timeCol = this.props.form_data?.granularity_sqla; // 
eslint-disable-line camelcase
+    const { columns } = this.props.datasource;
+    if (
+      datasource.type === 'table' &&
+      !columns.find(({ column_name }) => column_name === timeCol)?.is_dttm // 
eslint-disable-line camelcase
+    ) {
+      this.props.actions.setControlValue('granularity_sqla', null);
+    }

Review comment:
       <del> thanks for your comments!  This has the side effect of leaving an 
unexpected column to do the filtering and grain(in other words, first datetime 
column depends on the order of the columns in the database.). What do you think 
about? </del>




-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to