@@ -99,15 +99,15 @@ def _extract_url_query(t, op):
99
99
ops .JSONGetItem : fixed_arity (sa .func .get , 2 ),
100
100
ops .StructField : fixed_arity (sa .func .get , 2 ),
101
101
ops .StringFind : _string_find ,
102
- ops .MapKeys : fixed_arity (sa .func .object_keys , 1 ),
102
+ ops .MapKeys : unary (sa .func .object_keys ),
103
103
ops .BitwiseLeftShift : fixed_arity (sa .func .bitshiftleft , 2 ),
104
104
ops .BitwiseRightShift : fixed_arity (sa .func .bitshiftright , 2 ),
105
- ops .Ln : fixed_arity (sa .func .ln , 1 ),
106
- ops .Log2 : fixed_arity (lambda arg : sa .func .log (2 , arg ), 1 ),
107
- ops .Log10 : fixed_arity (lambda arg : sa .func .log (10 , arg ), 1 ),
105
+ ops .Ln : unary (sa .func .ln ),
106
+ ops .Log2 : unary (lambda arg : sa .func .log (2 , arg )),
107
+ ops .Log10 : unary (lambda arg : sa .func .log (10 , arg )),
108
108
ops .Log : fixed_arity (lambda arg , base : sa .func .log (base , arg ), 2 ),
109
- ops .IsInf : fixed_arity (lambda arg : arg .in_ ((_SF_POS_INF , _SF_NEG_INF )), 1 ),
110
- ops .IsNan : fixed_arity (lambda arg : arg == _SF_NAN , 1 ),
109
+ ops .IsInf : unary (lambda arg : arg .in_ ((_SF_POS_INF , _SF_NEG_INF ))),
110
+ ops .IsNan : unary (lambda arg : arg == _SF_NAN ),
111
111
ops .Literal : _literal ,
112
112
ops .Round : _round ,
113
113
ops .Modulus : fixed_arity (sa .func .mod , 2 ),
@@ -125,43 +125,38 @@ def _extract_url_query(t, op):
125
125
# time and dates
126
126
ops .TimeFromHMS : fixed_arity (sa .func .time_from_parts , 3 ),
127
127
# columns
128
- ops .DayOfWeekName : fixed_arity (_day_of_week_name , 1 ),
129
- ops .ExtractProtocol : fixed_arity (
128
+ ops .DayOfWeekName : unary (_day_of_week_name ),
129
+ ops .ExtractProtocol : unary (
130
130
lambda arg : sa .func .nullif (
131
131
sa .func .as_varchar (sa .func .get (sa .func .parse_url (arg , 1 ), "scheme" )), ""
132
- ),
133
- 1 ,
132
+ )
134
133
),
135
- ops .ExtractAuthority : fixed_arity (
134
+ ops .ExtractAuthority : unary (
136
135
lambda arg : sa .func .concat_ws (
137
136
":" ,
138
137
sa .func .as_varchar (sa .func .get (sa .func .parse_url (arg , 1 ), "host" )),
139
138
sa .func .as_varchar (sa .func .get (sa .func .parse_url (arg , 1 ), "port" )),
140
- ),
141
- 1 ,
139
+ )
142
140
),
143
- ops .ExtractFile : fixed_arity (
141
+ ops .ExtractFile : unary (
144
142
lambda arg : sa .func .concat_ws (
145
143
"?" ,
146
144
"/"
147
145
+ sa .func .as_varchar (sa .func .get (sa .func .parse_url (arg , 1 ), "path" )),
148
146
sa .func .as_varchar (sa .func .get (sa .func .parse_url (arg , 1 ), "query" )),
149
- ),
150
- 1 ,
147
+ )
151
148
),
152
- ops .ExtractPath : fixed_arity (
149
+ ops .ExtractPath : unary (
153
150
lambda arg : (
154
151
"/" + sa .func .as_varchar (sa .func .get (sa .func .parse_url (arg , 1 ), "path" ))
155
- ),
156
- 1 ,
152
+ )
157
153
),
158
154
ops .ExtractQuery : _extract_url_query ,
159
- ops .ExtractFragment : fixed_arity (
155
+ ops .ExtractFragment : unary (
160
156
lambda arg : sa .func .nullif (
161
157
sa .func .as_varchar (sa .func .get (sa .func .parse_url (arg , 1 ), "fragment" )),
162
158
"" ,
163
- ),
164
- 1 ,
159
+ )
165
160
),
166
161
# snowflake typeof only accepts VARIANT
167
162
ops .TypeOf : unary (lambda arg : sa .func .typeof (sa .cast (arg , VARIANT ))),
0 commit comments