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

[b/328440720] Cast STRING to FLOAT64 before casting to INTEGER #45

Merged
merged 1 commit into from
Mar 12, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion connector/tableau/looker-jdbc/dialect.tdd
Original file line number Diff line number Diff line change
Expand Up @@ -553,7 +553,11 @@
<argument type='int' />
</function>
<function group='cast' name='INT' return-type='int'>
<formula>CAST((%1) AS INTEGER)</formula>
<!-- Casting directly to INTEGER errors if there's a decimal, so cast to FLOAT64 first.
Casting FLOAT64 to INTEGER returns the nearest integer so something like "19.8"
will becoming 20. The alternative is to add extra logic to ensure the whole part
remains the same, but this is more complicated (a.k.a. more error prone). -->
<formula>CAST(CAST((%1) AS FLOAT64) AS INTEGER)</formula>
<argument type='str' />
</function>
<function group='cast' name='INT' return-type='int'>
Expand Down
Loading