dosubot[bot] commented on issue #36304: URL: https://github.com/apache/superset/issues/36304#issuecomment-3584939965
<!-- Greeting --> Hi @harry-flw! I'm [Dosu](https://go.dosu.dev/dosubot) and I’m helping the superset team. <!-- Answer --> This is a known limitation of the ENABLE_SUPERSET_META_DB feature. The meta database adapter only supports one filter per column, so when you use a WHERE clause with multiple OR conditions on the same column (like `t1.DeviceId = 2560 OR t1.DeviceId = 2562 ...`), only the last condition is actually applied. This means your query effectively filters by just the last value, which can easily result in no data being returned if that value doesn't match any rows. This behavior is due to how filters are stored and pushed down in the adapter's implementation ([source](https://github.com/apache/superset/blob/829e4d92d91ceae4b43b1ed3b063ffe45377799c/superset/extensions/metadb.py#L17-L419)). As a workaround, try rewriting your WHERE clause using the `IN` operator, like `WHERE t1.DeviceId IN (2560, 2562, 2564, 2565)`. This should be interpreted as a single filter and work as expected. Keep in mind that ENABLE_SUPERSET_META_DB is experimental and all joins/aggregations happen in memory, so it's only suitable for moderate data sizes and has performance/security caveats. For production-grade cross-database joins, it's recommended to use a federated query engine like Trino directly ([docs](https://github.com/apache/superset/blob/829e4d92d91ceae4b43b1ed3b063ffe45377799c/docs/docs/configuration/databases.mdx#L1775-L1816)). If you continue to see unexpected results, check your Superset and Trino logs for errors. Let me know if you need help restructuring your query or want more details on the meta database configuration. <!-- Dosu Comment Footer --> *To reply, just mention [@dosu](https://go.dosu.dev/dosubot).* --- <sup>How did I do? [Good](https://app.dosu.dev/response-feedback/67a17ba2-fdec-4e46-868e-8341d0472b35?feedback_type=great_response) | [Irrelevant](https://app.dosu.dev/response-feedback/67a17ba2-fdec-4e46-868e-8341d0472b35?feedback_type=irrelevant_answer) | [Incorrect](https://app.dosu.dev/response-feedback/67a17ba2-fdec-4e46-868e-8341d0472b35?feedback_type=incorrect_sources) | [Verbose](https://app.dosu.dev/response-feedback/67a17ba2-fdec-4e46-868e-8341d0472b35?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/67a17ba2-fdec-4e46-868e-8341d0472b35?feedback_type=hallucination) | [Report 🐛](https://app.dosu.dev/response-feedback/67a17ba2-fdec-4e46-868e-8341d0472b35?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/67a17ba2-fdec-4e46-868e-8341d0472b35?feedback_type=other)</sup> [](https://app.dosu.dev/a28d3c7e-a9d3-459e-9fb6-3a6f9ff4f357/ask?utm_source=github) [](https://cursor.com/link/prompt?text=This%20is%20a%20known%20limitation%20of%20the%20ENABLE_SUPERSET_META_DB%20feature.%20The%20meta%20database%20adapter%20only%20supports%20one%20filter%20per%20column%2C%20so%20when%20you%20use%20a%20WHERE%20clause%20with%20multiple%20OR%20conditions%20on%20the%20same%20column%20%28like%20%60t1.DeviceId%20%3D%202560%20OR%20t1.DeviceId%20%3D%202562%20...%60%29%2C%20only%20the%20last%20condition%20is%20actually%20applied.%20This%20means%20your%20query%20effectively%20filters%20by%20just%20the%20last%20value%2C%20which%20can%20easily%20result%20in%20no%20data%20being%20returned%20if%20that%20value%20doesn%27t%20match%20any%20rows.%20This%20behavior%20is%20due%20to%20how%20filters%20are%20stored%20and%20pushed%20down%20in%20the%20adapter%27s%20implementa tion%C2%A0%28%5Bsource%5D%28https%3A//github.com/apache/superset/blob/829e4d92d91ceae4b43b1ed3b063ffe45377799c/superset/extensions/metadb.py%23L17-L419%29%29.%0A%0AAs%20a%20workaround%2C%20try%20rewriting%20your%20WHERE%20clause%20using%20the%20%60IN%60%20operator%2C%20like%20%60WHERE%20t1.DeviceId%20IN%20%282560%2C%202562%2C%202564%2C%202565%29%60.%20This%20should%20be%20interpreted%20as%20a%20single%20filter%20and%20work%20as%20expected.%0A%0AKeep%20in%20mind%20that%20ENABLE_SUPERSET_META_DB%20is%20experimental%20and%20all%20joins/aggregations%20happen%20in%20memory%2C%20so%20it%27s%20only%20suitable%20for%20moderate%20data%20sizes%20and%20has%20performance/security%20caveats.%20For%20production-grade%20cross-database%20joins%2C%20it%27s%20recommended%20to%20use%20a%20federated%20query%20engine%20like%20Trino%20directly%C2%A0%28%5Bdocs%5D%28https%3A//github.com/apache/superset/blob/829e4d92d91ceae4b43b1ed3b063ffe45377799c/docs/docs/configuration/databases.mdx%23L1775-L1816%29%29.% 0A%0AIf%20you%20continue%20to%20see%20unexpected%20results%2C%20check%20your%20Superset%20and%20Trino%20logs%20for%20errors.%20Let%20me%20know%20if%20you%20need%20help%20restructuring%20your%20query%20or%20want%20more%20details%20on%20the%20meta%20database%20configuration.) [](https://go.dosu.dev/discord-bot) [](https://twitter.com/intent/tweet?text=%40dosu_ai%20helped%20me%20solve%20this%20issue!&url=https%3A//github.com/apache/superset/issues/36304) -- 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]
