cloudera / hue

Open source SQL Query Assistant service for Databases/Warehouses
https://cloudera.com
Apache License 2.0
1.17k stars 366 forks source link

notebook Error when use non-ascii characters in sql-editor #2534

Closed shing100 closed 3 years ago

shing100 commented 3 years ago

hello! I've been searching all day and I'm leaving an issue. Please help me

version info

the issue was opened to resolve the error. In the hue editor [hive sql-editor]

select * from subway where name = 'station' it works

but

select * from subway where name = '가야역'

error log Error while compiling statement: FAILED: ParseException line 20:40 cannot recognize input near 'like' '' '' in expression specification

It works normally in beeline.


jdbc:hive2://10.100.0.119:10000> select from subway where name = '가야역'; INFO : Compiling command(queryId=konan_20210907155632_77ff7fb9-ede8-41f4-9855-886eb2a1cc58): select from subway where name = '가야역' INFO : Semantic Analysis Completed (retrial = false) INFO : Returning Hive schema: Schema(fieldSchemas:[FieldSchema(name:subway.name, type:string, comment:null), FieldSchema(name:subway.code_list, type:string, comment:null), FieldSchema(name:subway.name_meta, type:string, comment:null)], properties:null) INFO : Completed compiling command(queryId=konan_20210907155632_77ff7fb9-ede8-41f4-9855-886eb2a1cc58); Time taken: 0.116 seconds INFO : Executing command(queryId=konan_20210907155632_77ff7fb9-ede8-41f4-9855-886eb2a1cc58): select * from subway where name = '가야역' INFO : Completed executing command(queryId=konan_20210907155632_77ff7fb9-ede8-41f4-9855-886eb2a1cc58); Time taken: 0.0 seconds INFO : OK +--------------+-------------------+-------------------+ | subway.name | subway.code_list | subway.name_meta | +--------------+-------------------+-------------------+ | 가야역 | 40219 | 부산 > 가야역 | +--------------+-------------------+-------------------+


runcpserver.log

access INFO 10.20.2.125 konan - "POST /notebook/api/close_statement HTTP/1.1" returned in 362ms 200 67 [07/Sep/2021 15:35:05 +0900] hive_server2_lib INFO Retrying with a new session for konan because status is 4 [07/Sep/2021 15:35:05 +0900] decorators ERROR Error running execute Traceback (most recent call last): File "/home/konan/bigdata/hue/desktop/libs/notebook/src/notebook/decorators.py", line 119, in wrapper return f(*args, **kwargs) File "/home/konan/bigdata/hue/desktop/libs/notebook/src/notebook/api.py", line 238, in execute response = _execute_notebook(request, notebook, snippet) File "/home/konan/bigdata/hue/desktop/libs/notebook/src/notebook/api.py", line 213, in _execute_notebook raise ex QueryError: Error while compiling statement: FAILED: ParseException line 3:40 cannot recognize input near 'like' '' '' in expression specification


hive.log

INFO [2915e8b9-cd89-4b57-85b2-cb24bbce6700 HiveServer2-Handler-Pool: Thread-1006] ql.Driver: Compiling command(queryId=konan_20210907153530_49f60f1d-8d66-4670-a91d-382bdaf97f22):

select * from subway where name like '가� 2021-09-07T15:35:30,118 ERROR [2915e8b9-cd89-4b57-85b2-cb24bbce6700 HiveServer2-Handler-Pool: Thread-1006] ql.Driver: FAILED: ParseException line 3:40 cannot recognize input near 'like' '' '' in expression specification org.apache.hadoop.hive.ql.parse.ParseException: line 3:40 cannot recognize input near 'like' '' '' in expression specification at org.apache.hadoop.hive.ql.parse.ParseDriver.parse(ParseDriver.java:223) at org.apache.hadoop.hive.ql.parse.ParseUtils.parse(ParseUtils.java:74) at org.apache.hadoop.hive.ql.parse.ParseUtils.parse(ParseUtils.java:67) at org.apache.hadoop.hive.ql.Driver.compile(Driver.java:616) at org.apache.hadoop.hive.ql.Driver.compileInternal(Driver.java:1826) at org.apache.hadoop.hive.ql.Driver.compileAndRespond(Driver.java:1773) at org.apache.hadoop.hive.ql.Driver.compileAndRespond(Driver.java:1768) at org.apache.hadoop.hive.ql.reexec.ReExecDriver.compileAndRespond(ReExecDriver.java:126) at org.apache.hive.service.cli.operation.SQLOperation.prepare(SQLOperation.java:197) at org.apache.hive.service.cli.operation.SQLOperation.runInternal(SQLOperation.java:260) at org.apache.hive.service.cli.operation.Operation.run(Operation.java:247) at org.apache.hive.service.cli.session.HiveSessionImpl.executeStatementInternal(HiveSessionImpl.java:541) at org.apache.hive.service.cli.session.HiveSessionImpl.executeStatementAsync(HiveSessionImpl.java:527)


How can I solve the problem?

romainr commented 3 years ago

Here looks like the issue comes from Hive and not Hue

shing100 commented 3 years ago

I solved the problem.

edit ~/hue/apps/beeswax/gen-py/TCLIService/ttypes.py

line 3922

oprot.writeString(self.statement) -> oprot.writeString(self.statement.encode('utf-8')