Skip to content

Commit

Permalink
Workaround for clickhouse bug in numerical data parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
alisman committed Dec 6, 2024
1 parent 803f257 commit 3a841ef
Showing 1 changed file with 3 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -880,6 +880,9 @@
-->
<sql id="castStringValueToFloat">
multiIf(
-- This condition is to prevent casting non numerical values to float
NOT match(${attribute_value}, '^[>&lt;]?=?[-+]?[0-9]*[.,]?[0-9]+$'),
NULL,
(startsWith(${attribute_value}, '&lt;=') OR startsWith(${attribute_value}, '>=')),
cast(substr(${attribute_value}, 3) as float),
startsWith(${attribute_value}, '&lt;'),
Expand Down

0 comments on commit 3a841ef

Please sign in to comment.