fix(awel): Fix awel check for empty DataFrame data bug (#1430)

This commit is contained in:
yyhhyy 2024-04-18 15:15:07 +08:00 committed by GitHub
parent 8625690107
commit 00af9fed35
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 4 additions and 2 deletions

View File

@ -25,7 +25,7 @@ from dbgpt.util.executor_utils import (
) )
from ..dag.base import DAG, DAGContext, DAGNode, DAGVar from ..dag.base import DAG, DAGContext, DAGNode, DAGVar
from ..task.base import EMPTY_DATA, OUT, T, TaskOutput from ..task.base import EMPTY_DATA, OUT, T, TaskOutput, is_empty_data
F = TypeVar("F", bound=FunctionType) F = TypeVar("F", bound=FunctionType)
@ -213,7 +213,7 @@ class BaseOperator(DAGNode, ABC, Generic[OUT], metaclass=BaseOperatorMeta):
Returns: Returns:
OUT: The output of the node after execution. OUT: The output of the node after execution.
""" """
if call_data != EMPTY_DATA: if not is_empty_data(call_data):
call_data = {"data": call_data} call_data = {"data": call_data}
out_ctx = await self._runner.execute_workflow( out_ctx = await self._runner.execute_workflow(
self, call_data, exist_dag_ctx=dag_ctx self, call_data, exist_dag_ctx=dag_ctx

View File

@ -56,6 +56,8 @@ def is_empty_data(data: Any):
"""Check if the data is empty.""" """Check if the data is empty."""
if isinstance(data, _EMPTY_DATA_TYPE): if isinstance(data, _EMPTY_DATA_TYPE):
return data in (EMPTY_DATA, SKIP_DATA) return data in (EMPTY_DATA, SKIP_DATA)
elif hasattr(data, "empty"):
return getattr(data, "empty", False)
return False return False