Could you try throwing a trim() in before the cast? Might just be
whitespace.

There shouldn't be a need to add the COALESCE statement, as we only ever
read defined values (which may be empty string) out of a CSV file. You
should instead write out a full case statement that checks for empty string
and provides your default value of 0 in that case.

- Jason

Jason Altekruse
Software Engineer at Dremio
Apache Drill Committer

On Thu, Mar 10, 2016 at 2:32 PM, Matt <bsg...@gmail.com> wrote:

> Have some CSV data that Drill 1.5 selects as-is without any problems,
> until I attempt to CAST columns in a CTAS or plain SELECT:
>
> Error: SYSTEM ERROR: NumberFormatException: 140.755
>
> The data is unquoted CSV, and column in question does have the value
> "140.755" (unquoted). As the column can be empty, I am using the following
> transform:
>
>   CAST(COALESCE(t_total, 0) AS double) AS t_total
>
> And on the first data row:
>
> Fragment 1:0
>
> [Error Id: 4b4d83cf-a87d-451e-9cfa-4280e5adf64f on es08:31010]
>
>   (java.lang.NumberFormatException) 140.755
>
> What could be causing this error?
>
>

Reply via email to