Skip to content
Snippets Groups Projects
Unverified Commit c2c37135 authored by Robert Roland's avatar Robert Roland Committed by GitHub
Browse files

[[null]] is a valid response (#13596)


* Repro for #13571: Display rows whose value is `null` (#13591) [ci skip]

* Reproduces #13571 

Co-authored-by: default avatarflamber <1447303+flamber@users.noreply.github.com>

* [[null]] is a valid response

Previously, this said that a result of `[[null]]` was an empty result
set, but in reality, it's a valid result set of a single column with a
null value.

Resolves #13571

Co-authored-by: default avatarNemanja Glumac <31325167+nemanjaglumac@users.noreply.github.com>
Co-authored-by: default avatarflamber <1447303+flamber@users.noreply.github.com>
parent 8282a4ec
No related branches found
No related tags found
No related merge requests found
......@@ -20,9 +20,8 @@ type ColumnSetting = {
enabled: boolean,
};
// Many aggregations result in [[null]] if there are no rows to aggregate after filters
export const datasetContainsNoResults = (data: DatasetData): boolean =>
data.rows.length === 0 || _.isEqual(data.rows, [[null]]);
data.rows == null || data.rows.length === 0;
/**
* @returns min and max for a value in a column
......
......@@ -3,12 +3,39 @@ import {
signInAsAdmin,
openOrdersTable,
popover,
withSampleDataset,
} from "__support__/cypress";
describe("scenarios > question > null", () => {
before(restore);
beforeEach(signInAsAdmin);
it("should display rows whose value is `null` (metabase#13571)", () => {
withSampleDataset(({ ORDERS }) => {
cy.request("POST", "/api/card", {
name: "13571",
dataset_query: {
database: 1,
query: {
"source-table": 2,
fields: [ORDERS.DISCOUNT],
filter: ["=", ORDERS.ID, 1],
},
type: "query",
},
display: "table",
visualization_settings: {},
});
// find and open previously created question
cy.visit("/collection/root");
cy.findByText("13571").click();
cy.log("**'No Results since at least v0.34.3**");
cy.findByText("No results!").should("not.exist");
});
});
describe("aggregations with null values", () => {
beforeEach(() => {
cy.server();
......
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