FrancescoCastaldi opened a new pull request, #44355:
URL: https://github.com/apache/superset/pull/44355
### SUMMARY
Fixes #36765.
Creating native filters or applying boolean filters on Databricks datasets
currently causes Databricks queries to fail with:
```
Error: [DATATYPE_MISMATCH.DATA_DIFF_TYPES] Cannot resolve "(is_test_user IN
(0))" due to data type mismatch: Input to `in` should all be the same type, but
it's ["BOOLEAN", "INT"]. SQLSTATE: 42K09
```
Similarly to Amazon Athena, Snowflake, Presto/Trino, and ClickHouse,
Databricks SQL and Spark SQL expect equality operators (`col = true` / `col =
false`) rather than integer-based `IN (0)` or `IS` expressions.
This PR sets `use_equality_for_boolean_filters = True` on:
- `DatabricksBaseEngineSpec` (inherited by `DatabricksNativeEngineSpec` and
`DatabricksPythonConnectorEngineSpec`)
- `DatabricksHiveEngineSpec`
- `SparkEngineSpec`
### TESTING INSTRUCTIONS
- Added unit tests in `tests/unit_tests/db_engine_specs/test_databricks.py`
verifying:
- Property existence across `DatabricksBaseEngineSpec`,
`DatabricksNativeEngineSpec`, `DatabricksPythonConnectorEngineSpec`,
`DatabricksHiveEngineSpec`, and `SparkEngineSpec`.
- SQLAlchemy compilation of `handle_boolean_filter` to equality
expressions (`is_test_user = true`, `is_test_user = false`).
- Handling of computed boolean expressions (e.g. `(total_amount > 100) =
true`).
### ADDITIONAL INFORMATION
- [x] Has associated issue: fixes #36765
- [ ] Required feature flags:
- [ ] Changes UI
- [ ] Includes DB Migration (follow approval process in SIP-59)
- [ ] Introduces new feature or API
- [ ] Removes existing feature or API
--
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]