Support Questions

Find answers, ask questions, and share your expertise

Split string by SemiColon not working in Beeline but works in Hive

avatar
Contributor

Hi All,

I am trying to split a string with semicolon using the below query. In Beeline, Its thrwing me Parse execption error. But in Hive its working fine. I am properly escaping the semicolan in my query. Below is my query.

select split(fieldname,'\;') from table name

I also tried

select split(fieldname,'\\;') from table name

I also tried with double quotes. But Nothing is working in Beeline shell. But in Hive shell, no issues. Query is running fine.

Beeline is throwing below error

Error: Error while compiling statement: FAILED: ParseException line 1:29 cannot recognize input near '<EOF>' '<EOF>' '<EOF>' in select expression (state=42000,code=40000)

Kindly let me know the proper way to escape the semi colans.

1 ACCEPTED SOLUTION

avatar
Expert Contributor

@Padmanabhan Vijendran

Can you try with '\073'

select split(fieldname,'\073')[0] from table name

Similar issue seen in beeswax connection used by Hue.

https://issues.cloudera.org/browse/HUE-1332

View solution in original post

5 REPLIES 5

avatar
Expert Contributor

@Padmanabhan Vijendran

Can you try with '\073'

select split(fieldname,'\073')[0] from table name

Similar issue seen in beeswax connection used by Hue.

https://issues.cloudera.org/browse/HUE-1332

avatar
Contributor

It worked.. Thanks..

avatar
New Contributor

It really works after replacing ';' with '\073' !

I met this problem when using split and ';' in crontab hql, it returns " ParseException line 3:121 cannot recognize input near '<EOF>' '<EOF>' '<EOF>' in select expression".

avatar
Master Mentor

Please use backtick for column name and it will treat all characters in the field literally

Table names and column names are case insensitive.

  • In Hive 0.12 and earlier, only alphanumeric and underscore characters are allowed in table and column names.
  • In Hive 0.13 and later, column names can contain any Unicode character (see HIVE-6013). Any column name that is specified within backticks (`) is treated literally. Within a backtick string, use double backticks (``) to represent a backtick character.

https://cwiki.apache.org/confluence/display/Hive/LanguageManual+Select

avatar
Rising Star

it's not only an issue with split, also with eg concat. escaping a semicolon in hue works fine but beeline errors with the same error as above.

Replacing the semicolon with \073 works here as well.