Uploaded image for project: 'Apache Airflow'
  1. Apache Airflow
  2. AIRFLOW-1053

HiveOperator: unicode character in HQL query produces "UnicodeEncodeError: 'ascii' codec can't encode character ..."

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • 1.8.0
    • 1.10.0
    • operators

    Description

      Run an attached DAG, for example as:

      airflow test airflow-hive-sample-utf utf-snowman 2017-01-01

      Imporant part:

      unicode_snowman = unichr(0x2603)

      op_test_select = HiveOperator(
      task_id='utf-snowman',
      hql='select \'' + unicode_snowman + '\' as utf_text;',
      dag=dag)

      It should return a single row with an unicode snowman, but instead ends with error:

      UnicodeEncodeError: 'ascii' codec can't encode character u'\u2603' in position 8: ordinal not in range(128)

      The same applies for unicode characters in external .hql files.

      Why is it a problem? Not because of snowmen, but I need to replace some unicode chars in a Hive ETL query.

      Attachments

        1. airflow-hive-utf.py
          1 kB
          Tomas Kafka

        Activity

          People

            Unassigned Unassigned
            tomaskafka Tomas Kafka
            Votes:
            1 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: