Skip to content
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

Add Null expression tests #1471

Closed
wants to merge 2 commits into from
Closed

Conversation

mapedraza
Copy link
Collaborator

@mapedraza mapedraza commented Sep 27, 2023

#1440 (comment)

When posting a measure v with value Null to a group with the following attributes:

Expression

            active: [
                {
                    name: 'a',
                    type: 'Number',
                    expression: 'v'
                },
                {
                    name: 'b',
                    type: 'Number',
                    expression: 'v*3'
                },
                {
                    name: 'c',
                    type: 'Boolean',
                    expression: 'v==null'
                },
                {
                    name: 'd',
                    type: 'Text',
                    expression: "v?'no soy null':'soy null'"
                },
                {
                    name: 'e',
                    type: 'Text',
                    expression: "v==null?'soy null':'no soy null'"
                },
                {
                    name: 'f',
                    type: 'Text',
                    expression: "(v*3)==null?'soy null':'no soy null'"
                },
                {
                    name: 'g',
                    type: 'Boolean',
                    expression: 'v == undefined'
                }
            ]

Expectations

                    v: {
                        value: null,
                        type: 'Number'
                    },
                    b: {
                        value: 0,
                        type: 'Number'
                    },
                    c: {
                        value: true,
                        type: 'Boolean'
                    },
                    d: {
                        value: 'soy null',
                        type: 'Text'
                    },
                    e: {
                        value: 'soy null',
                        type: 'Text'
                    },
                    f: {
                        value: 'no soy null',
                        type: 'Text'
                    },
                    g: {
                        value: true,
                        type: 'Boolean'
                    }

@mapedraza
Copy link
Collaborator Author

Pending to validate if expectations are the expected

@mapedraza
Copy link
Collaborator Author

Added more cases after discussing with @mrutid and some other minor fixes

  • With null values
  • With null and skipValues
  • Without values (NaN)
  • Without values (NaN) and skipValues
  • With explicitAttrs

@mapedraza
Copy link
Collaborator Author

Conclusions:

  • case b (v*3)
    • For Null values, is always failing (treating Null as 0)
    • For NaN values, it works well, giving Null as response.
  • case f ((v*3)==Null?'soy null':'no soy null') is always failing
  • Using explicitAttrs acts as sending a measurement with null value

@mapedraza mapedraza marked this pull request as ready for review September 28, 2023 10:55
@mapedraza mapedraza changed the title [WIP] Null expression tests Add Null expression tests Sep 28, 2023
@AlvaroVega
Copy link
Member

AlvaroVega commented Sep 28, 2023

  • For Null values, is always failing (treating Null as 0)
  • case f ((v*3)==Null?'soy null':'no soy null') is always failing

Then these tests should fails in that expected values? Currently are passing.
I mean these tests should check expected values in each case.

@mapedraza
Copy link
Collaborator Author

  • For Null values, is always failing (treating Null as 0)
  • case f ((v*3)==Null?'soy null':'no soy null') is always failing

Then these tests should fails in that expected values? Currently are passing. I mean these tests should check expected values in each case.

Right now, tests are set with the real behaviour. This need to be fixed according the real expected value in a subsequent PR

@mapedraza
Copy link
Collaborator Author

overpassed by #1474

@mapedraza mapedraza closed this Oct 2, 2023
@fgalan fgalan deleted the task/add-expressions-tests-nulls branch October 2, 2023 13:38
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.

2 participants