You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2022/02/11 02:51:44 UTC
[GitHub] [airflow] chenglongyan commented on a change in pull request #21460: Add non-ascii character support in xcom table
chenglongyan commented on a change in pull request #21460:
URL: https://github.com/apache/airflow/pull/21460#discussion_r804323515
##########
File path: tests/models/test_xcom.py
##########
@@ -377,6 +377,30 @@ def test_xcom_get_many_from_prior_dates_with_execution_date(
assert [x.execution_date for x in stored_xcoms] == [dr2.logical_date, dr1.logical_date]
+class TestXComSerializeNonAsciiValue:
+ @conf_vars({("core", "enable_xcom_pickling"): "false"})
+ def test_serialize_disable_pickling(self, session, dag_run):
+ val = XCom.serialize_value(['前有大梅林'])
+ assert val == b'["\xe5\x89\x8d\xe6\x9c\x89\xe5\xa4\xa7\xe6\xa2\x85\xe6\x9e\x97"]'
Review comment:
@ashb I think this is correct json encoding, just not escaped to ascii encoding
[https://docs.python.org/3.6/library/json.html#character-encodings](https://docs.python.org/3.6/library/json.html#character-encodings)
except mentioned in #14413, sets ensure_ascii=False can reduce size of xcom.value:
In [2]: len(json.dumps(["中文"]).encode("utf-8"))
Out[2]: 16
In [3]: len(json.dumps(["中文"], ensure_ascii=False).encode("utf-8"))
Out[3]: 10
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org