Invalid digits on Redshift : <p>I'm trying to load some data from stage to relational environment and something is happening I can't figure out.</p>

<p>I'm trying to run the following query:</p>

<pre><code>SELECT
  CAST(SPLIT_PART(some_field,'_',2) AS BIGINT) cmt_par
FROM
  public.some_table;
</code></pre>

<p>The some_field is a column that has data with two numbers joined by an underscore like this:</p>

<pre><code>some_field -&gt; 38972691802309_48937927428392
</code></pre>

<p>And I'm trying to get the second part.</p>

<p>That said, here is the error I'm getting:</p>

<pre><code>[Amazon](500310) Invalid operation: Invalid digit, Value '1', Pos 0, 
Type: Long 
Details: 
 -----------------------------------------------
  error:  Invalid digit, Value '1', Pos 0, Type: Long 
  code:      1207
  context:   
  query:     1097254
  location:  :0
  process:   query0_99 [pid=0]
  -----------------------------------------------;

Execution time: 2.61s
Statement 1 of 1 finished

1 statement failed.
</code></pre>

<p>It's literally saying some numbers are not valid digits. I've already tried to get the exactly data which is throwing the error and it appears to be a normal field like I was expecting. It happens even if I throw out NULL fields.</p>

<p>I thought it would be an encoding error, but I've not found any references to solve that.
Anyone has any idea?</p>

<p>Thanks everybody.</p>
