ephraimbuddy commented on code in PR #77494:
URL: https://github.com/apache/airflow/pull/77494#discussion_r4669917320


##########
airflow-core/src/airflow/utils/db.py:
##########
@@ -1926,21 +1914,10 @@ def __str__(self) -> str:
         counter = "item" if (length := len(self)) == 1 else "items"
         return f"LazySelectSequence([{length} {counter}])"
 
-    def __getstate__(self) -> Any:
-        # We don't want to go to the trouble of serializing SQLAlchemy objects.
-        # Converting the statement into a SQL string is the best we can get.
-        # The literal_binds compile argument inlines all the values into the 
SQL
-        # string to simplify cross-process commuinication as much as possible.
-        # Theoratically we can do the same for count(), but I think it should 
be
-        # performant enough to calculate only that eagerly.
-        s1 = str(self._select_asc.compile(self._session.get_bind(), 
compile_kwargs={"literal_binds": True}))
-        s2 = str(self._select_desc.compile(self._session.get_bind(), 
compile_kwargs={"literal_binds": True}))
-        return (s1, s2, len(self))
-
-    def __setstate__(self, state: Any) -> None:
-        s1, s2, self._len = state
-        self._select_asc = self._rebuild_select(text(s1))
-        self._select_desc = self._rebuild_select(text(s2))
+    __hash__ = None  # type: ignore[assignment]  # Disable hashing.
+
+    def __reduce__(self) -> NoReturn:  # Disable pickling.

Review Comment:
   Can we add test for this?  looks like a change in behaviour 



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