Skip to content

Make NULL values visible #7439

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

yoshiokatsuneo
Copy link
Contributor

What type of PR is this?

  • 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?

  • 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 yoshiokatsuneo force-pushed the feat/make_null_value_visible branch from 2f94851 to cd35c27 Compare May 16, 2025 18:39
@yoshiokatsuneo yoshiokatsuneo marked this pull request as draft May 16, 2025 20:02
@yoshiokatsuneo yoshiokatsuneo force-pushed the feat/make_null_value_visible branch from cd35c27 to 092bbc8 Compare May 17, 2025 07:36
@yoshiokatsuneo yoshiokatsuneo marked this pull request as ready for review May 17, 2025 08:25
@yoshiokatsuneo yoshiokatsuneo force-pushed the feat/make_null_value_visible branch from 2010223 to 092bbc8 Compare May 17, 2025 10:28
@eradman
Copy link
Collaborator

eradman commented May 20, 2025

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

@yoshiokatsuneo
Copy link
Contributor Author

yoshiokatsuneo commented May 20, 2025

@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 ?

@eradman
Copy link
Collaborator

eradman commented May 20, 2025

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);

@yoshiokatsuneo
Copy link
Contributor Author

@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 ?

@eradman
Copy link
Collaborator

eradman commented May 20, 2025

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()

@yoshiokatsuneo
Copy link
Contributor Author

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 !

@eradman
Copy link
Collaborator

eradman commented May 21, 2025

@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!

@jonahgreenthal
Copy link

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.

@yoshiokatsuneo
Copy link
Contributor Author

@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

@jonahgreenthal
Copy link

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.

@yoshiokatsuneo
Copy link
Contributor Author

@jonahgreenthal I see ! Thanks !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants