[ 
https://issues.apache.org/jira/browse/LIVY-858?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

ighack updated LIVY-858:
------------------------
    Description: 
headers = \{'Content-Type': 'application/json;charset=UTF-8'}
statements_url = session_url + '/statements'
 data = 

{ 'code': textwrap.dedent("""     import org.apache.spark.sql.

{SaveMode, SparkSession}

    import org.apache.spark.sql.types._
     import org.apache.spark.\{SparkConf, SparkContext}

    val sparkhive = SparkSession.builder().appName("spark read 
hive").enableHiveSupport().getOrCreate()

    val df = sparkhive.sql("select * from hivetest.chinese_par")
     df.show()
     """)
 }

r = requests.post(statements_url, data=json.dumps(data), headers=headers)
 pprint.pprint(r.json())

statement_url = host + r.headers['location']
 r = requests.get(statement_url, headers=headers)
 pprint.pprint(r.json())
  
  
 I get 
  
  '+-----+--+++--------\n'
 '| id|name|year|city|\n'
 '+-----+--+++--------\n'
 '| 4| wk|2019|??|\n'
 '| 5| wk|2019|??|\n'
 '| 6| wk|2019|??|\n'
 '| 7| wk|2019|??|\n'
 '| |null|null|??|\n'
 '| |null|null|??|\n'
 '| |null|null|??|\n'
 '| 8| wk|2020|??|\n'
 '| 9| wk|2020|??|\n'
 '| 10| wk|2020|??|\n'
 '| 11| wk|2020|??|\n'
 '| 1| wk|2018|??|\n'
 '| 2| wk|2018|??|\n'
 '| 3| wk|2018|??|\n'
 '| 3| wk|2018|??|\n'
 '+-----+--+++--------\n'
  
 city is chinese, but display as "?"
  

 

in zeppelin is ok

 

+----+---++--------+
|id|name|year|city|

+----+---++--------+
|4|wk|2019|重庆|
|5|wk|2019|重庆|
|6|wk|2019|重庆|
|7|wk|2019|重庆| |
| |null|null|重庆|
| |null|null|重庆|
| |null|null|重庆|

  was:
statements_url = session_url + '/statements'
 data = 

{ 'code': textwrap.dedent("""     import org.apache.spark.sql.\\{SaveMode, 
SparkSession}

    import org.apache.spark.sql.types._
     import org.apache.spark.\{SparkConf, SparkContext}

    val sparkhive = SparkSession.builder().appName("spark read 
hive").enableHiveSupport().getOrCreate()

    val df = sparkhive.sql("select * from hivetest.chinese_par")
     df.show()
     """)
 }

r = requests.post(statements_url, data=json.dumps(data), headers=headers)
 pprint.pprint(r.json())

statement_url = host + r.headers['location']
 r = requests.get(statement_url, headers=headers)
 pprint.pprint(r.json())
  
  
 I get 
  
  '+----+---++--------+\n'
 '| id|name|year|city|\n'
 '+----+---++--------+\n'
 '| 4| wk|2019|??|\n'
 '| 5| wk|2019|??|\n'
 '| 6| wk|2019|??|\n'
 '| 7| wk|2019|??|\n'
 '| |null|null|??|\n'
 '| |null|null|??|\n'
 '| |null|null|??|\n'
 '| 8| wk|2020|??|\n'
 '| 9| wk|2020|??|\n'
 '| 10| wk|2020|??|\n'
 '| 11| wk|2020|??|\n'
 '| 1| wk|2018|??|\n'
 '| 2| wk|2018|??|\n'
 '| 3| wk|2018|??|\n'
 '| 3| wk|2018|??|\n'
 '+----+---++--------+\n'
  
 city is chinese, but display as "?"
  

 

in zeppelin is ok

 

+---+----+----+----+

| id|name|year|city|

+---+----+----+----+
|4|wk|2019|重庆|

|5|wk|2019|重庆|

|6|wk|2019|重庆|

|7|wk|2019|重庆| |

| |null|null|重庆|

| |null|null|重庆|

| |null|null|重庆|


> about Chinese display problem?
> ------------------------------
>
>                 Key: LIVY-858
>                 URL: https://issues.apache.org/jira/browse/LIVY-858
>             Project: Livy
>          Issue Type: Bug
>            Reporter: ighack
>            Priority: Major
>
> headers = \{'Content-Type': 'application/json;charset=UTF-8'}
> statements_url = session_url + '/statements'
>  data = 
> { 'code': textwrap.dedent("""     import org.apache.spark.sql.
> {SaveMode, SparkSession}
>     import org.apache.spark.sql.types._
>      import org.apache.spark.\{SparkConf, SparkContext}
>     val sparkhive = SparkSession.builder().appName("spark read 
> hive").enableHiveSupport().getOrCreate()
>     val df = sparkhive.sql("select * from hivetest.chinese_par")
>      df.show()
>      """)
>  }
> r = requests.post(statements_url, data=json.dumps(data), headers=headers)
>  pprint.pprint(r.json())
> statement_url = host + r.headers['location']
>  r = requests.get(statement_url, headers=headers)
>  pprint.pprint(r.json())
>   
>   
>  I get 
>   
>   '+-----+--+++--------\n'
>  '| id|name|year|city|\n'
>  '+-----+--+++--------\n'
>  '| 4| wk|2019|??|\n'
>  '| 5| wk|2019|??|\n'
>  '| 6| wk|2019|??|\n'
>  '| 7| wk|2019|??|\n'
>  '| |null|null|??|\n'
>  '| |null|null|??|\n'
>  '| |null|null|??|\n'
>  '| 8| wk|2020|??|\n'
>  '| 9| wk|2020|??|\n'
>  '| 10| wk|2020|??|\n'
>  '| 11| wk|2020|??|\n'
>  '| 1| wk|2018|??|\n'
>  '| 2| wk|2018|??|\n'
>  '| 3| wk|2018|??|\n'
>  '| 3| wk|2018|??|\n'
>  '+-----+--+++--------\n'
>   
>  city is chinese, but display as "?"
>   
>  
> in zeppelin is ok
>  
> +----+---++--------+
> |id|name|year|city|
> +----+---++--------+
> |4|wk|2019|重庆|
> |5|wk|2019|重庆|
> |6|wk|2019|重庆|
> |7|wk|2019|重庆| |
> | |null|null|重庆|
> | |null|null|重庆|
> | |null|null|重庆|



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to