betodealmeida commented on code in PR #32701:
URL: https://github.com/apache/superset/pull/32701#discussion_r1999133632


##########
superset-frontend/src/explore/components/controls/FilterControl/AdhocFilter/index.js:
##########
@@ -103,34 +93,30 @@ export default class AdhocFilter {
   }
 
   isValid() {
-    const nullCheckOperators = [Operators.IsNotNull, Operators.IsNull].map(
-      op => OPERATOR_ENUM_TO_OPERATOR_TYPE[op].operation,
-    );
-    const truthCheckOperators = [Operators.IsTrue, Operators.IsFalse].map(
-      op => OPERATOR_ENUM_TO_OPERATOR_TYPE[op].operation,
-    );
     if (this.expressionType === ExpressionTypes.Simple) {
-      if (nullCheckOperators.indexOf(this.operator) >= 0) {
-        return !!(this.operator && this.subject);
-      }
-      if (truthCheckOperators.indexOf(this.operator) >= 0) {
-        return !!(this.subject && this.comparator !== null);
+      // operators where the comparator is not used
+      if (
+        DISABLE_INPUT_OPERATORS.map(
+          op => OPERATOR_ENUM_TO_OPERATOR_TYPE[op].operation,
+        ).indexOf(this.operator) >= 0
+      ) {
+        return this.subject;
       }
+
       if (this.operator && this.subject && this.clause) {
         if (Array.isArray(this.comparator)) {
-          if (this.comparator.length > 0) {
-            // A non-empty array of values ('IN' or 'NOT IN' clauses)
-            return true;
-          }

Review Comment:
   If we don't return `true` here we always return `false` at the end of 
function, so we can simplify this to a single line. Ditto below.



-- 
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