- Subscribe to RSS Feed
- Mark Question as New
- Mark Question as Read
- Float this Question for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page
Split string by SemiColon not working in Beeline but works in Hive
- Labels:
-
Apache Hive
Created 03-09-2017 06:48 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
Created 03-09-2017 12:27 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Can you try with '\073'
select split(fieldname,'\073')[0] from table name
Similar issue seen in beeswax connection used by Hue.
Created 03-09-2017 12:27 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Can you try with '\073'
select split(fieldname,'\073')[0] from table name
Similar issue seen in beeswax connection used by Hue.
Created 03-10-2017 10:37 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
It worked.. Thanks..
Created 10-11-2019 10:28 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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".
Created 03-09-2017 12:57 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
Created 05-16-2017 07:56 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
