Repository: apache/superset
File: superset/db_engine_specs/base.py (Python)

Code before:
        """
        return None

    @classmethod
    def handle_boolean_filter(
        cls, sqla_col: Any, op: str, value: bool
    ) -> BinaryExpression:
        """
        Handle boolean filter operations with engine-specific logic.

        By default, uses SQLAlchemy's IS operator (column IS true/false).
        Engines that don't support IS for boolean values can override
        use_equality_for_boolean_filters to use equality operators instead.

        :param sqla_col: SQLAlchemy column element
        :param op: Filter operator (IS_TRUE or IS_FALSE)
        :param value: Boolean value (True or False)
        :return: SQLAlchemy expression for the boolean filter
        """
        if cls.use_equality_for_boolean_filters:
            return sqla_col == value
        else:
            return sqla_col.is_(value)

    @classmethod
    def handle_null_filter(cls, sqla_col: Any, op: str) -> BinaryExpression:
        """
        Handle null/not null filter operations.

        :param sqla_col: SQLAlchemy column element
        :param op: Filter operator (IS_NULL or IS_NOT_NULL)
        :return: SQLAlchemy expression for the null filter
        """
        from superset.utils import core as utils

        if op == utils.FilterOperator.IS_NULL.value:
            return sqla_col.is_(None)
        elif op == utils.FilterOperator.IS_NOT_NULL.value:
            return sqla_col.isnot(None)
        else:
            raise ValueError(f"Invalid null filter operator: {op}")

    @classmethod
    def handle_comparison_filter(
        cls, sqla_col: Any, op: str, value: Any
    ) -> BinaryExpression:
        """
        Handle comparison filter operations (=, !=, >, <, >=, <=).

        :param sqla_col: SQLAlchemy column element
        :param op: Filter operator

Review comment (bug):
We could be more strict in the `op` type here, to have the type checker catch incorrect calls to this method:

```suggestion
    def handle_null_filter(
        cls,
        sqla_col: Any,
        op: utils.FilterOperator.IS_NULL | utils.FilterOperator.IS_NOT_NULL,
    ) -> BinaryExpression:
```

Code after:
        """
        return None

    @classmethod
    def handle_boolean_filter(
        cls, sqla_col: Any, op: str, value: bool
    ) -> BinaryExpression:
        """
        Handle boolean filter operations with engine-specific logic.

        By default, uses SQLAlchemy's IS operator (column IS true/false).
        Engines that don't support IS for boolean values can override
        use_equality_for_boolean_filters to use equality operators instead.

        :param sqla_col: SQLAlchemy column element
        :param op: Filter operator (IS_TRUE or IS_FALSE)
        :param value: Boolean value (True or False)
        :return: SQLAlchemy expression for the boolean filter
        """
        if cls.use_equality_for_boolean_filters:
            return sqla_col == value
        else:
            return sqla_col.is_(value)

    @classmethod
    def handle_null_filter(
        cls,
        sqla_col: Any,
        op: utils.FilterOperator,
    ) -> BinaryExpression:
        """
        Handle null/not null filter operations.

        :param sqla_col: SQLAlchemy column element
        :param op: Filter operator (IS_NULL or IS_NOT_NULL)
        :return: SQLAlchemy expression for the null filter
        """
        from superset.utils import core as utils

        if op == utils.FilterOperator.IS_NULL:
            return sqla_col.is_(None)
        elif op == utils.FilterOperator.IS_NOT_NULL:
            return sqla_col.isnot(None)
        else:
            raise ValueError(f"Invalid null filter operator: {op}")

    @classmethod
    def handle_comparison_filter(
        cls, sqla_col: Any, op: utils.FilterOperator, value: Any
    ) -> BinaryExpression:
        """