Uploaded image for project: 'Hue (READ ONLY)'
  1. Hue (READ ONLY)
  2. HUE-9273

[notebook] Encoding Error when use non-ascii characters in sql-editor-variables

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 4.7.0
    • Fix Version/s: 4.8.0
    • Component/s: app.editor
    • Labels:
    • Environment:

      reproducable in Any version of Hue 4.x

    • Easy:
      Easy

      Description

      Problems statement :  Try to execute the Query in Imphala Editor/Hive Editor : 

       

      insert into <table> values(${id},'${name}');
      set ${name}='녕하세' and ${id}=5
      
      
      

      It wont execute well , the error will popup : 

      'ascii' codec can't encode characters in position 0-1: ordinal not in range(128)

      runcp-server.log gives below exception : 

      [23/Apr/2020 23:51:13 -0700] decorators   ERROR    Error running execute
      Traceback (most recent call last):
        File "/opt/cloudera/parcels/CDH-6.3.3-1.cdh6.3.3.p0.1796617/lib/hue/desktop/libs/notebook/src/notebook/decorators.py", line 98, in decorator
          return func(*args, **kwargs)
        File "/opt/cloudera/parcels/CDH-6.3.3-1.cdh6.3.3.p0.1796617/lib/hue/desktop/libs/notebook/src/notebook/api.py", line 184, in execute
          response = _execute_notebook(request, notebook, snippet)
        File "/opt/cloudera/parcels/CDH-6.3.3-1.cdh6.3.3.p0.1796617/lib/hue/desktop/libs/notebook/src/notebook/api.py", line 128, in _execute_notebook
          history = _historify(notebook, request.user)
        File "/opt/cloudera/parcels/CDH-6.3.3-1.cdh6.3.3.p0.1796617/lib/hue/desktop/libs/notebook/src/notebook/api.py", line 421, in _historify
          history_doc.search = _get_statement(notebook)
        File "/opt/cloudera/parcels/CDH-6.3.3-1.cdh6.3.3.p0.1796617/lib/hue/desktop/libs/notebook/src/notebook/api.py", line 429, in _get_statement
          return Notebook.statement_with_variables(notebook['snippets'][0])
        File "/opt/cloudera/parcels/CDH-6.3.3-1.cdh6.3.3.p0.1796617/lib/hue/desktop/libs/notebook/src/notebook/connectors/base.py", line 137, in statement_with_variables
          statement_raw
        File "/opt/cloudera/parcels/CDH-6.3.3-1.cdh6.3.3.p0.1796617/lib/hue/build/env/lib64/python2.7/re.py", line 151, in sub
          return _compile(pattern, flags).sub(repl, string, count)
        File "/opt/cloudera/parcels/CDH-6.3.3-1.cdh6.3.3.p0.1796617/lib/hue/desktop/libs/notebook/src/notebook/connectors/base.py", line 128, in replace
          value = str(variable['value'])
      UnicodeEncodeError: 'ascii' codec can't encode characters in position 0-1: ordinal not in range(128)
      

      Refer to Attached Screenshot : 

        Attachments

          Activity

            People

            • Assignee:
              asnaik Akhil S Naik
              Reporter:
              asnaik Akhil S Naik
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: