You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@livy.apache.org by "ighack (Jira)" <ji...@apache.org> on 2021/05/20 09:31:00 UTC
[jira] [Commented] (LIVY-858) about Chinese display problem?
[ https://issues.apache.org/jira/browse/LIVY-858?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17348179#comment-17348179 ]
ighack commented on LIVY-858:
-----------------------------
data = \{'kind': 'spark','jars':['hdfs://bigdser1:8020/sparklib/tispark-assembly-2.3.14.jar'],'proxyUser':'hive','conf':{'spark.executor.extraJavaOptions':'-Dfile.encoding=UTF-8','spark.driver.extraJavaOptions':'-Dfile.encoding=UTF-8'}}
need conf params
{'conf':\{'spark.executor.extraJavaOptions':'-Dfile.encoding=UTF-8','spark.driver.extraJavaOptions':'-Dfile.encoding=UTF-8'}}
> 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)