Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: Default temporal column in Datasource #21857
fix: Default temporal column in Datasource #21857
Changes from 3 commits
5bf6059
0dcac0a
3fdca22
18dda9e
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The getTemporalColumns will return a well-designed data structure so the below snippet will handle it. this logic is same as
dndGranularitySqlaControl
. notice that thegranularity_sqla
default value isnull
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@zhaoyongjie I still need to check if the current time col is null, because I only want to replace the existing value if that is null, not otherwise
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@geido
timeColConf
must be a time column, otherwise it wouldn't be set togranularity_sqla
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@geido i jsut reread this codes. the
datasource
is new datasource setting, so we should use the new datasouce instead ofthis.props.datasouce
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@zhaoyongjie
granularity_sqla
can indeed return also a column that is not a time column anymore after the user has unselected the "Is temporal" from the dataset. To try, just select a default time column for the time column control, then edit the dataset and keep the column as default but remove the "Is temporal" flag, you will see thatgranularity_sqla
will still return that value as if it was temporal as indeed that's the last value known when saving the dataset.That's useful because we want to change the control value only when it's empty. This is a product requirement that I confirmed with Kasia as well.
I also found out that the
getTemporalColumns
util isn't working properly. It's setting as default temporal column also columns that are not temporal anymore. In fact, thedatasource.main_dttm_col
can hold a column that was kept as default but removed from "Is temporal". I think this requires a fix in the util itself, but for now I am just making an additional check in my code to account for this issue as I don't want to potentially cause troubles to other parts of the application that are using that util.I made some more improvements to the code but I believe this should be ready to go. I will spin up a testenv if you want to manual test it.
The product requirements for manual testing are the following:
Thanks
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@geido Thank you for the explanation. I understand what you are saying. This has been a long-time-coming issue in the Superset.
The
main_dttm_col
is saved in thetables
table on the Superset metadata. According to Superset's original design(for Druid native query), each dataset must have amain_dttm_col
, it isgranularity_sqla
in the frontend, AKA time column.Every column in the datasource is saved in the
table_columns
table, it has a columnis_dttm
for is_temporal usages.the time column query order is
main_dttm_col
.table_columns
and is_dttm is true.The issue should be that even if we unselected the default column's
is_dttm
attribute, it is still saved in themain_dttm_col
column. We should fix this logic --- remove a non-temporal recorded from main_dttm_col, and not just ignore main_dttm_col on the frontend, which would cause inconsistencies between the front and backend.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@zhaoyongjie I understand that but the fix would be out of scope right now. I need to get the fix for the control out first and I can open a separate issue to investigate the core problem that you are describing. Thanks