Skip to content
Snippets Groups Projects
Unverified Commit 5186f6a6 authored by Alexander Lesnenko's avatar Alexander Lesnenko Committed by GitHub
Browse files

Fix filtering by null (#18400)

parent dce0a7d4
No related branches found
No related tags found
No related merge requests found
......@@ -163,7 +163,7 @@ const getNextRunParameterValues = createSelector(
);
function normalizeClause(clause) {
return typeof clause.raw === "function" ? clause.raw() : clause;
return typeof clause?.raw === "function" ? clause.raw() : clause;
}
// Certain differences in a query should be ignored. `normalizeQuery`
......
......@@ -82,6 +82,23 @@ describe("normalizeQuery", () => {
});
describe("structured query", () => {
it("handles null in filter clauses", () => {
const FILTER_WITH_NULL = ["=", ["field", ORDERS.TOTAL, null], null];
const { datasetQuery } = setup({
query: {
filter: FILTER_WITH_NULL,
},
});
const { query: normalizedQuery } = normalizeQuery(datasetQuery);
expect(normalizedQuery).toEqual({
...datasetQuery.query,
filter: FILTER_WITH_NULL,
});
});
it("adds explicit list of fields if missing", () => {
const { datasetQuery, query, tableMetadata } = setup();
const expectedFields = getTableFields(query.sourceTableId());
......
......@@ -159,7 +159,7 @@ describe("scenarios > question > null", () => {
});
});
it.skip("should filter by clicking on the row with `null` value (metabase#18386)", () => {
it("should filter by clicking on the row with `null` value (metabase#18386)", () => {
openOrdersTable();
// Total of "39.72", and the next cell is the `discount` (which is empty)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment