@@ -4,7 +4,6 @@ use polars_core::series::IsSorted;
4
4
use polars_ops:: prelude:: ClosedInterval ;
5
5
use polars_plan:: dsl:: function_expr:: rolling:: RollingFunction ;
6
6
use polars_plan:: dsl:: function_expr:: rolling_by:: RollingFunctionBy ;
7
- use polars_plan:: dsl:: function_expr:: trigonometry:: TrigonometricFunction ;
8
7
use polars_plan:: dsl:: { BooleanFunction , StringFunction , TemporalFunction } ;
9
8
use polars_plan:: prelude:: {
10
9
AExpr , FunctionExpr , GroupbyOptions , IRAggExpr , LiteralValue , Operator , PowFunction ,
@@ -773,6 +772,7 @@ pub(crate) fn into_py(py: Python<'_>, expr: &AExpr) -> PyResult<PyObject> {
773
772
ignore_nulls,
774
773
)
775
774
. to_object ( py) ,
775
+ #[ cfg( feature = "regex" ) ]
776
776
StringFunction :: Contains { literal, strict } => {
777
777
( PyStringFunction :: Contains . into_py ( py) , literal, strict) . to_object ( py)
778
778
} ,
@@ -795,6 +795,7 @@ pub(crate) fn into_py(py: Python<'_>, expr: &AExpr) -> PyResult<PyObject> {
795
795
pat,
796
796
)
797
797
. to_object ( py) ,
798
+ #[ cfg( feature = "regex" ) ]
798
799
StringFunction :: Find { literal, strict } => {
799
800
( PyStringFunction :: Find . into_py ( py) , literal, strict) . to_object ( py)
800
801
} ,
@@ -819,6 +820,7 @@ pub(crate) fn into_py(py: Python<'_>, expr: &AExpr) -> PyResult<PyObject> {
819
820
StringFunction :: JsonPathMatch => {
820
821
( PyStringFunction :: JsonPathMatch . into_py ( py) , ) . to_object ( py)
821
822
} ,
823
+ #[ cfg( feature = "regex" ) ]
822
824
StringFunction :: Replace { n, literal } => {
823
825
( PyStringFunction :: Replace . into_py ( py) , n, literal) . to_object ( py)
824
826
} ,
@@ -837,12 +839,14 @@ pub(crate) fn into_py(py: Python<'_>, expr: &AExpr) -> PyResult<PyObject> {
837
839
StringFunction :: HexEncode => {
838
840
( PyStringFunction :: HexEncode . into_py ( py) , ) . to_object ( py)
839
841
} ,
842
+ #[ cfg( feature = "binary_encoding" ) ]
840
843
StringFunction :: HexDecode ( strict) => {
841
844
( PyStringFunction :: HexDecode . into_py ( py) , strict) . to_object ( py)
842
845
} ,
843
846
StringFunction :: Base64Encode => {
844
847
( PyStringFunction :: Base64Encode . into_py ( py) , ) . to_object ( py)
845
848
} ,
849
+ #[ cfg( feature = "binary_encoding" ) ]
846
850
StringFunction :: Base64Decode ( strict) => {
847
851
( PyStringFunction :: Base64Decode . into_py ( py) , strict) . to_object ( py)
848
852
} ,
@@ -887,6 +891,7 @@ pub(crate) fn into_py(py: Python<'_>, expr: &AExpr) -> PyResult<PyObject> {
887
891
StringFunction :: ToDecimal ( inference_length) => {
888
892
( PyStringFunction :: ToDecimal . into_py ( py) , inference_length) . to_object ( py)
889
893
} ,
894
+ #[ cfg( feature = "nightly" ) ]
890
895
StringFunction :: Titlecase => {
891
896
( PyStringFunction :: Titlecase . into_py ( py) , ) . to_object ( py)
892
897
} ,
@@ -968,6 +973,7 @@ pub(crate) fn into_py(py: Python<'_>, expr: &AExpr) -> PyResult<PyObject> {
968
973
TemporalFunction :: WithTimeUnit ( time_unit) => {
969
974
( PyTemporalFunction :: WithTimeUnit , Wrap ( * time_unit) ) . into_py ( py)
970
975
} ,
976
+ #[ cfg( feature = "timezones" ) ]
971
977
TemporalFunction :: ConvertTimeZone ( time_zone) => {
972
978
( PyTemporalFunction :: ConvertTimeZone , time_zone) . into_py ( py)
973
979
} ,
@@ -978,11 +984,14 @@ pub(crate) fn into_py(py: Python<'_>, expr: &AExpr) -> PyResult<PyObject> {
978
984
TemporalFunction :: OffsetBy => ( PyTemporalFunction :: OffsetBy , ) . into_py ( py) ,
979
985
TemporalFunction :: MonthStart => ( PyTemporalFunction :: MonthStart , ) . into_py ( py) ,
980
986
TemporalFunction :: MonthEnd => ( PyTemporalFunction :: MonthEnd , ) . into_py ( py) ,
987
+ #[ cfg( feature = "timezones" ) ]
981
988
TemporalFunction :: BaseUtcOffset => {
982
989
( PyTemporalFunction :: BaseUtcOffset , ) . into_py ( py)
983
990
} ,
991
+ #[ cfg( feature = "timezones" ) ]
984
992
TemporalFunction :: DSTOffset => ( PyTemporalFunction :: DSTOffset , ) . into_py ( py) ,
985
993
TemporalFunction :: Round => ( PyTemporalFunction :: Round , ) . into_py ( py) ,
994
+ #[ cfg( feature = "timezones" ) ]
986
995
TemporalFunction :: ReplaceTimeZone ( time_zone, non_existent) => (
987
996
PyTemporalFunction :: ReplaceTimeZone ,
988
997
time_zone
@@ -1033,6 +1042,7 @@ pub(crate) fn into_py(py: Python<'_>, expr: &AExpr) -> PyResult<PyObject> {
1033
1042
BooleanFunction :: IsBetween { closed } => {
1034
1043
( PyBooleanFunction :: IsBetween , Wrap ( * closed) ) . into_py ( py)
1035
1044
} ,
1045
+ #[ cfg( feature = "is_in" ) ]
1036
1046
BooleanFunction :: IsIn => ( PyBooleanFunction :: IsIn , ) . into_py ( py) ,
1037
1047
BooleanFunction :: AllHorizontal => {
1038
1048
( PyBooleanFunction :: AllHorizontal , ) . into_py ( py)
@@ -1060,25 +1070,32 @@ pub(crate) fn into_py(py: Python<'_>, expr: &AExpr) -> PyResult<PyObject> {
1060
1070
return Err ( PyNotImplementedError :: new_err ( "search sorted" ) )
1061
1071
} ,
1062
1072
FunctionExpr :: Range ( _) => return Err ( PyNotImplementedError :: new_err ( "range" ) ) ,
1063
- FunctionExpr :: Trigonometry ( trigfun) => match trigfun {
1064
- TrigonometricFunction :: Cos => ( "cos" , ) ,
1065
- TrigonometricFunction :: Cot => ( "cot" , ) ,
1066
- TrigonometricFunction :: Sin => ( "sin" , ) ,
1067
- TrigonometricFunction :: Tan => ( "tan" , ) ,
1068
- TrigonometricFunction :: ArcCos => ( "arccos" , ) ,
1069
- TrigonometricFunction :: ArcSin => ( "arcsin" , ) ,
1070
- TrigonometricFunction :: ArcTan => ( "arctan" , ) ,
1071
- TrigonometricFunction :: Cosh => ( "cosh" , ) ,
1072
- TrigonometricFunction :: Sinh => ( "sinh" , ) ,
1073
- TrigonometricFunction :: Tanh => ( "tanh" , ) ,
1074
- TrigonometricFunction :: ArcCosh => ( "arccosh" , ) ,
1075
- TrigonometricFunction :: ArcSinh => ( "arcsinh" , ) ,
1076
- TrigonometricFunction :: ArcTanh => ( "arctanh" , ) ,
1077
- TrigonometricFunction :: Degrees => ( "degrees" , ) ,
1078
- TrigonometricFunction :: Radians => ( "radians" , ) ,
1079
- }
1080
- . to_object ( py) ,
1073
+ #[ cfg( feature = "trigonometry" ) ]
1074
+ FunctionExpr :: Trigonometry ( trigfun) => {
1075
+ use polars_plan:: dsl:: function_expr:: trigonometry:: TrigonometricFunction ;
1076
+
1077
+ match trigfun {
1078
+ TrigonometricFunction :: Cos => ( "cos" , ) ,
1079
+ TrigonometricFunction :: Cot => ( "cot" , ) ,
1080
+ TrigonometricFunction :: Sin => ( "sin" , ) ,
1081
+ TrigonometricFunction :: Tan => ( "tan" , ) ,
1082
+ TrigonometricFunction :: ArcCos => ( "arccos" , ) ,
1083
+ TrigonometricFunction :: ArcSin => ( "arcsin" , ) ,
1084
+ TrigonometricFunction :: ArcTan => ( "arctan" , ) ,
1085
+ TrigonometricFunction :: Cosh => ( "cosh" , ) ,
1086
+ TrigonometricFunction :: Sinh => ( "sinh" , ) ,
1087
+ TrigonometricFunction :: Tanh => ( "tanh" , ) ,
1088
+ TrigonometricFunction :: ArcCosh => ( "arccosh" , ) ,
1089
+ TrigonometricFunction :: ArcSinh => ( "arcsinh" , ) ,
1090
+ TrigonometricFunction :: ArcTanh => ( "arctanh" , ) ,
1091
+ TrigonometricFunction :: Degrees => ( "degrees" , ) ,
1092
+ TrigonometricFunction :: Radians => ( "radians" , ) ,
1093
+ }
1094
+ . to_object ( py)
1095
+ } ,
1096
+ #[ cfg( feature = "trigonometry" ) ]
1081
1097
FunctionExpr :: Atan2 => ( "atan2" , ) . to_object ( py) ,
1098
+ #[ cfg( feature = "sign" ) ]
1082
1099
FunctionExpr :: Sign => ( "sign" , ) . to_object ( py) ,
1083
1100
FunctionExpr :: FillNull => ( "fill_null" , ) . to_object ( py) ,
1084
1101
FunctionExpr :: RollingExpr ( rolling) => match rolling {
0 commit comments