Skip to content

Commit 307c480

Browse files
committed
fix: recursive import
1 parent 5a7f638 commit 307c480

File tree

1 file changed

+65
-1
lines changed

1 file changed

+65
-1
lines changed

python/datafusion/expr.py

Lines changed: 65 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424

2525
from typing import TYPE_CHECKING, Any, ClassVar, Optional
2626

27-
import functions as F
2827
import pyarrow as pa
2928

3029
try:
@@ -614,50 +613,62 @@ def over(self, window: Window) -> Expr:
614613

615614
def asin(self) -> Expr:
616615
"""Returns the arc sine or inverse sine of a number."""
616+
from . import functions as F
617617
return F.asin(self)
618618

619619
def array_pop_back(self) -> Expr:
620620
"""Returns the array without the last element."""
621+
from . import functions as F
621622
return F.array_pop_back(self)
622623

623624
def reverse(self) -> Expr:
624625
"""Reverse the string argument."""
626+
from . import functions as F
625627
return F.reverse(self)
626628

627629
def bit_length(self) -> Expr:
628630
"""Returns the number of bits in the string argument."""
631+
from . import functions as F
629632
return F.bit_length(self)
630633

631634
def array_length(self) -> Expr:
632635
"""Returns the length of the array."""
636+
from . import functions as F
633637
return F.array_length(self)
634638

635639
def array_ndims(self) -> Expr:
636640
"""Returns the number of dimensions of the array."""
641+
from . import functions as F
637642
return F.array_ndims(self)
638643

639644
def to_hex(self) -> Expr:
640645
"""Converts an integer to a hexadecimal string."""
646+
from . import functions as F
641647
return F.to_hex(self)
642648

643649
def array_dims(self) -> Expr:
644650
"""Returns an array of the array's dimensions."""
651+
from . import functions as F
645652
return F.array_dims(self)
646653

647654
def from_unixtime(self) -> Expr:
648655
"""Converts an integer to RFC3339 timestamp format string."""
656+
from . import functions as F
649657
return F.from_unixtime(self)
650658

651659
def array_empty(self) -> Expr:
652660
"""Returns a boolean indicating whether the array is empty."""
661+
from . import functions as F
653662
return F.array_empty(self)
654663

655664
def sin(self) -> Expr:
656665
"""Returns the sine of the argument."""
666+
from . import functions as F
657667
return F.sin(self)
658668

659669
def log10(self) -> Expr:
660670
"""Base 10 logarithm of the argument."""
671+
from . import functions as F
661672
return F.log10(self)
662673

663674
def initcap(self) -> Expr:
@@ -666,33 +677,40 @@ def initcap(self) -> Expr:
666677
Converts the first letter of each word in ``string`` to uppercase and the remaining
667678
characters to lowercase.
668679
"""
680+
from . import functions as F
669681
return F.initcap(self)
670682

671683
def list_distinct(self) -> Expr:
672684
"""Returns distinct values from the array after removing duplicates.
673685
674686
This is an alias for :py:func:`array_distinct`.
675687
"""
688+
from . import functions as F
676689
return F.list_distinct(self)
677690

678691
def iszero(self) -> Expr:
679692
"""Returns true if a given number is +0.0 or -0.0 otherwise returns false."""
693+
from . import functions as F
680694
return F.iszero(self)
681695

682696
def array_distinct(self) -> Expr:
683697
"""Returns distinct values from the array after removing duplicates."""
698+
from . import functions as F
684699
return F.array_distinct(self)
685700

686701
def arrow_typeof(self) -> Expr:
687702
"""Returns the Arrow type of the expression."""
703+
from . import functions as F
688704
return F.arrow_typeof(self)
689705

690706
def length(self) -> Expr:
691707
"""The number of characters in the ``string``."""
708+
from . import functions as F
692709
return F.length(self)
693710

694711
def lower(self) -> Expr:
695712
"""Converts a string to lowercase."""
713+
from . import functions as F
696714
return F.lower(self)
697715

698716
def acos(self) -> Expr:
@@ -703,42 +721,52 @@ def acos(self) -> Expr:
703721
Expr
704722
A new expression representing the arc cosine of the input expression.
705723
"""
724+
from . import functions as F
706725
return F.acos(self)
707726

708727
def ascii(self) -> Expr:
709728
"""Returns the numeric code of the first character of the argument."""
729+
from . import functions as F
710730
return F.ascii(self)
711731

712732
def sha384(self) -> Expr:
713733
"""Computes the SHA-384 hash of a binary string."""
734+
from . import functions as F
714735
return F.sha384(self)
715736

716737
def isnan(self) -> Expr:
717738
"""Returns true if a given number is +NaN or -NaN otherwise returns false."""
739+
from . import functions as F
718740
return F.isnan(self)
719741

720742
def degrees(self) -> Expr:
721743
"""Converts the argument from radians to degrees."""
744+
from . import functions as F
722745
return F.degrees(self)
723746

724747
def cardinality(self) -> Expr:
725748
"""Returns the total number of elements in the array."""
749+
from . import functions as F
726750
return F.cardinality(self)
727751

728752
def sha224(self) -> Expr:
729753
"""Computes the SHA-224 hash of a binary string."""
754+
from . import functions as F
730755
return F.sha224(self)
731756

732757
def asinh(self) -> Expr:
733758
"""Returns inverse hyperbolic sine."""
759+
from . import functions as F
734760
return F.asinh(self)
735761

736762
def flatten(self) -> Expr:
737763
"""Flattens an array of arrays into a single array."""
764+
from . import functions as F
738765
return F.flatten(self)
739766

740767
def exp(self) -> Expr:
741768
"""Returns the exponential of the argument."""
769+
from . import functions as F
742770
return F.exp(self)
743771

744772
def abs(self) -> Expr:
@@ -749,155 +777,191 @@ def abs(self) -> Expr:
749777
Expr
750778
A new expression representing the absolute value of the input expression.
751779
"""
780+
from . import functions as F
752781
return F.abs(self)
753782

754783
def btrim(self) -> Expr:
755784
"""Removes all characters, spaces by default, from both sides of a string."""
785+
from . import functions as F
756786
return F.btrim(self)
757787

758788
def md5(self) -> Expr:
759789
"""Computes an MD5 128-bit checksum for a string expression."""
790+
from . import functions as F
760791
return F.md5(self)
761792

762793
def octet_length(self) -> Expr:
763794
"""Returns the number of bytes of a string."""
795+
from . import functions as F
764796
return F.octet_length(self)
765797

766798
def cosh(self) -> Expr:
767799
"""Returns the hyperbolic cosine of the argument."""
800+
from . import functions as F
768801
return F.cosh(self)
769802

770803
def radians(self) -> Expr:
771804
"""Converts the argument from degrees to radians."""
805+
from . import functions as F
772806
return F.radians(self)
773807

774808
def sqrt(self) -> Expr:
775809
"""Returns the square root of the argument."""
810+
from . import functions as F
776811
return F.sqrt(self)
777812

778813
def character_length(self) -> Expr:
779814
"""Returns the number of characters in the argument."""
815+
from . import functions as F
780816
return F.character_length(self)
781817

782818
def tanh(self) -> Expr:
783819
"""Returns the hyperbolic tangent of the argument."""
820+
from . import functions as F
784821
return F.tanh(self)
785822

786823
def atan(self) -> Expr:
787824
"""Returns inverse tangent of a number."""
825+
from . import functions as F
788826
return F.atan(self)
789827

790828
def rtrim(self) -> Expr:
791829
"""Removes all characters, spaces by default, from the end of a string."""
830+
from . import functions as F
792831
return F.rtrim(self)
793832

794833
def atanh(self) -> Expr:
795834
"""Returns inverse hyperbolic tangent."""
835+
from . import functions as F
796836
return F.atanh(self)
797837

798838
def list_dims(self) -> Expr:
799839
"""Returns an array of the array's dimensions.
800840
801841
This is an alias for :py:func:`array_dims`.
802842
"""
843+
from . import functions as F
803844
return F.list_dims(self)
804845

805846
def sha256(self) -> Expr:
806847
"""Computes the SHA-256 hash of a binary string."""
848+
from . import functions as F
807849
return F.sha256(self)
808850

809851
def factorial(self) -> Expr:
810852
"""Returns the factorial of the argument."""
853+
from . import functions as F
811854
return F.factorial(self)
812855

813856
def acosh(self) -> Expr:
814857
"""Returns inverse hyperbolic cosine."""
858+
from . import functions as F
815859
return F.acosh(self)
816860

817861
def floor(self) -> Expr:
818862
"""Returns the nearest integer less than or equal to the argument."""
863+
from . import functions as F
819864
return F.floor(self)
820865

821866
def ceil(self) -> Expr:
822867
"""Returns the nearest integer greater than or equal to argument."""
868+
from . import functions as F
823869
return F.ceil(self)
824870

825871
def list_length(self) -> Expr:
826872
"""Returns the length of the array.
827873
828874
This is an alias for :py:func:`array_length`.
829875
"""
876+
from . import functions as F
830877
return F.list_length(self)
831878

832879
def upper(self) -> Expr:
833880
"""Converts a string to uppercase."""
881+
from . import functions as F
834882
return F.upper(self)
835883

836884
def chr(self) -> Expr:
837885
"""Converts the Unicode code point to a UTF8 character."""
886+
from . import functions as F
838887
return F.chr(self)
839888

840889
def ln(self) -> Expr:
841890
"""Returns the natural logarithm (base e) of the argument."""
891+
from . import functions as F
842892
return F.ln(self)
843893

844894
def tan(self) -> Expr:
845895
"""Returns the tangent of the argument."""
896+
from . import functions as F
846897
return F.tan(self)
847898

848899
def array_pop_front(self) -> Expr:
849900
"""Returns the array without the first element."""
901+
from . import functions as F
850902
return F.array_pop_front(self)
851903

852904
def cbrt(self) -> Expr:
853905
"""Returns the cube root of a number."""
906+
from . import functions as F
854907
return F.cbrt(self)
855908

856909
def sha512(self) -> Expr:
857910
"""Computes the SHA-512 hash of a binary string."""
911+
from . import functions as F
858912
return F.sha512(self)
859913

860914
def char_length(self) -> Expr:
861915
"""The number of characters in the ``string``."""
916+
from . import functions as F
862917
return F.char_length(self)
863918

864919
def list_ndims(self) -> Expr:
865920
"""Returns the number of dimensions of the array.
866921
867922
This is an alias for :py:func:`array_ndims`.
868923
"""
924+
from . import functions as F
869925
return F.list_ndims(self)
870926

871927
def trim(self) -> Expr:
872928
"""Removes all characters, spaces by default, from both sides of a string."""
929+
from . import functions as F
873930
return F.trim(self)
874931

875932
def cos(self) -> Expr:
876933
"""Returns the cosine of the argument."""
934+
from . import functions as F
877935
return F.cos(self)
878936

879937
def sinh(self) -> Expr:
880938
"""Returns the hyperbolic sine of the argument."""
939+
from . import functions as F
881940
return F.sinh(self)
882941

883942
def empty(self) -> Expr:
884943
"""This is an alias for :py:func:`array_empty`."""
944+
from . import functions as F
885945
return F.empty(self)
886946

887947
def ltrim(self) -> Expr:
888948
"""Removes all characters, spaces by default, from the beginning of a string."""
949+
from . import functions as F
889950
return F.ltrim(self)
890951

891952
def signum(self) -> Expr:
892953
"""Returns the sign of the argument (-1, 0, +1)."""
954+
from . import functions as F
893955
return F.signum(self)
894956

895957
def log2(self) -> Expr:
896958
"""Base 2 logarithm of the argument."""
959+
from . import functions as F
897960
return F.log2(self)
898961

899962
def cot(self) -> Expr:
900963
"""Returns the cotangent of the argument."""
964+
from . import functions as F
901965
return F.cot(self)
902966

903967

0 commit comments

Comments
 (0)