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

Sqrt #341

Open
NicoLaval opened this issue May 20, 2024 · 5 comments
Open

Sqrt #341

NicoLaval opened this issue May 20, 2024 · 5 comments
Labels
bug Something isn't working

Comments

@NicoLaval
Copy link
Collaborator

Sqrt throws errors for calls with null / NaN / negative values, BdI tests assume null to be the correct result.

@NicoLaval NicoLaval added the bug Something isn't working label May 20, 2024
@NicoLaval
Copy link
Collaborator Author

@noahboerger

  • NaN : sqrt only admits number as parameter, seems to be the good behaviour to throw an exception
  • negative: Trevas bug , has to return value
  • null:
    • scalars : sqrt(null) null has no inferred type, you have to write sqrt(cast(null, number))
    • components / datasets:
      Considering ds_1 := ds[calc sq := sqrt(a)]; and ds:
id a
IDENTIFIER MEASURE
INTEGER INTEGER
1 2
2 -2
3 null

Trevas ds_1 result will be:

id a sq
IDENTIFIER MEASURE MEASURE
INTEGER INTEGER INTEGER
1 2 4
2 -2 4
3 null null

Thanks to dataset metadata, null is recognized as integer.

@NicoLaval
Copy link
Collaborator Author

TODO: fix behaviour for negative inputs

@noahboerger
Copy link
Collaborator

Thank you for the explanations and plan to fix it for negative inputs.

@hadrienk
Copy link
Collaborator

Just a comment here, but I think I've seen somewhere in the spec that type inference should be supported. It's a very small paragraph and there's not much details. Technically I think this isn't too hard to implement and has great value for the users. But this need to be reworked in the spec.

@NicoLaval
Copy link
Collaborator Author

Not sure about that.
What will be rewrited in 2.1 is implicit casting between known types.

I think your right, when there is no doubt about the null type, we can apply an implicit cast, avoiding users to write lot of cast.

I opened an issue in the TF repo

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants