SameerMesiah97 commented on code in PR #72081:
URL: https://github.com/apache/airflow/pull/72081#discussion_r4019393688


##########
providers/amazon/tests/system/amazon/aws/example_athena_spark.py:
##########
@@ -0,0 +1,127 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+from __future__ import annotations
+
+import os
+import time
+from datetime import datetime
+
+import boto3
+
+from airflow.providers.amazon.aws.operators.athena_spark import 
AthenaSparkOperator
+
+from tests_common.test_utils.version_compat import AIRFLOW_V_3_0_PLUS
+
+if AIRFLOW_V_3_0_PLUS:
+    from airflow.sdk import DAG, chain, task
+else:
+    # Airflow 2 path
+    from airflow.decorators import task  # type: ignore[attr-defined,no-redef]
+    from airflow.models.baseoperator import chain  # type: 
ignore[attr-defined,no-redef]
+    from airflow.models.dag import DAG  # type: 
ignore[attr-defined,no-redef,assignment]
+
+try:
+    from airflow.sdk import TriggerRule
+except ImportError:
+    # Compatibility for Airflow < 3.1
+    from airflow.utils.trigger_rule import TriggerRule  # type: 
ignore[no-redef,attr-defined]
+
+from system.amazon.aws.utils import SystemTestContextBuilder
+
+sys_test_context_task = SystemTestContextBuilder().build()
+
+DAG_ID = "example_athena_spark"
+
+# The Spark workgroup is preconfigured test infrastructure; this DAG creates 
only the session.
+# Test runners can override the default by exporting ATHENA_SPARK_WORK_GROUP.
+ATHENA_SPARK_WORK_GROUP = os.environ.get("ATHENA_SPARK_WORK_GROUP", 
"airflow-athena-spark-test")

Review Comment:
   1) The athena spark work group variable is now being added to the system 
context builder following the patter of the other AWS system tests.
   2) I agree deferrable mode would be appropriate here but I wanted to leave 
that for a follow-up PR as this one is already over 1k lines. 



##########
providers/amazon/src/airflow/providers/amazon/aws/hooks/athena.py:
##########
@@ -344,3 +351,141 @@ def stop_query(self, query_execution_id: str) -> dict:
         """
         self.log.info("Stopping Query with executionId - %s", 
query_execution_id)
         return 
self.get_conn().stop_query_execution(QueryExecutionId=query_execution_id)
+
+    def _get_spark_calculation_status(self, response: dict[str, Any] | None) 
-> dict[str, Any]:
+        calculation_execution = (response or {}).get("CalculationExecution") 
or {}

Review Comment:
   Removed.



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