graceguo-supercat commented on a change in pull request #14567:
URL: https://github.com/apache/superset/pull/14567#discussion_r630577857
##########
File path:
superset-frontend/src/explore/components/controls/FilterControl/AdhocFilterEditPopoverSimpleTabContent/index.jsx
##########
@@ -236,18 +237,42 @@ export default class
AdhocFilterEditPopoverSimpleTabContent extends React.Compon
}
isOperatorRelevant(operator, subject) {
+ const dataSourceType = this.props.datasource.type;
+ const column = this.props.datasource.columns.find(
+ col => col.column_name === subject,
+ );
+ const isColumnBoolean =
+ !!column && (column.type === 'BOOL' || column.type === 'BOOLEAN');
+ const isColumnNumber = !!column && column.type === 'INT';
+
if (operator && CUSTOM_OPERATORS.has(operator)) {
const { partitionColumn } = this.props;
return partitionColumn && subject && subject === partitionColumn;
}
-
+ if (isColumnBoolean) {
+ return (
+ [
+ OPERATORS['IS NULL'],
+ OPERATORS['IS NOT NULL'],
+ ...BOOLEAN_ONLY_OPERATORS,
+ ].indexOf(operator) >= 0
+ );
+ }
+ if (dataSourceType === 'druid' && !isColumnNumber) {
+ return (
+ [...BOOLEAN_ONLY_OPERATORS, ...TABLE_ONLY_OPERATORS].indexOf(operator)
<
+ 0
+ );
+ }
+ if (dataSourceType === 'table' && !isColumnNumber) {
Review comment:
For calculated column, which could be number, string, date, or unset
type. If it is unset, we probably show IS_TRUE, IS_FALSE as option?
Here is an example of setting for calculated column:
<img width="865" alt="Screen Shot 2021-05-11 at 3 13 34 PM"
src="https://user-images.githubusercontent.com/27990562/117892066-e13cc380-b26c-11eb-8f47-41e04e827fdf.png">
--
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.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]