Skip to content

Commit

Permalink
[b/328440720] Cast STRING to FLOAT64 before casting to INTEGER
Browse files Browse the repository at this point in the history
  • Loading branch information
tanclary committed Mar 11, 2024
1 parent 7f5651d commit 1198819
Showing 1 changed file with 5 additions and 1 deletion.
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

0 comments on commit 1198819

Please sign in to comment.