redash icon indicating copy to clipboard operation
redash copied to clipboard

Make NULL values visible

Open yoshiokatsuneo opened this issue 6 months ago • 11 comments
trafficstars

What type of PR is this?

  • [x] Feature

Description

Before this PR, on table visualization, NULL value is not visible but shown just as empty string(""). We cannot distinguish between empty string("") and NULL value on the table view.

This PR makes NULL values visible so that we can know the value is not empty string but NULL value. This is common behavior on many SQL tools.

How is this tested?

  • [x] Manually

I run SQL query generate NULL values like below, and I confirmed that the data is shown as NULL.

select
    1,
    'aa',
    null,
    cast(null as int64),
    cast(null as string),
    cast(null as date),
    cast(null as timestamp)
image

yoshiokatsuneo avatar May 16 '25 18:05 yoshiokatsuneo

I really like this idea, but I bet we need to make this configurable (e.g. https://www.postgresql.org/docs/current/app-psql.html#APP-PSQL-META-COMMAND-PSET-NULL)

We could store this in organizations.settings

eradman avatar May 20 '25 13:05 eradman

@eradman

Thank you for your comment !

But, I don't know any GUI / Web base tools that "NULL" text is configurable. (BigQuery / Snowflake / Looker Studio / phpMyAdmin / Sequel Ace / Athena / superset / metabase, etc... )

And so, I guess there is little demand to make NULL text configurable.

Also, I think it makes redash complex if we make every special value configurable, like emtpy string, NaN, Infinity, true, false ...

Also, for GUI tools, we can make many things configurable, like color, font, style configurable.

Do you think we should make these styles configurable ?

yoshiokatsuneo avatar May 20 '25 14:05 yoshiokatsuneo

What I am anticipating is that some Redash users prefer the current handling of null values, and we will need a workaround.

There are already some settings that are not configurable from the Redash GUI, but can be changed. For example the default number format can be set:

UPDATE organizations
SET settings = jsonb_set(settings::jsonb, '{settings,float_format}', '"0.0"', true);

eradman avatar May 20 '25 17:05 eradman

@eradman

What I am anticipating is that some Redash users prefer the current handling of null values, and we will need a workaround.

Thank you. I see ! So, I guess we can just have a option like 'visible_null_value' boolean value. How about ?

yoshiokatsuneo avatar May 20 '25 18:05 yoshiokatsuneo

So, I guess we can just have a option like 'visible_null_value' boolean value

I had in mind a text value:

  "null_value": "null"

This would be used by NullValueComponent()

eradman avatar May 20 '25 18:05 eradman

So, I guess we can just have a option like 'visible_null_value' boolean value

I had in mind a text value:

  "null_value": "null"

This would be used by NullValueComponent()

@eradman Thanks ! I'll implement like that !

yoshiokatsuneo avatar May 21 '25 08:05 yoshiokatsuneo

@yoshiokatsuneo, after thinking about this further realized we need to get some feedback from other contributors--people are going to care about this and how it can be enabled/configured.

Please don't spend too much time on this, let's see if others will comment!

eradman avatar May 21 '25 13:05 eradman

I would appreciate the ability to see nulls (distinctly from empty or blank strings). I don't feel strongly about how it's implemented, but I would prefer to be able to distinguish an actual null value from the string "null" or similar.

jonahgreenthal avatar May 21 '25 13:05 jonahgreenthal

@jonahgreenthal

Thank you for your feedback ! In this PR, I changed the text color to gray, and the text style to italic for the NULL value so that we can distinguish "null" string from NULL value, like below. This is similar style as most other GUI / Web-based SQL tools. How about ?

image

yoshiokatsuneo avatar May 21 '25 14:05 yoshiokatsuneo

Yep, that works for me. I saw you had done it, I just wanted to emphasize that I thought it was an important aspect, but I probably didn't communicate it very well.

jonahgreenthal avatar May 21 '25 14:05 jonahgreenthal

@jonahgreenthal I see ! Thanks !

yoshiokatsuneo avatar May 21 '25 14:05 yoshiokatsuneo

@eradman

Hello

let's see if others will comment!

I think we have waited for about 50 days, and no one care. Isn't it enough time ?

yoshiokatsuneo avatar Jul 11 '25 16:07 yoshiokatsuneo

let's see if others will comment!

I think we have waited for about 50 days, and no one care. Isn't it enough time ?

I don't understand the question.

I'll take another look at this PR early next week.

eradman avatar Jul 11 '25 18:07 eradman

@eradman

I don't understand the question.

Sorry, I mean, you have suggested that we should wait for comments for others, but I believe we have waited long enough.

I'll take another look at this PR early next week.

Thank you !

yoshiokatsuneo avatar Jul 11 '25 18:07 yoshiokatsuneo

We need a way to configure the representation of NULL values. Attached is the start of the patch to make this happen null-value-diff.txt

eradman avatar Jul 14 '25 21:07 eradman

@eradman

Thank you very much for the patch ! I applied the patch and adjusted the code.

https://github.com/getredash/redash/pull/7439/commits/56b64e4be6d9a242ed887bb3d49e50baa575772c

yoshiokatsuneo avatar Jul 15 '25 18:07 yoshiokatsuneo