Search code examples
sqlhivehiveqlpresto

How to use split_part function in HIVESql


Here is what i do in prestosql

select split_part('one|||two','|||',1)

result = 'one'

but I can't use this function(split_part) in HIVEsql

Is there any possible function for me to get the same result as above but in HIVEsql?


Solution

  • Maybe this way?

    SELECT split('one|||two','[\\|||]')[0]
    

    The "|" is a reserved character, so you need to scape it properly