Copilot commented on code in PR #37890:
URL: https://github.com/apache/superset/pull/37890#discussion_r2979500712
##########
tests/unit_tests/db_engine_specs/test_kusto.py:
##########
@@ -139,3 +139,72 @@ def test_timegrain_expressions(in_duration: str,
expected_result: str) -> None:
col=col, pdf=None, time_grain=in_duration
)
assert str(actual_result) == expected_result
+
+
+def test_epoch_to_dttm() -> None:
+ """
+ Test that KQL engine spec returns correct epoch to datetime conversion
template.
+ """
+ result = KustoKqlEngineSpec.epoch_to_dttm()
+ assert result == "unixtime_seconds_todatetime({col})"
+
+
+def test_epoch_ms_to_dttm() -> None:
+ """
+ Test that KQL engine spec returns correct epoch milliseconds to
+ datetime conversion template.
+ """
+ result = KustoKqlEngineSpec.epoch_ms_to_dttm()
+ assert result == "unixtime_milliseconds_todatetime({col})"
+
+
+def test_handle_null_filter() -> None:
+ """
+ Test that KQL engine spec uses isnull/isnotnull functions for null filters.
+ """
+ from superset.utils.core import FilterOperator
+
+ test_col = column("test_column")
+
+ # Test IS_NULL - should return isnull(col)
+ result_null = KustoKqlEngineSpec.handle_null_filter(
+ test_col, FilterOperator.IS_NULL
+ )
+ assert str(result_null) == "isnull(test_column)"
+
+ # Test IS_NOT_NULL - should return isnotnull(col)
+ result_not_null = KustoKqlEngineSpec.handle_null_filter(
+ test_col, FilterOperator.IS_NOT_NULL
+ )
+ assert str(result_not_null) == "isnotnull(test_column)"
+
+ # Test invalid operator - should raise ValueError
+ with pytest.raises(ValueError, match="Invalid null filter operator"):
+ KustoKqlEngineSpec.handle_null_filter(test_col, "INVALID_OPERATOR")
Review Comment:
The invalid-operator test passes a `str` to `handle_null_filter`, but the
method is typed to accept `FilterOperator`. Other engine spec tests suppress
this with `# type: ignore[arg-type]` to keep mypy happy; consider adding the
same here to avoid CI typing failures.
```suggestion
KustoKqlEngineSpec.handle_null_filter(test_col, "INVALID_OPERATOR")
# type: ignore[arg-type]
```
--
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]