|
16 | 16 | #
|
17 | 17 |
|
18 | 18 | import unittest
|
19 |
| -from typing import cast |
20 | 19 |
|
21 | 20 | from pyspark.sql.pandas.functions import arrow_udf, ArrowUDFType
|
22 | 21 | from pyspark.util import PythonEvalType
|
|
30 | 29 | sum,
|
31 | 30 | udf,
|
32 | 31 | )
|
33 |
| -from pyspark.sql.types import ArrayType, YearMonthIntervalType |
34 |
| -from pyspark.errors import AnalysisException, PySparkNotImplementedError, PythonException |
| 32 | +from pyspark.errors import AnalysisException, PythonException |
35 | 33 | from pyspark.testing.sqlutils import (
|
36 | 34 | ReusedSQLTestCase,
|
37 | 35 | have_pyarrow,
|
@@ -186,58 +184,6 @@ def test_basic(self):
|
186 | 184 | ).collect()
|
187 | 185 | self.assertEqual(expected4, result4.collect())
|
188 | 186 |
|
189 |
| - # def test_unsupported_types(self): |
190 |
| - # with self.quiet(): |
191 |
| - # self.check_unsupported_types() |
192 |
| - # |
193 |
| - # def check_unsupported_types(self): |
194 |
| - # with self.assertRaises(PySparkNotImplementedError) as pe: |
195 |
| - # pandas_udf( |
196 |
| - # lambda x: x, |
197 |
| - # ArrayType(ArrayType(YearMonthIntervalType())), |
198 |
| - # ArrowUDFType.GROUPED_AGG, |
199 |
| - # ) |
200 |
| - # |
201 |
| - # self.check_error( |
202 |
| - # exception=pe.exception, |
203 |
| - # errorClass="NOT_IMPLEMENTED", |
204 |
| - # messageParameters={ |
205 |
| - # "feature": "Invalid return type with grouped aggregate Pandas UDFs: " |
206 |
| - # "ArrayType(ArrayType(YearMonthIntervalType(0, 1), True), True)" |
207 |
| - # }, |
208 |
| - # ) |
209 |
| - # |
210 |
| - # with self.assertRaises(PySparkNotImplementedError) as pe: |
211 |
| - # |
212 |
| - # @arrow_udf("mean double, std double", ArrowUDFType.GROUPED_AGG) |
213 |
| - # def mean_and_std_udf(v): |
214 |
| - # return v.mean(), v.std() |
215 |
| - # |
216 |
| - # self.check_error( |
217 |
| - # exception=pe.exception, |
218 |
| - # errorClass="NOT_IMPLEMENTED", |
219 |
| - # messageParameters={ |
220 |
| - # "feature": "Invalid return type with grouped aggregate Pandas UDFs: " |
221 |
| - # "StructType([StructField('mean', DoubleType(), True), " |
222 |
| - # "StructField('std', DoubleType(), True)])" |
223 |
| - # }, |
224 |
| - # ) |
225 |
| - # |
226 |
| - # with self.assertRaises(PySparkNotImplementedError) as pe: |
227 |
| - # |
228 |
| - # @arrow_udf(ArrayType(YearMonthIntervalType()), ArrowUDFType.GROUPED_AGG) |
229 |
| - # def mean_and_std_udf(v): # noqa: F811 |
230 |
| - # return {v.mean(): v.std()} |
231 |
| - # |
232 |
| - # self.check_error( |
233 |
| - # exception=pe.exception, |
234 |
| - # errorClass="NOT_IMPLEMENTED", |
235 |
| - # messageParameters={ |
236 |
| - # "feature": "Invalid return type with grouped aggregate Pandas UDFs: " |
237 |
| - # "ArrayType(YearMonthIntervalType(0, 1), True)" |
238 |
| - # }, |
239 |
| - # ) |
240 |
| - |
241 | 187 | def test_alias(self):
|
242 | 188 | df = self.data
|
243 | 189 | mean_udf = self.arrow_agg_mean_udf
|
|
0 commit comments