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/09/29 15:47:06 UTC

[GitHub] [airflow] harryplumer commented on a diff in pull request #26676: Fix null strings bug in SqlToS3Operator in non parquet formats

harryplumer commented on code in PR #26676:
URL: https://github.com/apache/airflow/pull/26676#discussion_r983718439


##########
tests/providers/amazon/aws/transfers/test_sql_to_s3.py:
##########
@@ -145,16 +145,30 @@ def test_execute_json(self, mock_s3_hook, temp_mock):
                 replace=True,
             )
 
-    def test_fix_dtypes(self):
+    def test_fix_dtypes_csv(self):
         op = SqlToS3Operator(
             query="query",
             s3_bucket="s3_bucket",
             s3_key="s3_key",
             task_id="task_id",
             sql_conn_id="mysql_conn_id",
         )
-        dirty_df = pd.DataFrame({"strings": ["a", "b", "c"], "ints": [1, 2, None]})
-        op._fix_dtypes(df=dirty_df)
+        dirty_df = pd.DataFrame({"strings": ["a", "b", None], "ints": [1, 2, None]})
+        op._fix_dtypes(df=dirty_df, file_format="csv")
+        assert dirty_df["strings"].values[2] is None
+        assert dirty_df["ints"].dtype.kind == "i"
+
+    def test_fix_dtypes_parquet(self):

Review Comment:
   good callout, fixed that up if you want to take another look!



-- 
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