potiuk commented on code in PR #27912:
URL: https://github.com/apache/airflow/pull/27912#discussion_r1032360615


##########
airflow/providers/common/sql/operators/sql.py:
##########
@@ -225,54 +225,37 @@ def __init__(
         self.split_statements = split_statements
         self.return_last = return_last
 
-    @overload
-    def _process_output(
-        self, results: Any, description: Sequence[Sequence] | None, 
scalar_results: Literal[True]
-    ) -> Any:
-        pass
-
-    @overload
-    def _process_output(
-        self, results: list[Any], description: Sequence[Sequence] | None, 
scalar_results: Literal[False]
-    ) -> Any:
-        pass
-
-    def _process_output(
-        self, results: Any | list[Any], description: Sequence[Sequence] | 
None, scalar_results: bool
-    ) -> Any:
+    def _process_output(self, results: list[Any], descriptions: 
list[Sequence[Sequence] | None]) -> list[Any]:
         """
-        Can be overridden by the subclass in case some extra processing is 
needed.
+        Processes output before it is returned by the operator.
+
+        It can be overridden by the subclass in case some extra processing is 
needed.
         The "process_output" method can override the returned output - 
augmenting or processing the
         output as needed - the output returned will be returned as execute 
return value and if
         do_xcom_push is set to True, it will be set as XCom returned
 
         :param results: results in the form of list of rows.
-        :param description: as returned by ``cur.description`` in the Python 
DBAPI
-        :param scalar_results: True if result is single scalar value rather 
than list of rows
+        :param descriptions: list of descriptions returned by 
``cur.description`` in the Python DBAPI
         """
         return results
 
     def execute(self, context):
         self.log.info("Executing: %s", self.sql)
         hook = self.get_db_hook()
-        if self.do_xcom_push:

Review Comment:
   No need to separate those two cases. 
   
   Word of explanation. Contrary to the original implementation here 
   We do not care whether "do_xcom_push" is set or not or not.
   
   Whether we have scalar return value in case of hook  does not matter - we 
can safely pass "return_last" to the hook because when do_xcom_push is False, 
the return value is anyhow ignored.  So ¯\_(ツ)_/¯
   



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