amoghrajesh commented on PR #57866:
URL: https://github.com/apache/airflow/pull/57866#issuecomment-3492557354

   Alright, with head at: 
https://github.com/apache/airflow/pull/57866/commits/0587a26c8471ecccb6ce2287e0280aca66cf6353,
 I tried both postgres and mysql, and it works fine for both of them with the 
same testing instructions as in the PR desc with the DAG:
   ```python
   
   from airflow import DAG
   from airflow.operators.python import PythonOperator
   from datetime import datetime
   
   
   def push_nan_to_xcom(**kwargs):
       # This dict contains a NaN, which is not valid JSON
       value = [{"day": "2024-06-07", "ArticleCountMetric": float("nan")}]
       kwargs["ti"].xcom_push(key="bad_json", value=value)
   
   def number_of_people(**kwargs):
       # This dict contains a NaN, which is not valid JSON
       list_of_people_in_space = [
           {"craft": "Tiangong", "name": "Ye GuangfuNaN"},
       ]
       kwargs["ti"].xcom_push(key="people_in_space", 
value=list_of_people_in_space)
   
   def long_url(**kwargs):
       # This dict contains a NaN, which is not valid JSON
   
       value = {"name": "advisors-ndjson-20250107151944.ndjson.gz", 
"mime_type": "application/gzip", "data_type": "advisors-ndjson", "md5": 
"1f7b41a00548bdee85a3cd02c02efbc8", "size": 770854, "created_at": 
"2025-01-07T14:19:45.057179Z", "url": 
"https://storage.googleapis.com/prod-gain-bulk-files/advisors-ndjson-20250107151944.ndjson.gz?Expires=1736309071&GoogleAccessId=prod-gain-sa%40gain-prod-414309.iam.gserviceaccount.com&Signature=bxojFAGIn%2B5R1xlSeV91XFGA1ZBSINaNxKZOVHdaezneaFxvQ9TPiTJ%2BIfdZBJhZg8bEuXGIOg5xJ7U0Gu1%2Fe5R52JhH81SzkvshxUBZGaHrKKAVauXrxjzvgJ39QpUrOiYAs4GSq4MNYu1ZvVfOO8q%2B3sdO3X6z2QXbfbwXXVoMmZP4XNuiQRJWSNbDanlLDNEZqotYA%3D%3D";,
 "schema": "advisors", "s3_path_latest": 
"bulk_files/advisors/historical/dt=2025-01-07/advisors-ndjson-20250107151944.ndjson.gz"}
       kwargs["ti"].xcom_push(key="long_url", value=value)
   
   
   def array_nan(**kwargs):
       # This dict contains a NaN, which is not valid JSON
   
       value = [float("nan")]
       kwargs["ti"].xcom_push(key="array_nan", value=value)
   
   
   with DAG(
       dag_id="xcom_nan_example",
       start_date=datetime(2024, 1, 1),
       schedule_interval=None,
       catchup=False,
   ) as dag:
       t0 = PythonOperator(
           task_id="t1",
           python_callable=push_nan_to_xcom,
           provide_context=True,
       )
       t1 = PythonOperator(
           task_id="t2",
           python_callable=number_of_people,
           provide_context=True,
       )
       t2 = PythonOperator(
           task_id="t3",
           python_callable=long_url,
           provide_context=True,
       )
       t3 = PythonOperator(
           task_id="t4",
           python_callable=array_nan,
           provide_context=True,
       )
   
       [t0, t1, t2, t3]
   
   ```
   
   And for 2.10.0 -> main (3.2.0)
   


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to