subhramit commented on code in PR #73522:
URL: https://github.com/apache/airflow/pull/73522#discussion_r4088324495


##########
providers/influxdb/src/airflow/providers/influxdb/utils.py:
##########
@@ -28,3 +28,20 @@
 def _convert_dataframe_to_records(dataframe: pd.DataFrame) -> list[dict[str, 
Any]]:
     """Convert a query result DataFrame into a JSON-serializable list of 
dictionaries."""
     return json.loads(dataframe.to_json(orient="records", date_format="iso"))
+
+
+def _first_cell_is_truthy(dataframe: pd.DataFrame) -> bool:
+    """Return whether the first cell meets the sensor condition."""
+    import pandas as pd
+
+    if dataframe.empty or dataframe.shape[1] == 0:
+        return False
+
+    value = dataframe.iat[0, 0]
+    try:
+        if bool(pd.isna(value)):
+            return False
+    except ValueError as error:
+        raise TypeError("The first query result cell must be a scalar value") 
from error

Review Comment:
   Thank you. Have simplified.



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