|
40 | 40 | if TYPE_CHECKING: |
41 | 41 | from collections.abc import Sequence |
42 | 42 |
|
43 | | - # These are only imported for type checking to avoid runtime |
44 | | - # evaluation issues with typing constructs. |
| 43 | + # Type-only imports |
45 | 44 | from datafusion.common import DataTypeMap, RexType |
46 | | - # Make the datafusion package available to type checkers for |
47 | | - # fully-qualified string-literal annotations. |
48 | | - import datafusion # type: ignore |
49 | 45 | from datafusion.plan import LogicalPlan |
50 | | -# Note: DataTypeMap and RexType are only available for type checking. |
51 | | -# We intentionally avoid importing them at runtime to prevent evaluation |
52 | | -# issues with complex typing constructs. |
53 | 46 |
|
54 | 47 |
|
55 | 48 | # Standard error message for invalid expression types |
@@ -655,23 +648,23 @@ def between(self, low: Any, high: Any, negated: bool = False) -> Expr: |
655 | 648 |
|
656 | 649 | return Expr(self.expr.between(low.expr, high.expr, negated=negated)) |
657 | 650 |
|
658 | | - def rex_type(self) -> "datafusion.common.RexType": |
| 651 | + def rex_type(self) -> "RexType": # type: ignore[call-arg] |
659 | 652 | """Return the Rex Type of this expression. |
660 | 653 |
|
661 | 654 | A Rex (Row Expression) specifies a single row of data.That specification |
662 | 655 | could include user defined functions or types. RexType identifies the |
663 | 656 | row as one of the possible valid ``RexType``. |
664 | 657 | """ |
665 | | - return self.expr.rex_type() |
| 658 | + return self.expr.rex_type() # type: ignore |
666 | 659 |
|
667 | | - def types(self) -> "datafusion.common.DataTypeMap": |
| 660 | + def types(self) -> "DataTypeMap": # type: ignore[call-arg] |
668 | 661 | """Return the ``DataTypeMap``. |
669 | 662 |
|
670 | 663 | Returns: |
671 | 664 | DataTypeMap which represents the PythonType, Arrow DataType, and |
672 | 665 | SqlType Enum which this expression represents. |
673 | 666 | """ |
674 | | - return self.expr.types() |
| 667 | + return self.expr.types() # type: ignore |
675 | 668 |
|
676 | 669 | def python_value(self) -> Any: |
677 | 670 | """Extracts the Expr value into a PyObject. |
|
0 commit comments