Skip to content
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

[Bugfix] Allowing sqlExpression to be blank #4991

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion superset/assets/src/explore/AdhocFilter.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ export default class AdhocFilter {
this.clause = adhocFilter.clause;
this.sqlExpression = null;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sqlExpression can be set to null here, so you can't predict whether it will be undefined or null

} else if (this.expressionType === EXPRESSION_TYPES.SQL) {
this.sqlExpression = adhocFilter.sqlExpression ||
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure in what cases this would have been undefined if expressionType === sql. Gabe do you have more context here? Is checking for undefined sufficient or do I also need to check for nulls?

this.sqlExpression = typeof adhocFilter.sqlExpression === 'string' ?
adhocFilter.sqlExpression :
translateToSql(adhocFilter, { useSimple: true });
this.clause = adhocFilter.clause;
this.subject = null;
Expand Down