Search code examples
snowflake-cloud-data-platformsnowsql

Are there limitations on Snowflake's split_part function?


Does Snowflake's split_part function have a limit on how large the string or individual delimited parts of the string can be? For e.g. in SQL Server, if any part of the string exceeds 256 bytes, the parsename function will return nullfor that part.

I looked here, but couldn't find any mention of such limitation


Solution

  • To prove that there's no limit close to 256 bytes, I generated a 3MB string with 3 substrings. split_part() was able to extract a 1MB string without problem:

    create table LONG_STRING
    as
    select repeat('abcdefghijk', 100000)||','
      ||repeat('abcdefghijk', 100000)||','
      ||repeat('abcdefghijk', 100000) ls
    ;
    
    select len(ls)
      , len(split_part(ls, ',', 2))
    from LONG_STRING
    
    # 3,300,002 1,100,000