snowpark-connect 0.24.0__py3-none-any.whl → 0.26.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of snowpark-connect might be problematic. Click here for more details.
- snowflake/snowpark_connect/column_name_handler.py +116 -4
- snowflake/snowpark_connect/config.py +23 -0
- snowflake/snowpark_connect/constants.py +0 -29
- snowflake/snowpark_connect/dataframe_container.py +22 -0
- snowflake/snowpark_connect/execute_plan/map_execution_command.py +56 -1
- snowflake/snowpark_connect/expression/literal.py +13 -2
- snowflake/snowpark_connect/expression/map_cast.py +5 -8
- snowflake/snowpark_connect/expression/map_sql_expression.py +23 -1
- snowflake/snowpark_connect/expression/map_udf.py +88 -29
- snowflake/snowpark_connect/expression/map_unresolved_attribute.py +199 -15
- snowflake/snowpark_connect/expression/map_unresolved_extract_value.py +44 -16
- snowflake/snowpark_connect/expression/map_unresolved_function.py +840 -367
- snowflake/snowpark_connect/expression/map_unresolved_star.py +3 -2
- snowflake/snowpark_connect/hidden_column.py +39 -0
- snowflake/snowpark_connect/includes/jars/hadoop-client-api-trimmed-3.3.4.jar +0 -0
- snowflake/snowpark_connect/includes/jars/json4s-native_2.12-3.7.0-M11.jar +0 -0
- snowflake/snowpark_connect/includes/jars/paranamer-2.8.3.jar +0 -0
- snowflake/snowpark_connect/includes/jars/sas-scala-udf_2.12-0.1.0.jar +0 -0
- snowflake/snowpark_connect/includes/jars/{hadoop-client-api-3.3.4.jar → spark-connect-client-jvm_2.12-3.5.6.jar} +0 -0
- snowflake/snowpark_connect/relation/map_column_ops.py +17 -4
- snowflake/snowpark_connect/relation/map_extension.py +52 -11
- snowflake/snowpark_connect/relation/map_join.py +258 -62
- snowflake/snowpark_connect/relation/map_map_partitions.py +9 -4
- snowflake/snowpark_connect/relation/map_relation.py +12 -1
- snowflake/snowpark_connect/relation/map_row_ops.py +8 -1
- snowflake/snowpark_connect/relation/map_sql.py +88 -11
- snowflake/snowpark_connect/relation/map_udtf.py +100 -46
- snowflake/snowpark_connect/relation/read/map_read.py +3 -3
- snowflake/snowpark_connect/relation/read/map_read_jdbc.py +1 -1
- snowflake/snowpark_connect/relation/read/map_read_json.py +8 -1
- snowflake/snowpark_connect/relation/read/map_read_table.py +1 -9
- snowflake/snowpark_connect/relation/read/reader_config.py +3 -1
- snowflake/snowpark_connect/relation/utils.py +44 -0
- snowflake/snowpark_connect/relation/write/map_write.py +175 -75
- snowflake/snowpark_connect/resources_initializer.py +47 -6
- snowflake/snowpark_connect/server.py +26 -4
- snowflake/snowpark_connect/type_mapping.py +29 -25
- snowflake/snowpark_connect/typed_column.py +14 -0
- snowflake/snowpark_connect/utils/artifacts.py +23 -0
- snowflake/snowpark_connect/utils/concurrent.py +4 -0
- snowflake/snowpark_connect/utils/context.py +6 -1
- snowflake/snowpark_connect/utils/external_udxf_cache.py +36 -0
- snowflake/snowpark_connect/utils/scala_udf_utils.py +596 -0
- snowflake/snowpark_connect/utils/session.py +4 -0
- snowflake/snowpark_connect/utils/telemetry.py +6 -17
- snowflake/snowpark_connect/utils/udf_helper.py +2 -0
- snowflake/snowpark_connect/utils/udf_utils.py +22 -1
- snowflake/snowpark_connect/utils/udtf_utils.py +1 -0
- snowflake/snowpark_connect/version.py +1 -1
- {snowpark_connect-0.24.0.dist-info → snowpark_connect-0.26.0.dist-info}/METADATA +1 -1
- snowpark_connect-0.26.0.dist-info/RECORD +481 -0
- snowflake/snowpark_connect/includes/jars/scala-compiler-2.12.18.jar +0 -0
- snowflake/snowpark_connect/includes/jars/spark-kubernetes_2.12-3.5.6.jar +0 -0
- snowflake/snowpark_connect/includes/jars/spark-mllib_2.12-3.5.6.jar +0 -0
- snowflake/snowpark_connect/includes/jars/spark-streaming_2.12-3.5.6.jar +0 -0
- snowflake/snowpark_connect/includes/python/pyspark/errors/tests/__init__.py +0 -16
- snowflake/snowpark_connect/includes/python/pyspark/errors/tests/test_errors.py +0 -60
- snowflake/snowpark_connect/includes/python/pyspark/ml/deepspeed/tests/test_deepspeed_distributor.py +0 -306
- snowflake/snowpark_connect/includes/python/pyspark/ml/tests/__init__.py +0 -16
- snowflake/snowpark_connect/includes/python/pyspark/ml/tests/connect/test_connect_classification.py +0 -53
- snowflake/snowpark_connect/includes/python/pyspark/ml/tests/connect/test_connect_evaluation.py +0 -50
- snowflake/snowpark_connect/includes/python/pyspark/ml/tests/connect/test_connect_feature.py +0 -43
- snowflake/snowpark_connect/includes/python/pyspark/ml/tests/connect/test_connect_function.py +0 -114
- snowflake/snowpark_connect/includes/python/pyspark/ml/tests/connect/test_connect_pipeline.py +0 -47
- snowflake/snowpark_connect/includes/python/pyspark/ml/tests/connect/test_connect_summarizer.py +0 -43
- snowflake/snowpark_connect/includes/python/pyspark/ml/tests/connect/test_connect_tuning.py +0 -46
- snowflake/snowpark_connect/includes/python/pyspark/ml/tests/connect/test_legacy_mode_classification.py +0 -238
- snowflake/snowpark_connect/includes/python/pyspark/ml/tests/connect/test_legacy_mode_evaluation.py +0 -194
- snowflake/snowpark_connect/includes/python/pyspark/ml/tests/connect/test_legacy_mode_feature.py +0 -156
- snowflake/snowpark_connect/includes/python/pyspark/ml/tests/connect/test_legacy_mode_pipeline.py +0 -184
- snowflake/snowpark_connect/includes/python/pyspark/ml/tests/connect/test_legacy_mode_summarizer.py +0 -78
- snowflake/snowpark_connect/includes/python/pyspark/ml/tests/connect/test_legacy_mode_tuning.py +0 -292
- snowflake/snowpark_connect/includes/python/pyspark/ml/tests/connect/test_parity_torch_data_loader.py +0 -50
- snowflake/snowpark_connect/includes/python/pyspark/ml/tests/connect/test_parity_torch_distributor.py +0 -152
- snowflake/snowpark_connect/includes/python/pyspark/ml/tests/test_algorithms.py +0 -456
- snowflake/snowpark_connect/includes/python/pyspark/ml/tests/test_base.py +0 -96
- snowflake/snowpark_connect/includes/python/pyspark/ml/tests/test_dl_util.py +0 -186
- snowflake/snowpark_connect/includes/python/pyspark/ml/tests/test_evaluation.py +0 -77
- snowflake/snowpark_connect/includes/python/pyspark/ml/tests/test_feature.py +0 -401
- snowflake/snowpark_connect/includes/python/pyspark/ml/tests/test_functions.py +0 -528
- snowflake/snowpark_connect/includes/python/pyspark/ml/tests/test_image.py +0 -82
- snowflake/snowpark_connect/includes/python/pyspark/ml/tests/test_linalg.py +0 -409
- snowflake/snowpark_connect/includes/python/pyspark/ml/tests/test_model_cache.py +0 -55
- snowflake/snowpark_connect/includes/python/pyspark/ml/tests/test_param.py +0 -441
- snowflake/snowpark_connect/includes/python/pyspark/ml/tests/test_persistence.py +0 -546
- snowflake/snowpark_connect/includes/python/pyspark/ml/tests/test_pipeline.py +0 -71
- snowflake/snowpark_connect/includes/python/pyspark/ml/tests/test_stat.py +0 -52
- snowflake/snowpark_connect/includes/python/pyspark/ml/tests/test_training_summary.py +0 -494
- snowflake/snowpark_connect/includes/python/pyspark/ml/tests/test_util.py +0 -85
- snowflake/snowpark_connect/includes/python/pyspark/ml/tests/test_wrapper.py +0 -138
- snowflake/snowpark_connect/includes/python/pyspark/ml/tests/tuning/__init__.py +0 -16
- snowflake/snowpark_connect/includes/python/pyspark/ml/tests/tuning/test_cv_io_basic.py +0 -151
- snowflake/snowpark_connect/includes/python/pyspark/ml/tests/tuning/test_cv_io_nested.py +0 -97
- snowflake/snowpark_connect/includes/python/pyspark/ml/tests/tuning/test_cv_io_pipeline.py +0 -143
- snowflake/snowpark_connect/includes/python/pyspark/ml/tests/tuning/test_tuning.py +0 -551
- snowflake/snowpark_connect/includes/python/pyspark/ml/tests/tuning/test_tvs_io_basic.py +0 -137
- snowflake/snowpark_connect/includes/python/pyspark/ml/tests/tuning/test_tvs_io_nested.py +0 -96
- snowflake/snowpark_connect/includes/python/pyspark/ml/tests/tuning/test_tvs_io_pipeline.py +0 -142
- snowflake/snowpark_connect/includes/python/pyspark/ml/torch/tests/__init__.py +0 -16
- snowflake/snowpark_connect/includes/python/pyspark/ml/torch/tests/test_data_loader.py +0 -137
- snowflake/snowpark_connect/includes/python/pyspark/ml/torch/tests/test_distributor.py +0 -561
- snowflake/snowpark_connect/includes/python/pyspark/ml/torch/tests/test_log_communication.py +0 -172
- snowflake/snowpark_connect/includes/python/pyspark/mllib/tests/__init__.py +0 -16
- snowflake/snowpark_connect/includes/python/pyspark/mllib/tests/test_algorithms.py +0 -353
- snowflake/snowpark_connect/includes/python/pyspark/mllib/tests/test_feature.py +0 -192
- snowflake/snowpark_connect/includes/python/pyspark/mllib/tests/test_linalg.py +0 -680
- snowflake/snowpark_connect/includes/python/pyspark/mllib/tests/test_stat.py +0 -206
- snowflake/snowpark_connect/includes/python/pyspark/mllib/tests/test_streaming_algorithms.py +0 -471
- snowflake/snowpark_connect/includes/python/pyspark/mllib/tests/test_util.py +0 -108
- snowflake/snowpark_connect/includes/python/pyspark/pandas/spark/__init__.py +0 -16
- snowflake/snowpark_connect/includes/python/pyspark/pandas/spark/accessors.py +0 -1281
- snowflake/snowpark_connect/includes/python/pyspark/pandas/spark/functions.py +0 -203
- snowflake/snowpark_connect/includes/python/pyspark/pandas/spark/utils.py +0 -202
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/__init__.py +0 -16
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/computation/__init__.py +0 -16
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/computation/test_any_all.py +0 -177
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/computation/test_apply_func.py +0 -575
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/computation/test_binary_ops.py +0 -235
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/computation/test_combine.py +0 -653
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/computation/test_compute.py +0 -463
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/computation/test_corrwith.py +0 -86
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/computation/test_cov.py +0 -151
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/computation/test_cumulative.py +0 -139
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/computation/test_describe.py +0 -458
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/computation/test_eval.py +0 -86
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/computation/test_melt.py +0 -202
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/computation/test_missing_data.py +0 -520
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/computation/test_pivot.py +0 -361
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/__init__.py +0 -16
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/computation/__init__.py +0 -16
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/computation/test_parity_any_all.py +0 -40
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/computation/test_parity_apply_func.py +0 -42
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/computation/test_parity_binary_ops.py +0 -40
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/computation/test_parity_combine.py +0 -37
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/computation/test_parity_compute.py +0 -60
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/computation/test_parity_corrwith.py +0 -40
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/computation/test_parity_cov.py +0 -40
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/computation/test_parity_cumulative.py +0 -90
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/computation/test_parity_describe.py +0 -40
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/computation/test_parity_eval.py +0 -40
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/computation/test_parity_melt.py +0 -40
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/computation/test_parity_missing_data.py +0 -42
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/computation/test_parity_pivot.py +0 -37
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/data_type_ops/__init__.py +0 -16
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/data_type_ops/test_parity_base.py +0 -36
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/data_type_ops/test_parity_binary_ops.py +0 -42
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/data_type_ops/test_parity_boolean_ops.py +0 -47
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/data_type_ops/test_parity_categorical_ops.py +0 -55
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/data_type_ops/test_parity_complex_ops.py +0 -40
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/data_type_ops/test_parity_date_ops.py +0 -47
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/data_type_ops/test_parity_datetime_ops.py +0 -47
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/data_type_ops/test_parity_null_ops.py +0 -42
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/data_type_ops/test_parity_num_arithmetic.py +0 -43
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/data_type_ops/test_parity_num_ops.py +0 -47
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/data_type_ops/test_parity_num_reverse.py +0 -43
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/data_type_ops/test_parity_string_ops.py +0 -47
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/data_type_ops/test_parity_timedelta_ops.py +0 -47
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/data_type_ops/test_parity_udt_ops.py +0 -40
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/data_type_ops/testing_utils.py +0 -226
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/diff_frames_ops/__init__.py +0 -16
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/diff_frames_ops/test_parity_align.py +0 -39
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/diff_frames_ops/test_parity_basic_slow.py +0 -55
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/diff_frames_ops/test_parity_cov_corrwith.py +0 -39
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/diff_frames_ops/test_parity_dot_frame.py +0 -39
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/diff_frames_ops/test_parity_dot_series.py +0 -39
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/diff_frames_ops/test_parity_index.py +0 -39
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/diff_frames_ops/test_parity_series.py +0 -39
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/diff_frames_ops/test_parity_setitem_frame.py +0 -43
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/diff_frames_ops/test_parity_setitem_series.py +0 -43
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/frame/__init__.py +0 -16
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/frame/test_parity_attrs.py +0 -40
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/frame/test_parity_constructor.py +0 -39
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/frame/test_parity_conversion.py +0 -42
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/frame/test_parity_reindexing.py +0 -42
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/frame/test_parity_reshaping.py +0 -37
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/frame/test_parity_spark.py +0 -40
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/frame/test_parity_take.py +0 -42
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/frame/test_parity_time_series.py +0 -48
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/frame/test_parity_truncate.py +0 -40
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/groupby/__init__.py +0 -16
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/groupby/test_parity_aggregate.py +0 -40
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/groupby/test_parity_apply_func.py +0 -41
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/groupby/test_parity_cumulative.py +0 -67
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/groupby/test_parity_describe.py +0 -40
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/groupby/test_parity_groupby.py +0 -55
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/groupby/test_parity_head_tail.py +0 -40
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/groupby/test_parity_index.py +0 -38
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/groupby/test_parity_missing_data.py +0 -55
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/groupby/test_parity_split_apply.py +0 -39
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/groupby/test_parity_stat.py +0 -38
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/indexes/__init__.py +0 -16
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/indexes/test_parity_align.py +0 -40
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/indexes/test_parity_base.py +0 -50
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/indexes/test_parity_category.py +0 -73
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/indexes/test_parity_datetime.py +0 -39
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/indexes/test_parity_indexing.py +0 -40
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/indexes/test_parity_reindex.py +0 -40
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/indexes/test_parity_rename.py +0 -40
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/indexes/test_parity_reset_index.py +0 -48
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/indexes/test_parity_timedelta.py +0 -39
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/io/__init__.py +0 -16
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/io/test_parity_io.py +0 -40
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/plot/__init__.py +0 -16
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/plot/test_parity_frame_plot.py +0 -45
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/plot/test_parity_frame_plot_matplotlib.py +0 -45
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/plot/test_parity_frame_plot_plotly.py +0 -49
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/plot/test_parity_series_plot.py +0 -37
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/plot/test_parity_series_plot_matplotlib.py +0 -53
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/plot/test_parity_series_plot_plotly.py +0 -45
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/series/__init__.py +0 -16
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/series/test_parity_all_any.py +0 -38
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/series/test_parity_arg_ops.py +0 -37
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/series/test_parity_as_of.py +0 -37
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/series/test_parity_as_type.py +0 -38
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/series/test_parity_compute.py +0 -37
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/series/test_parity_conversion.py +0 -40
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/series/test_parity_cumulative.py +0 -40
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/series/test_parity_index.py +0 -38
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/series/test_parity_missing_data.py +0 -40
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/series/test_parity_series.py +0 -37
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/series/test_parity_sort.py +0 -38
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/series/test_parity_stat.py +0 -38
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/test_parity_categorical.py +0 -66
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/test_parity_config.py +0 -37
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/test_parity_csv.py +0 -37
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/test_parity_dataframe_conversion.py +0 -42
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/test_parity_dataframe_spark_io.py +0 -39
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/test_parity_default_index.py +0 -49
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/test_parity_ewm.py +0 -37
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/test_parity_expanding.py +0 -39
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/test_parity_extension.py +0 -49
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/test_parity_frame_spark.py +0 -53
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/test_parity_generic_functions.py +0 -43
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/test_parity_indexing.py +0 -49
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/test_parity_indexops_spark.py +0 -39
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/test_parity_internal.py +0 -41
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/test_parity_namespace.py +0 -39
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/test_parity_numpy_compat.py +0 -60
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/test_parity_ops_on_diff_frames.py +0 -48
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/test_parity_ops_on_diff_frames_groupby.py +0 -39
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/test_parity_ops_on_diff_frames_groupby_expanding.py +0 -44
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/test_parity_ops_on_diff_frames_groupby_rolling.py +0 -84
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/test_parity_repr.py +0 -37
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/test_parity_resample.py +0 -45
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/test_parity_reshape.py +0 -39
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/test_parity_rolling.py +0 -39
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/test_parity_scalars.py +0 -37
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/test_parity_series_conversion.py +0 -39
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/test_parity_series_datetime.py +0 -39
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/test_parity_series_string.py +0 -39
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/test_parity_spark_functions.py +0 -39
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/test_parity_sql.py +0 -43
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/test_parity_stats.py +0 -37
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/test_parity_typedef.py +0 -36
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/test_parity_utils.py +0 -37
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/test_parity_window.py +0 -39
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/data_type_ops/__init__.py +0 -16
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/data_type_ops/test_base.py +0 -107
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/data_type_ops/test_binary_ops.py +0 -224
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/data_type_ops/test_boolean_ops.py +0 -825
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/data_type_ops/test_categorical_ops.py +0 -562
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/data_type_ops/test_complex_ops.py +0 -368
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/data_type_ops/test_date_ops.py +0 -257
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/data_type_ops/test_datetime_ops.py +0 -260
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/data_type_ops/test_null_ops.py +0 -178
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/data_type_ops/test_num_arithmetic.py +0 -184
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/data_type_ops/test_num_ops.py +0 -497
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/data_type_ops/test_num_reverse.py +0 -140
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/data_type_ops/test_string_ops.py +0 -354
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/data_type_ops/test_timedelta_ops.py +0 -219
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/data_type_ops/test_udt_ops.py +0 -192
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/data_type_ops/testing_utils.py +0 -228
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/diff_frames_ops/__init__.py +0 -16
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/diff_frames_ops/test_align.py +0 -118
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/diff_frames_ops/test_basic_slow.py +0 -198
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/diff_frames_ops/test_cov_corrwith.py +0 -181
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/diff_frames_ops/test_dot_frame.py +0 -103
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/diff_frames_ops/test_dot_series.py +0 -141
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/diff_frames_ops/test_index.py +0 -109
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/diff_frames_ops/test_series.py +0 -136
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/diff_frames_ops/test_setitem_frame.py +0 -125
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/diff_frames_ops/test_setitem_series.py +0 -217
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/frame/__init__.py +0 -16
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/frame/test_attrs.py +0 -384
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/frame/test_constructor.py +0 -598
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/frame/test_conversion.py +0 -73
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/frame/test_reindexing.py +0 -869
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/frame/test_reshaping.py +0 -487
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/frame/test_spark.py +0 -309
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/frame/test_take.py +0 -156
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/frame/test_time_series.py +0 -149
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/frame/test_truncate.py +0 -163
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/groupby/__init__.py +0 -16
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/groupby/test_aggregate.py +0 -311
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/groupby/test_apply_func.py +0 -524
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/groupby/test_cumulative.py +0 -419
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/groupby/test_describe.py +0 -144
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/groupby/test_groupby.py +0 -979
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/groupby/test_head_tail.py +0 -234
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/groupby/test_index.py +0 -206
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/groupby/test_missing_data.py +0 -421
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/groupby/test_split_apply.py +0 -187
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/groupby/test_stat.py +0 -397
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/indexes/__init__.py +0 -16
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/indexes/test_align.py +0 -100
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/indexes/test_base.py +0 -2743
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/indexes/test_category.py +0 -484
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/indexes/test_datetime.py +0 -276
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/indexes/test_indexing.py +0 -432
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/indexes/test_reindex.py +0 -310
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/indexes/test_rename.py +0 -257
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/indexes/test_reset_index.py +0 -160
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/indexes/test_timedelta.py +0 -128
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/io/__init__.py +0 -16
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/io/test_io.py +0 -137
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/plot/__init__.py +0 -16
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/plot/test_frame_plot.py +0 -170
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/plot/test_frame_plot_matplotlib.py +0 -547
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/plot/test_frame_plot_plotly.py +0 -285
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/plot/test_series_plot.py +0 -106
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/plot/test_series_plot_matplotlib.py +0 -409
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/plot/test_series_plot_plotly.py +0 -247
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/series/__init__.py +0 -16
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/series/test_all_any.py +0 -105
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/series/test_arg_ops.py +0 -197
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/series/test_as_of.py +0 -137
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/series/test_as_type.py +0 -227
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/series/test_compute.py +0 -634
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/series/test_conversion.py +0 -88
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/series/test_cumulative.py +0 -139
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/series/test_index.py +0 -475
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/series/test_missing_data.py +0 -265
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/series/test_series.py +0 -818
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/series/test_sort.py +0 -162
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/series/test_stat.py +0 -780
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/test_categorical.py +0 -741
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/test_config.py +0 -160
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/test_csv.py +0 -453
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/test_dataframe_conversion.py +0 -281
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/test_dataframe_spark_io.py +0 -487
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/test_default_index.py +0 -109
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/test_ewm.py +0 -434
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/test_expanding.py +0 -253
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/test_extension.py +0 -152
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/test_frame_spark.py +0 -162
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/test_generic_functions.py +0 -234
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/test_indexing.py +0 -1339
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/test_indexops_spark.py +0 -82
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/test_internal.py +0 -124
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/test_namespace.py +0 -638
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/test_numpy_compat.py +0 -200
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/test_ops_on_diff_frames.py +0 -1355
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/test_ops_on_diff_frames_groupby.py +0 -655
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/test_ops_on_diff_frames_groupby_expanding.py +0 -113
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/test_ops_on_diff_frames_groupby_rolling.py +0 -118
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/test_repr.py +0 -192
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/test_resample.py +0 -346
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/test_reshape.py +0 -495
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/test_rolling.py +0 -263
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/test_scalars.py +0 -59
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/test_series_conversion.py +0 -85
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/test_series_datetime.py +0 -364
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/test_series_string.py +0 -362
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/test_spark_functions.py +0 -46
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/test_sql.py +0 -123
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/test_stats.py +0 -581
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/test_typedef.py +0 -447
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/test_utils.py +0 -301
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/test_window.py +0 -465
- snowflake/snowpark_connect/includes/python/pyspark/resource/tests/__init__.py +0 -16
- snowflake/snowpark_connect/includes/python/pyspark/resource/tests/test_resources.py +0 -83
- snowflake/snowpark_connect/includes/python/pyspark/sql/tests/__init__.py +0 -16
- snowflake/snowpark_connect/includes/python/pyspark/sql/tests/connect/__init__.py +0 -16
- snowflake/snowpark_connect/includes/python/pyspark/sql/tests/connect/client/__init__.py +0 -16
- snowflake/snowpark_connect/includes/python/pyspark/sql/tests/connect/client/test_artifact.py +0 -420
- snowflake/snowpark_connect/includes/python/pyspark/sql/tests/connect/client/test_client.py +0 -358
- snowflake/snowpark_connect/includes/python/pyspark/sql/tests/connect/streaming/__init__.py +0 -16
- snowflake/snowpark_connect/includes/python/pyspark/sql/tests/connect/streaming/test_parity_foreach.py +0 -36
- snowflake/snowpark_connect/includes/python/pyspark/sql/tests/connect/streaming/test_parity_foreach_batch.py +0 -44
- snowflake/snowpark_connect/includes/python/pyspark/sql/tests/connect/streaming/test_parity_listener.py +0 -116
- snowflake/snowpark_connect/includes/python/pyspark/sql/tests/connect/streaming/test_parity_streaming.py +0 -35
- snowflake/snowpark_connect/includes/python/pyspark/sql/tests/connect/test_connect_basic.py +0 -3612
- snowflake/snowpark_connect/includes/python/pyspark/sql/tests/connect/test_connect_column.py +0 -1042
- snowflake/snowpark_connect/includes/python/pyspark/sql/tests/connect/test_connect_function.py +0 -2381
- snowflake/snowpark_connect/includes/python/pyspark/sql/tests/connect/test_connect_plan.py +0 -1060
- snowflake/snowpark_connect/includes/python/pyspark/sql/tests/connect/test_parity_arrow.py +0 -163
- snowflake/snowpark_connect/includes/python/pyspark/sql/tests/connect/test_parity_arrow_map.py +0 -38
- snowflake/snowpark_connect/includes/python/pyspark/sql/tests/connect/test_parity_arrow_python_udf.py +0 -48
- snowflake/snowpark_connect/includes/python/pyspark/sql/tests/connect/test_parity_catalog.py +0 -36
- snowflake/snowpark_connect/includes/python/pyspark/sql/tests/connect/test_parity_column.py +0 -55
- snowflake/snowpark_connect/includes/python/pyspark/sql/tests/connect/test_parity_conf.py +0 -36
- snowflake/snowpark_connect/includes/python/pyspark/sql/tests/connect/test_parity_dataframe.py +0 -96
- snowflake/snowpark_connect/includes/python/pyspark/sql/tests/connect/test_parity_datasources.py +0 -44
- snowflake/snowpark_connect/includes/python/pyspark/sql/tests/connect/test_parity_errors.py +0 -36
- snowflake/snowpark_connect/includes/python/pyspark/sql/tests/connect/test_parity_functions.py +0 -59
- snowflake/snowpark_connect/includes/python/pyspark/sql/tests/connect/test_parity_group.py +0 -36
- snowflake/snowpark_connect/includes/python/pyspark/sql/tests/connect/test_parity_pandas_cogrouped_map.py +0 -59
- snowflake/snowpark_connect/includes/python/pyspark/sql/tests/connect/test_parity_pandas_grouped_map.py +0 -74
- snowflake/snowpark_connect/includes/python/pyspark/sql/tests/connect/test_parity_pandas_grouped_map_with_state.py +0 -62
- snowflake/snowpark_connect/includes/python/pyspark/sql/tests/connect/test_parity_pandas_map.py +0 -58
- snowflake/snowpark_connect/includes/python/pyspark/sql/tests/connect/test_parity_pandas_udf.py +0 -70
- snowflake/snowpark_connect/includes/python/pyspark/sql/tests/connect/test_parity_pandas_udf_grouped_agg.py +0 -50
- snowflake/snowpark_connect/includes/python/pyspark/sql/tests/connect/test_parity_pandas_udf_scalar.py +0 -68
- snowflake/snowpark_connect/includes/python/pyspark/sql/tests/connect/test_parity_pandas_udf_window.py +0 -40
- snowflake/snowpark_connect/includes/python/pyspark/sql/tests/connect/test_parity_readwriter.py +0 -46
- snowflake/snowpark_connect/includes/python/pyspark/sql/tests/connect/test_parity_serde.py +0 -44
- snowflake/snowpark_connect/includes/python/pyspark/sql/tests/connect/test_parity_types.py +0 -100
- snowflake/snowpark_connect/includes/python/pyspark/sql/tests/connect/test_parity_udf.py +0 -100
- snowflake/snowpark_connect/includes/python/pyspark/sql/tests/connect/test_parity_udtf.py +0 -163
- snowflake/snowpark_connect/includes/python/pyspark/sql/tests/connect/test_session.py +0 -181
- snowflake/snowpark_connect/includes/python/pyspark/sql/tests/connect/test_utils.py +0 -42
- snowflake/snowpark_connect/includes/python/pyspark/sql/tests/pandas/__init__.py +0 -16
- snowflake/snowpark_connect/includes/python/pyspark/sql/tests/pandas/test_pandas_cogrouped_map.py +0 -623
- snowflake/snowpark_connect/includes/python/pyspark/sql/tests/pandas/test_pandas_grouped_map.py +0 -869
- snowflake/snowpark_connect/includes/python/pyspark/sql/tests/pandas/test_pandas_grouped_map_with_state.py +0 -342
- snowflake/snowpark_connect/includes/python/pyspark/sql/tests/pandas/test_pandas_map.py +0 -436
- snowflake/snowpark_connect/includes/python/pyspark/sql/tests/pandas/test_pandas_udf.py +0 -363
- snowflake/snowpark_connect/includes/python/pyspark/sql/tests/pandas/test_pandas_udf_grouped_agg.py +0 -592
- snowflake/snowpark_connect/includes/python/pyspark/sql/tests/pandas/test_pandas_udf_scalar.py +0 -1503
- snowflake/snowpark_connect/includes/python/pyspark/sql/tests/pandas/test_pandas_udf_typehints.py +0 -392
- snowflake/snowpark_connect/includes/python/pyspark/sql/tests/pandas/test_pandas_udf_typehints_with_future_annotations.py +0 -375
- snowflake/snowpark_connect/includes/python/pyspark/sql/tests/pandas/test_pandas_udf_window.py +0 -411
- snowflake/snowpark_connect/includes/python/pyspark/sql/tests/streaming/__init__.py +0 -16
- snowflake/snowpark_connect/includes/python/pyspark/sql/tests/streaming/test_streaming.py +0 -401
- snowflake/snowpark_connect/includes/python/pyspark/sql/tests/streaming/test_streaming_foreach.py +0 -295
- snowflake/snowpark_connect/includes/python/pyspark/sql/tests/streaming/test_streaming_foreach_batch.py +0 -106
- snowflake/snowpark_connect/includes/python/pyspark/sql/tests/streaming/test_streaming_listener.py +0 -558
- snowflake/snowpark_connect/includes/python/pyspark/sql/tests/test_arrow.py +0 -1346
- snowflake/snowpark_connect/includes/python/pyspark/sql/tests/test_arrow_map.py +0 -182
- snowflake/snowpark_connect/includes/python/pyspark/sql/tests/test_arrow_python_udf.py +0 -202
- snowflake/snowpark_connect/includes/python/pyspark/sql/tests/test_catalog.py +0 -503
- snowflake/snowpark_connect/includes/python/pyspark/sql/tests/test_column.py +0 -225
- snowflake/snowpark_connect/includes/python/pyspark/sql/tests/test_conf.py +0 -83
- snowflake/snowpark_connect/includes/python/pyspark/sql/tests/test_context.py +0 -201
- snowflake/snowpark_connect/includes/python/pyspark/sql/tests/test_dataframe.py +0 -1931
- snowflake/snowpark_connect/includes/python/pyspark/sql/tests/test_datasources.py +0 -256
- snowflake/snowpark_connect/includes/python/pyspark/sql/tests/test_errors.py +0 -69
- snowflake/snowpark_connect/includes/python/pyspark/sql/tests/test_functions.py +0 -1349
- snowflake/snowpark_connect/includes/python/pyspark/sql/tests/test_group.py +0 -53
- snowflake/snowpark_connect/includes/python/pyspark/sql/tests/test_pandas_sqlmetrics.py +0 -68
- snowflake/snowpark_connect/includes/python/pyspark/sql/tests/test_readwriter.py +0 -283
- snowflake/snowpark_connect/includes/python/pyspark/sql/tests/test_serde.py +0 -155
- snowflake/snowpark_connect/includes/python/pyspark/sql/tests/test_session.py +0 -412
- snowflake/snowpark_connect/includes/python/pyspark/sql/tests/test_types.py +0 -1581
- snowflake/snowpark_connect/includes/python/pyspark/sql/tests/test_udf.py +0 -961
- snowflake/snowpark_connect/includes/python/pyspark/sql/tests/test_udf_profiler.py +0 -165
- snowflake/snowpark_connect/includes/python/pyspark/sql/tests/test_udtf.py +0 -1456
- snowflake/snowpark_connect/includes/python/pyspark/sql/tests/test_utils.py +0 -1686
- snowflake/snowpark_connect/includes/python/pyspark/streaming/tests/__init__.py +0 -16
- snowflake/snowpark_connect/includes/python/pyspark/streaming/tests/test_context.py +0 -184
- snowflake/snowpark_connect/includes/python/pyspark/streaming/tests/test_dstream.py +0 -706
- snowflake/snowpark_connect/includes/python/pyspark/streaming/tests/test_kinesis.py +0 -118
- snowflake/snowpark_connect/includes/python/pyspark/streaming/tests/test_listener.py +0 -160
- snowflake/snowpark_connect/includes/python/pyspark/tests/__init__.py +0 -16
- snowflake/snowpark_connect/includes/python/pyspark/tests/test_appsubmit.py +0 -306
- snowflake/snowpark_connect/includes/python/pyspark/tests/test_broadcast.py +0 -196
- snowflake/snowpark_connect/includes/python/pyspark/tests/test_conf.py +0 -44
- snowflake/snowpark_connect/includes/python/pyspark/tests/test_context.py +0 -346
- snowflake/snowpark_connect/includes/python/pyspark/tests/test_daemon.py +0 -89
- snowflake/snowpark_connect/includes/python/pyspark/tests/test_install_spark.py +0 -124
- snowflake/snowpark_connect/includes/python/pyspark/tests/test_join.py +0 -69
- snowflake/snowpark_connect/includes/python/pyspark/tests/test_memory_profiler.py +0 -167
- snowflake/snowpark_connect/includes/python/pyspark/tests/test_pin_thread.py +0 -194
- snowflake/snowpark_connect/includes/python/pyspark/tests/test_profiler.py +0 -168
- snowflake/snowpark_connect/includes/python/pyspark/tests/test_rdd.py +0 -939
- snowflake/snowpark_connect/includes/python/pyspark/tests/test_rddbarrier.py +0 -52
- snowflake/snowpark_connect/includes/python/pyspark/tests/test_rddsampler.py +0 -66
- snowflake/snowpark_connect/includes/python/pyspark/tests/test_readwrite.py +0 -368
- snowflake/snowpark_connect/includes/python/pyspark/tests/test_serializers.py +0 -257
- snowflake/snowpark_connect/includes/python/pyspark/tests/test_shuffle.py +0 -267
- snowflake/snowpark_connect/includes/python/pyspark/tests/test_stage_sched.py +0 -153
- snowflake/snowpark_connect/includes/python/pyspark/tests/test_statcounter.py +0 -130
- snowflake/snowpark_connect/includes/python/pyspark/tests/test_taskcontext.py +0 -350
- snowflake/snowpark_connect/includes/python/pyspark/tests/test_util.py +0 -97
- snowflake/snowpark_connect/includes/python/pyspark/tests/test_worker.py +0 -271
- snowpark_connect-0.24.0.dist-info/RECORD +0 -898
- {snowpark_connect-0.24.0.data → snowpark_connect-0.26.0.data}/scripts/snowpark-connect +0 -0
- {snowpark_connect-0.24.0.data → snowpark_connect-0.26.0.data}/scripts/snowpark-session +0 -0
- {snowpark_connect-0.24.0.data → snowpark_connect-0.26.0.data}/scripts/snowpark-submit +0 -0
- {snowpark_connect-0.24.0.dist-info → snowpark_connect-0.26.0.dist-info}/WHEEL +0 -0
- {snowpark_connect-0.24.0.dist-info → snowpark_connect-0.26.0.dist-info}/licenses/LICENSE-binary +0 -0
- {snowpark_connect-0.24.0.dist-info → snowpark_connect-0.26.0.dist-info}/licenses/LICENSE.txt +0 -0
- {snowpark_connect-0.24.0.dist-info → snowpark_connect-0.26.0.dist-info}/licenses/NOTICE-binary +0 -0
- {snowpark_connect-0.24.0.dist-info → snowpark_connect-0.26.0.dist-info}/top_level.txt +0 -0
|
@@ -1,961 +0,0 @@
|
|
|
1
|
-
#
|
|
2
|
-
# Licensed to the Apache Software Foundation (ASF) under one or more
|
|
3
|
-
# contributor license agreements. See the NOTICE file distributed with
|
|
4
|
-
# this work for additional information regarding copyright ownership.
|
|
5
|
-
# The ASF licenses this file to You under the Apache License, Version 2.0
|
|
6
|
-
# (the "License"); you may not use this file except in compliance with
|
|
7
|
-
# the License. You may obtain a copy of the License at
|
|
8
|
-
#
|
|
9
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
-
#
|
|
11
|
-
# Unless required by applicable law or agreed to in writing, software
|
|
12
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
-
# See the License for the specific language governing permissions and
|
|
15
|
-
# limitations under the License.
|
|
16
|
-
#
|
|
17
|
-
|
|
18
|
-
import functools
|
|
19
|
-
import pydoc
|
|
20
|
-
import shutil
|
|
21
|
-
import tempfile
|
|
22
|
-
import unittest
|
|
23
|
-
import datetime
|
|
24
|
-
|
|
25
|
-
from pyspark import SparkContext, SQLContext
|
|
26
|
-
from pyspark.sql import SparkSession, Column, Row
|
|
27
|
-
from pyspark.sql.functions import col, udf, assert_true, lit, rand
|
|
28
|
-
from pyspark.sql.udf import UserDefinedFunction
|
|
29
|
-
from pyspark.sql.types import (
|
|
30
|
-
StringType,
|
|
31
|
-
IntegerType,
|
|
32
|
-
BooleanType,
|
|
33
|
-
DoubleType,
|
|
34
|
-
LongType,
|
|
35
|
-
ArrayType,
|
|
36
|
-
StructType,
|
|
37
|
-
StructField,
|
|
38
|
-
TimestampNTZType,
|
|
39
|
-
DayTimeIntervalType,
|
|
40
|
-
)
|
|
41
|
-
from pyspark.errors import AnalysisException, PythonException, PySparkTypeError
|
|
42
|
-
from pyspark.testing.sqlutils import ReusedSQLTestCase, test_compiled, test_not_compiled_message
|
|
43
|
-
from pyspark.testing.utils import QuietTest, assertDataFrameEqual
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
class BaseUDFTestsMixin(object):
|
|
47
|
-
def test_udf_with_callable(self):
|
|
48
|
-
data = self.spark.createDataFrame([(i, i**2) for i in range(10)], ["number", "squared"])
|
|
49
|
-
|
|
50
|
-
class PlusFour:
|
|
51
|
-
def __call__(self, col):
|
|
52
|
-
if col is not None:
|
|
53
|
-
return col + 4
|
|
54
|
-
|
|
55
|
-
call = PlusFour()
|
|
56
|
-
pudf = UserDefinedFunction(call, LongType())
|
|
57
|
-
res = data.select(pudf(data["number"]).alias("plus_four"))
|
|
58
|
-
self.assertEqual(res.agg({"plus_four": "sum"}).collect()[0][0], 85)
|
|
59
|
-
|
|
60
|
-
def test_udf_with_partial_function(self):
|
|
61
|
-
data = self.spark.createDataFrame([(i, i**2) for i in range(10)], ["number", "squared"])
|
|
62
|
-
|
|
63
|
-
def some_func(col, param):
|
|
64
|
-
if col is not None:
|
|
65
|
-
return col + param
|
|
66
|
-
|
|
67
|
-
pfunc = functools.partial(some_func, param=4)
|
|
68
|
-
pudf = UserDefinedFunction(pfunc, LongType())
|
|
69
|
-
res = data.select(pudf(data["number"]).alias("plus_four"))
|
|
70
|
-
self.assertEqual(res.agg({"plus_four": "sum"}).collect()[0][0], 85)
|
|
71
|
-
|
|
72
|
-
def test_udf(self):
|
|
73
|
-
self.spark.catalog.registerFunction("twoArgs", lambda x, y: len(x) + y, IntegerType())
|
|
74
|
-
[row] = self.spark.sql("SELECT twoArgs('test', 1)").collect()
|
|
75
|
-
self.assertEqual(row[0], 5)
|
|
76
|
-
|
|
77
|
-
def test_udf_on_sql_context(self):
|
|
78
|
-
# This is to check if a deprecated 'SQLContext.registerFunction' can call its alias.
|
|
79
|
-
sqlContext = SQLContext.getOrCreate(self.spark.sparkContext)
|
|
80
|
-
sqlContext.registerFunction("oneArg", lambda x: len(x), IntegerType())
|
|
81
|
-
[row] = sqlContext.sql("SELECT oneArg('test')").collect()
|
|
82
|
-
self.assertEqual(row[0], 4)
|
|
83
|
-
|
|
84
|
-
def test_udf2(self):
|
|
85
|
-
with self.tempView("test"):
|
|
86
|
-
self.spark.catalog.registerFunction("strlen", lambda string: len(string), IntegerType())
|
|
87
|
-
self.spark.createDataFrame([("test",)], ["a"]).createOrReplaceTempView("test")
|
|
88
|
-
[res] = self.spark.sql("SELECT strlen(a) FROM test WHERE strlen(a) > 1").collect()
|
|
89
|
-
self.assertEqual(4, res[0])
|
|
90
|
-
|
|
91
|
-
def test_udf3(self):
|
|
92
|
-
two_args = self.spark.catalog.registerFunction(
|
|
93
|
-
"twoArgs", UserDefinedFunction(lambda x, y: len(x) + y)
|
|
94
|
-
)
|
|
95
|
-
self.assertEqual(two_args.deterministic, True)
|
|
96
|
-
[row] = self.spark.sql("SELECT twoArgs('test', 1)").collect()
|
|
97
|
-
self.assertEqual(row[0], "5")
|
|
98
|
-
|
|
99
|
-
def test_udf_registration_return_type_none(self):
|
|
100
|
-
two_args = self.spark.catalog.registerFunction(
|
|
101
|
-
"twoArgs", UserDefinedFunction(lambda x, y: len(x) + y, "integer"), None
|
|
102
|
-
)
|
|
103
|
-
self.assertEqual(two_args.deterministic, True)
|
|
104
|
-
[row] = self.spark.sql("SELECT twoArgs('test', 1)").collect()
|
|
105
|
-
self.assertEqual(row[0], 5)
|
|
106
|
-
|
|
107
|
-
def test_udf_registration_return_type_not_none(self):
|
|
108
|
-
with QuietTest(self.sc):
|
|
109
|
-
self.check_udf_registration_return_type_not_none()
|
|
110
|
-
|
|
111
|
-
def check_udf_registration_return_type_not_none(self):
|
|
112
|
-
# negative test for incorrect type
|
|
113
|
-
with self.assertRaises(PySparkTypeError) as pe:
|
|
114
|
-
self.spark.catalog.registerFunction(
|
|
115
|
-
"f", UserDefinedFunction(lambda x, y: len(x) + y, StringType()), StringType()
|
|
116
|
-
)
|
|
117
|
-
|
|
118
|
-
self.check_error(
|
|
119
|
-
exception=pe.exception,
|
|
120
|
-
error_class="CANNOT_SPECIFY_RETURN_TYPE_FOR_UDF",
|
|
121
|
-
message_parameters={"arg_name": "f", "return_type": "StringType()"},
|
|
122
|
-
)
|
|
123
|
-
|
|
124
|
-
def test_nondeterministic_udf(self):
|
|
125
|
-
# Test that nondeterministic UDFs are evaluated only once in chained UDF evaluations
|
|
126
|
-
import random
|
|
127
|
-
|
|
128
|
-
udf_random_col = udf(lambda: int(100 * random.random()), IntegerType()).asNondeterministic()
|
|
129
|
-
self.assertEqual(udf_random_col.deterministic, False)
|
|
130
|
-
df = self.spark.createDataFrame([Row(1)]).select(udf_random_col().alias("RAND"))
|
|
131
|
-
udf_add_ten = udf(lambda rand: rand + 10, IntegerType())
|
|
132
|
-
[row] = df.withColumn("RAND_PLUS_TEN", udf_add_ten("RAND")).collect()
|
|
133
|
-
self.assertEqual(row[0] + 10, row[1])
|
|
134
|
-
|
|
135
|
-
def test_nondeterministic_udf2(self):
|
|
136
|
-
import random
|
|
137
|
-
|
|
138
|
-
random_udf = udf(lambda: random.randint(6, 6), IntegerType()).asNondeterministic()
|
|
139
|
-
self.assertEqual(random_udf.deterministic, False)
|
|
140
|
-
random_udf1 = self.spark.catalog.registerFunction("randInt", random_udf)
|
|
141
|
-
self.assertEqual(random_udf1.deterministic, False)
|
|
142
|
-
[row] = self.spark.sql("SELECT randInt()").collect()
|
|
143
|
-
self.assertEqual(row[0], 6)
|
|
144
|
-
[row] = self.spark.range(1).select(random_udf1()).collect()
|
|
145
|
-
self.assertEqual(row[0], 6)
|
|
146
|
-
[row] = self.spark.range(1).select(random_udf()).collect()
|
|
147
|
-
self.assertEqual(row[0], 6)
|
|
148
|
-
# render_doc() reproduces the help() exception without printing output
|
|
149
|
-
pydoc.render_doc(udf(lambda: random.randint(6, 6), IntegerType()))
|
|
150
|
-
pydoc.render_doc(random_udf)
|
|
151
|
-
pydoc.render_doc(random_udf1)
|
|
152
|
-
pydoc.render_doc(udf(lambda x: x).asNondeterministic)
|
|
153
|
-
|
|
154
|
-
def test_nondeterministic_udf3(self):
|
|
155
|
-
# regression test for SPARK-23233
|
|
156
|
-
f = udf(lambda x: x)
|
|
157
|
-
# Here we cache the JVM UDF instance.
|
|
158
|
-
self.spark.range(1).select(f("id"))
|
|
159
|
-
# This should reset the cache to set the deterministic status correctly.
|
|
160
|
-
f = f.asNondeterministic()
|
|
161
|
-
# Check the deterministic status of udf.
|
|
162
|
-
df = self.spark.range(1).select(f("id"))
|
|
163
|
-
deterministic = df._jdf.logicalPlan().projectList().head().deterministic()
|
|
164
|
-
self.assertFalse(deterministic)
|
|
165
|
-
|
|
166
|
-
def test_nondeterministic_udf_in_aggregate(self):
|
|
167
|
-
with QuietTest(self.sc):
|
|
168
|
-
self.check_nondeterministic_udf_in_aggregate()
|
|
169
|
-
|
|
170
|
-
def check_nondeterministic_udf_in_aggregate(self):
|
|
171
|
-
from pyspark.sql.functions import sum
|
|
172
|
-
import random
|
|
173
|
-
|
|
174
|
-
udf_random_col = udf(lambda: int(100 * random.random()), "int").asNondeterministic()
|
|
175
|
-
df = self.spark.range(10)
|
|
176
|
-
|
|
177
|
-
with self.assertRaisesRegex(AnalysisException, "Non-deterministic"):
|
|
178
|
-
df.groupby("id").agg(sum(udf_random_col())).collect()
|
|
179
|
-
with self.assertRaisesRegex(AnalysisException, "Non-deterministic"):
|
|
180
|
-
df.agg(sum(udf_random_col())).collect()
|
|
181
|
-
|
|
182
|
-
def test_chained_udf(self):
|
|
183
|
-
self.spark.catalog.registerFunction("double", lambda x: x + x, IntegerType())
|
|
184
|
-
[row] = self.spark.sql("SELECT double(1)").collect()
|
|
185
|
-
self.assertEqual(row[0], 2)
|
|
186
|
-
[row] = self.spark.sql("SELECT double(double(1))").collect()
|
|
187
|
-
self.assertEqual(row[0], 4)
|
|
188
|
-
[row] = self.spark.sql("SELECT double(double(1) + 1)").collect()
|
|
189
|
-
self.assertEqual(row[0], 6)
|
|
190
|
-
|
|
191
|
-
def test_single_udf_with_repeated_argument(self):
|
|
192
|
-
# regression test for SPARK-20685
|
|
193
|
-
self.spark.catalog.registerFunction("add", lambda x, y: x + y, IntegerType())
|
|
194
|
-
row = self.spark.sql("SELECT add(1, 1)").first()
|
|
195
|
-
self.assertEqual(tuple(row), (2,))
|
|
196
|
-
|
|
197
|
-
def test_multiple_udfs(self):
|
|
198
|
-
self.spark.catalog.registerFunction("double", lambda x: x * 2, IntegerType())
|
|
199
|
-
[row] = self.spark.sql("SELECT double(1), double(2)").collect()
|
|
200
|
-
self.assertEqual(tuple(row), (2, 4))
|
|
201
|
-
[row] = self.spark.sql("SELECT double(double(1)), double(double(2) + 2)").collect()
|
|
202
|
-
self.assertEqual(tuple(row), (4, 12))
|
|
203
|
-
self.spark.catalog.registerFunction("add", lambda x, y: x + y, IntegerType())
|
|
204
|
-
[row] = self.spark.sql("SELECT double(add(1, 2)), add(double(2), 1)").collect()
|
|
205
|
-
self.assertEqual(tuple(row), (6, 5))
|
|
206
|
-
|
|
207
|
-
def test_udf_in_filter_on_top_of_outer_join(self):
|
|
208
|
-
left = self.spark.createDataFrame([Row(a=1)])
|
|
209
|
-
right = self.spark.createDataFrame([Row(a=1)])
|
|
210
|
-
df = left.join(right, on="a", how="left_outer")
|
|
211
|
-
df = df.withColumn("b", udf(lambda x: "x")(df.a))
|
|
212
|
-
self.assertEqual(df.filter('b = "x"').collect(), [Row(a=1, b="x")])
|
|
213
|
-
|
|
214
|
-
def test_udf_in_filter_on_top_of_join(self):
|
|
215
|
-
# regression test for SPARK-18589
|
|
216
|
-
left = self.spark.createDataFrame([Row(a=1)])
|
|
217
|
-
right = self.spark.createDataFrame([Row(b=1)])
|
|
218
|
-
f = udf(lambda a, b: a == b, BooleanType())
|
|
219
|
-
df = left.crossJoin(right).filter(f("a", "b"))
|
|
220
|
-
self.assertEqual(df.collect(), [Row(a=1, b=1)])
|
|
221
|
-
|
|
222
|
-
def test_udf_in_join_condition(self):
|
|
223
|
-
# regression test for SPARK-25314
|
|
224
|
-
left = self.spark.createDataFrame([Row(a=1)])
|
|
225
|
-
right = self.spark.createDataFrame([Row(b=1)])
|
|
226
|
-
f = udf(lambda a, b: a == b, BooleanType())
|
|
227
|
-
# The udf uses attributes from both sides of join, so it is pulled out as Filter +
|
|
228
|
-
# Cross join.
|
|
229
|
-
df = left.join(right, f("a", "b"))
|
|
230
|
-
with self.sql_conf({"spark.sql.crossJoin.enabled": False}):
|
|
231
|
-
with self.assertRaisesRegex(AnalysisException, "Detected implicit cartesian product"):
|
|
232
|
-
df.collect()
|
|
233
|
-
with self.sql_conf({"spark.sql.crossJoin.enabled": True}):
|
|
234
|
-
self.assertEqual(df.collect(), [Row(a=1, b=1)])
|
|
235
|
-
|
|
236
|
-
def test_udf_in_left_outer_join_condition(self):
|
|
237
|
-
# regression test for SPARK-26147
|
|
238
|
-
from pyspark.sql.functions import col
|
|
239
|
-
|
|
240
|
-
left = self.spark.createDataFrame([Row(a=1)])
|
|
241
|
-
right = self.spark.createDataFrame([Row(b=1)])
|
|
242
|
-
f = udf(lambda a: str(a), StringType())
|
|
243
|
-
# The join condition can't be pushed down, as it refers to attributes from both sides.
|
|
244
|
-
# The Python UDF only refer to attributes from one side, so it's evaluable.
|
|
245
|
-
df = left.join(right, f("a") == col("b").cast("string"), how="left_outer")
|
|
246
|
-
with self.sql_conf({"spark.sql.crossJoin.enabled": True}):
|
|
247
|
-
self.assertEqual(df.collect(), [Row(a=1, b=1)])
|
|
248
|
-
|
|
249
|
-
def test_udf_and_common_filter_in_join_condition(self):
|
|
250
|
-
# regression test for SPARK-25314
|
|
251
|
-
# test the complex scenario with both udf and common filter
|
|
252
|
-
left = self.spark.createDataFrame([Row(a=1, a1=1, a2=1), Row(a=2, a1=2, a2=2)])
|
|
253
|
-
right = self.spark.createDataFrame([Row(b=1, b1=1, b2=1), Row(b=1, b1=3, b2=1)])
|
|
254
|
-
f = udf(lambda a, b: a == b, BooleanType())
|
|
255
|
-
df = left.join(right, [f("a", "b"), left.a1 == right.b1])
|
|
256
|
-
# do not need spark.sql.crossJoin.enabled=true for udf is not the only join condition.
|
|
257
|
-
self.assertEqual(df.collect(), [Row(a=1, a1=1, a2=1, b=1, b1=1, b2=1)])
|
|
258
|
-
|
|
259
|
-
def test_udf_not_supported_in_join_condition(self):
|
|
260
|
-
# regression test for SPARK-25314
|
|
261
|
-
# test python udf is not supported in join type except inner join.
|
|
262
|
-
left = self.spark.createDataFrame([Row(a=1, a1=1, a2=1), Row(a=2, a1=2, a2=2)])
|
|
263
|
-
right = self.spark.createDataFrame([Row(b=1, b1=1, b2=1), Row(b=1, b1=3, b2=1)])
|
|
264
|
-
f = udf(lambda a, b: a == b, BooleanType())
|
|
265
|
-
|
|
266
|
-
def runWithJoinType(join_type, type_string):
|
|
267
|
-
with self.assertRaisesRegex(
|
|
268
|
-
AnalysisException,
|
|
269
|
-
"""Python UDF in the ON clause of a %s JOIN.""" % type_string,
|
|
270
|
-
):
|
|
271
|
-
left.join(right, [f("a", "b"), left.a1 == right.b1], join_type).collect()
|
|
272
|
-
|
|
273
|
-
runWithJoinType("full", "FULL OUTER")
|
|
274
|
-
runWithJoinType("left", "LEFT OUTER")
|
|
275
|
-
runWithJoinType("right", "RIGHT OUTER")
|
|
276
|
-
runWithJoinType("leftanti", "LEFT ANTI")
|
|
277
|
-
runWithJoinType("leftsemi", "LEFT SEMI")
|
|
278
|
-
|
|
279
|
-
def test_udf_as_join_condition(self):
|
|
280
|
-
left = self.spark.createDataFrame([Row(a=1, a1=1, a2=1), Row(a=2, a1=2, a2=2)])
|
|
281
|
-
right = self.spark.createDataFrame([Row(b=1, b1=1, b2=1), Row(b=1, b1=3, b2=1)])
|
|
282
|
-
f = udf(lambda a: a, IntegerType())
|
|
283
|
-
|
|
284
|
-
df = left.join(right, [f("a") == f("b"), left.a1 == right.b1])
|
|
285
|
-
self.assertEqual(df.collect(), [Row(a=1, a1=1, a2=1, b=1, b1=1, b2=1)])
|
|
286
|
-
|
|
287
|
-
def test_udf_without_arguments(self):
|
|
288
|
-
self.spark.catalog.registerFunction("foo", lambda: "bar")
|
|
289
|
-
[row] = self.spark.sql("SELECT foo()").collect()
|
|
290
|
-
self.assertEqual(row[0], "bar")
|
|
291
|
-
|
|
292
|
-
def test_udf_with_array_type(self):
|
|
293
|
-
with self.tempView("test"):
|
|
294
|
-
self.spark.createDataFrame(
|
|
295
|
-
[
|
|
296
|
-
([0, 1, 2], {"key": [0, 1, 2, 3, 4]}),
|
|
297
|
-
],
|
|
298
|
-
["l", "d"],
|
|
299
|
-
).createOrReplaceTempView("test")
|
|
300
|
-
self.spark.catalog.registerFunction(
|
|
301
|
-
"copylist", lambda l: list(l), ArrayType(IntegerType())
|
|
302
|
-
)
|
|
303
|
-
self.spark.catalog.registerFunction("maplen", lambda d: len(d), IntegerType())
|
|
304
|
-
[(l1, l2)] = self.spark.sql("select copylist(l), maplen(d) from test").collect()
|
|
305
|
-
self.assertEqual(list(range(3)), l1)
|
|
306
|
-
self.assertEqual(1, l2)
|
|
307
|
-
|
|
308
|
-
def test_broadcast_in_udf(self):
|
|
309
|
-
bar = {"a": "aa", "b": "bb", "c": "abc"}
|
|
310
|
-
foo = self.sc.broadcast(bar)
|
|
311
|
-
self.spark.catalog.registerFunction("MYUDF", lambda x: foo.value[x] if x else "")
|
|
312
|
-
[res] = self.spark.sql("SELECT MYUDF('c')").collect()
|
|
313
|
-
self.assertEqual("abc", res[0])
|
|
314
|
-
[res] = self.spark.sql("SELECT MYUDF('')").collect()
|
|
315
|
-
self.assertEqual("", res[0])
|
|
316
|
-
|
|
317
|
-
def test_udf_with_filter_function(self):
|
|
318
|
-
df = self.spark.createDataFrame([(1, "1"), (2, "2"), (1, "2"), (1, "2")], ["key", "value"])
|
|
319
|
-
from pyspark.sql.functions import col
|
|
320
|
-
|
|
321
|
-
my_filter = udf(lambda a: a < 2, BooleanType())
|
|
322
|
-
sel = df.select(col("key"), col("value")).filter((my_filter(col("key"))) & (df.value < "2"))
|
|
323
|
-
self.assertEqual(sel.collect(), [Row(key=1, value="1")])
|
|
324
|
-
|
|
325
|
-
def test_udf_with_aggregate_function(self):
|
|
326
|
-
df = self.spark.createDataFrame([(1, "1"), (2, "2"), (1, "2"), (1, "2")], ["key", "value"])
|
|
327
|
-
from pyspark.sql.functions import col, sum
|
|
328
|
-
|
|
329
|
-
my_filter = udf(lambda a: a == 1, BooleanType())
|
|
330
|
-
sel = df.select(col("key")).distinct().filter(my_filter(col("key")))
|
|
331
|
-
self.assertEqual(sel.collect(), [Row(key=1)])
|
|
332
|
-
|
|
333
|
-
my_copy = udf(lambda x: x, IntegerType())
|
|
334
|
-
my_add = udf(lambda a, b: int(a + b), IntegerType())
|
|
335
|
-
my_strlen = udf(lambda x: len(x), IntegerType())
|
|
336
|
-
sel = (
|
|
337
|
-
df.groupBy(my_copy(col("key")).alias("k"))
|
|
338
|
-
.agg(sum(my_strlen(col("value"))).alias("s"))
|
|
339
|
-
.select(my_add(col("k"), col("s")).alias("t"))
|
|
340
|
-
)
|
|
341
|
-
self.assertEqual(sel.collect(), [Row(t=4), Row(t=3)])
|
|
342
|
-
|
|
343
|
-
def test_udf_in_generate(self):
|
|
344
|
-
from pyspark.sql.functions import explode
|
|
345
|
-
|
|
346
|
-
df = self.spark.range(5)
|
|
347
|
-
f = udf(lambda x: list(range(x)), ArrayType(LongType()))
|
|
348
|
-
row = df.select(explode(f(*df))).groupBy().sum().first()
|
|
349
|
-
self.assertEqual(row[0], 10)
|
|
350
|
-
|
|
351
|
-
df = self.spark.range(3)
|
|
352
|
-
res = df.select("id", explode(f(df.id))).collect()
|
|
353
|
-
self.assertEqual(res[0][0], 1)
|
|
354
|
-
self.assertEqual(res[0][1], 0)
|
|
355
|
-
self.assertEqual(res[1][0], 2)
|
|
356
|
-
self.assertEqual(res[1][1], 0)
|
|
357
|
-
self.assertEqual(res[2][0], 2)
|
|
358
|
-
self.assertEqual(res[2][1], 1)
|
|
359
|
-
|
|
360
|
-
range_udf = udf(lambda value: list(range(value - 1, value + 1)), ArrayType(IntegerType()))
|
|
361
|
-
res = df.select("id", explode(range_udf(df.id))).collect()
|
|
362
|
-
self.assertEqual(res[0][0], 0)
|
|
363
|
-
self.assertEqual(res[0][1], -1)
|
|
364
|
-
self.assertEqual(res[1][0], 0)
|
|
365
|
-
self.assertEqual(res[1][1], 0)
|
|
366
|
-
self.assertEqual(res[2][0], 1)
|
|
367
|
-
self.assertEqual(res[2][1], 0)
|
|
368
|
-
self.assertEqual(res[3][0], 1)
|
|
369
|
-
self.assertEqual(res[3][1], 1)
|
|
370
|
-
|
|
371
|
-
def test_udf_with_order_by_and_limit(self):
|
|
372
|
-
my_copy = udf(lambda x: x, IntegerType())
|
|
373
|
-
df = self.spark.range(10).orderBy("id")
|
|
374
|
-
res = df.select(df.id, my_copy(df.id).alias("copy")).limit(1)
|
|
375
|
-
self.assertEqual(res.collect(), [Row(id=0, copy=0)])
|
|
376
|
-
|
|
377
|
-
def test_udf_registration_returns_udf(self):
|
|
378
|
-
df = self.spark.range(10)
|
|
379
|
-
add_three = self.spark.udf.register("add_three", lambda x: x + 3, IntegerType())
|
|
380
|
-
|
|
381
|
-
self.assertListEqual(
|
|
382
|
-
df.selectExpr("add_three(id) AS plus_three").collect(),
|
|
383
|
-
df.select(add_three("id").alias("plus_three")).collect(),
|
|
384
|
-
)
|
|
385
|
-
|
|
386
|
-
def test_udf_registration_returns_udf_on_sql_context(self):
|
|
387
|
-
df = self.spark.range(10)
|
|
388
|
-
|
|
389
|
-
# This is to check if a 'SQLContext.udf' can call its alias.
|
|
390
|
-
sqlContext = SQLContext.getOrCreate(self.spark.sparkContext)
|
|
391
|
-
add_four = sqlContext.udf.register("add_four", lambda x: x + 4, IntegerType())
|
|
392
|
-
|
|
393
|
-
self.assertListEqual(
|
|
394
|
-
df.selectExpr("add_four(id) AS plus_four").collect(),
|
|
395
|
-
df.select(add_four("id").alias("plus_four")).collect(),
|
|
396
|
-
)
|
|
397
|
-
|
|
398
|
-
@unittest.skipIf(not test_compiled, test_not_compiled_message) # type: ignore
|
|
399
|
-
def test_register_java_function(self):
|
|
400
|
-
self.spark.udf.registerJavaFunction(
|
|
401
|
-
"javaStringLength", "test.org.apache.spark.sql.JavaStringLength", IntegerType()
|
|
402
|
-
)
|
|
403
|
-
[value] = self.spark.sql("SELECT javaStringLength('test')").first()
|
|
404
|
-
self.assertEqual(value, 4)
|
|
405
|
-
|
|
406
|
-
self.spark.udf.registerJavaFunction(
|
|
407
|
-
"javaStringLength2", "test.org.apache.spark.sql.JavaStringLength"
|
|
408
|
-
)
|
|
409
|
-
[value] = self.spark.sql("SELECT javaStringLength2('test')").first()
|
|
410
|
-
self.assertEqual(value, 4)
|
|
411
|
-
|
|
412
|
-
self.spark.udf.registerJavaFunction(
|
|
413
|
-
"javaStringLength3", "test.org.apache.spark.sql.JavaStringLength", "integer"
|
|
414
|
-
)
|
|
415
|
-
[value] = self.spark.sql("SELECT javaStringLength3('test')").first()
|
|
416
|
-
self.assertEqual(value, 4)
|
|
417
|
-
|
|
418
|
-
@unittest.skipIf(not test_compiled, test_not_compiled_message) # type: ignore
|
|
419
|
-
def test_register_java_udaf(self):
|
|
420
|
-
self.spark.udf.registerJavaUDAF("javaUDAF", "test.org.apache.spark.sql.MyDoubleAvg")
|
|
421
|
-
df = self.spark.createDataFrame([(1, "a"), (2, "b"), (3, "a")], ["id", "name"])
|
|
422
|
-
df.createOrReplaceTempView("df")
|
|
423
|
-
row = self.spark.sql(
|
|
424
|
-
"SELECT name, javaUDAF(id) as avg from df group by name order by name desc"
|
|
425
|
-
).first()
|
|
426
|
-
self.assertEqual(row.asDict(), Row(name="b", avg=102.0).asDict())
|
|
427
|
-
|
|
428
|
-
def test_non_existed_udf(self):
|
|
429
|
-
spark = self.spark
|
|
430
|
-
self.assertRaisesRegex(
|
|
431
|
-
AnalysisException,
|
|
432
|
-
"Can not load class non_existed_udf",
|
|
433
|
-
lambda: spark.udf.registerJavaFunction("udf1", "non_existed_udf"),
|
|
434
|
-
)
|
|
435
|
-
|
|
436
|
-
def test_non_existed_udf_with_sql_context(self):
|
|
437
|
-
# This is to check if a deprecated 'SQLContext.registerJavaFunction' can call its alias.
|
|
438
|
-
sqlContext = SQLContext.getOrCreate(self.spark.sparkContext)
|
|
439
|
-
self.assertRaisesRegex(
|
|
440
|
-
AnalysisException,
|
|
441
|
-
"Can not load class non_existed_udf",
|
|
442
|
-
lambda: sqlContext.registerJavaFunction("udf1", "non_existed_udf"),
|
|
443
|
-
)
|
|
444
|
-
|
|
445
|
-
def test_non_existed_udaf(self):
|
|
446
|
-
spark = self.spark
|
|
447
|
-
self.assertRaisesRegex(
|
|
448
|
-
AnalysisException,
|
|
449
|
-
"Can not load class non_existed_udaf",
|
|
450
|
-
lambda: spark.udf.registerJavaUDAF("udaf1", "non_existed_udaf"),
|
|
451
|
-
)
|
|
452
|
-
|
|
453
|
-
def test_udf_with_input_file_name(self):
|
|
454
|
-
from pyspark.sql.functions import input_file_name
|
|
455
|
-
|
|
456
|
-
sourceFile = udf(lambda path: path, StringType())
|
|
457
|
-
filePath = "python/test_support/sql/people1.json"
|
|
458
|
-
row = self.spark.read.json(filePath).select(sourceFile(input_file_name())).first()
|
|
459
|
-
self.assertTrue(row[0].find("people1.json") != -1)
|
|
460
|
-
|
|
461
|
-
def test_udf_with_input_file_name_for_hadooprdd(self):
|
|
462
|
-
from pyspark.sql.functions import input_file_name
|
|
463
|
-
|
|
464
|
-
def filename(path):
|
|
465
|
-
return path
|
|
466
|
-
|
|
467
|
-
sameText = udf(filename, StringType())
|
|
468
|
-
|
|
469
|
-
rdd = self.sc.textFile("python/test_support/sql/people.json")
|
|
470
|
-
df = self.spark.read.json(rdd).select(input_file_name().alias("file"))
|
|
471
|
-
row = df.select(sameText(df["file"])).first()
|
|
472
|
-
self.assertTrue(row[0].find("people.json") != -1)
|
|
473
|
-
|
|
474
|
-
rdd2 = self.sc.newAPIHadoopFile(
|
|
475
|
-
"python/test_support/sql/people.json",
|
|
476
|
-
"org.apache.hadoop.mapreduce.lib.input.TextInputFormat",
|
|
477
|
-
"org.apache.hadoop.io.LongWritable",
|
|
478
|
-
"org.apache.hadoop.io.Text",
|
|
479
|
-
)
|
|
480
|
-
|
|
481
|
-
df2 = self.spark.read.json(rdd2).select(input_file_name().alias("file"))
|
|
482
|
-
row2 = df2.select(sameText(df2["file"])).first()
|
|
483
|
-
self.assertTrue(row2[0].find("people.json") != -1)
|
|
484
|
-
|
|
485
|
-
def test_udf_defers_judf_initialization(self):
|
|
486
|
-
# This is separate of UDFInitializationTests
|
|
487
|
-
# to avoid context initialization
|
|
488
|
-
# when udf is called
|
|
489
|
-
f = UserDefinedFunction(lambda x: x, StringType())
|
|
490
|
-
|
|
491
|
-
self.assertIsNone(
|
|
492
|
-
f._judf_placeholder, "judf should not be initialized before the first call."
|
|
493
|
-
)
|
|
494
|
-
|
|
495
|
-
self.assertIsInstance(f("foo"), Column, "UDF call should return a Column.")
|
|
496
|
-
|
|
497
|
-
self.assertIsNotNone(
|
|
498
|
-
f._judf_placeholder, "judf should be initialized after UDF has been called."
|
|
499
|
-
)
|
|
500
|
-
|
|
501
|
-
def test_udf_with_string_return_type(self):
|
|
502
|
-
add_one = UserDefinedFunction(lambda x: x + 1, "integer")
|
|
503
|
-
make_pair = UserDefinedFunction(lambda x: (-x, x), "struct<x:integer,y:integer>")
|
|
504
|
-
make_array = UserDefinedFunction(
|
|
505
|
-
lambda x: [float(x) for x in range(x, x + 3)], "array<double>"
|
|
506
|
-
)
|
|
507
|
-
|
|
508
|
-
expected = (2, Row(x=-1, y=1), [1.0, 2.0, 3.0])
|
|
509
|
-
actual = (
|
|
510
|
-
self.spark.range(1, 2)
|
|
511
|
-
.toDF("x")
|
|
512
|
-
.select(add_one("x"), make_pair("x"), make_array("x"))
|
|
513
|
-
.first()
|
|
514
|
-
)
|
|
515
|
-
|
|
516
|
-
self.assertTupleEqual(expected, actual)
|
|
517
|
-
|
|
518
|
-
def test_udf_should_not_accept_noncallable_object(self):
|
|
519
|
-
non_callable = None
|
|
520
|
-
self.assertRaises(TypeError, UserDefinedFunction, non_callable, StringType())
|
|
521
|
-
|
|
522
|
-
def test_udf_with_decorator(self):
|
|
523
|
-
from pyspark.sql.functions import lit
|
|
524
|
-
|
|
525
|
-
@udf(IntegerType())
|
|
526
|
-
def add_one(x):
|
|
527
|
-
if x is not None:
|
|
528
|
-
return x + 1
|
|
529
|
-
|
|
530
|
-
@udf(returnType=DoubleType())
|
|
531
|
-
def add_two(x):
|
|
532
|
-
if x is not None:
|
|
533
|
-
return float(x + 2)
|
|
534
|
-
|
|
535
|
-
@udf
|
|
536
|
-
def to_upper(x):
|
|
537
|
-
if x is not None:
|
|
538
|
-
return x.upper()
|
|
539
|
-
|
|
540
|
-
@udf()
|
|
541
|
-
def to_lower(x):
|
|
542
|
-
if x is not None:
|
|
543
|
-
return x.lower()
|
|
544
|
-
|
|
545
|
-
@udf
|
|
546
|
-
def substr(x, start, end):
|
|
547
|
-
if x is not None:
|
|
548
|
-
return x[start:end]
|
|
549
|
-
|
|
550
|
-
@udf("long")
|
|
551
|
-
def trunc(x):
|
|
552
|
-
return int(x)
|
|
553
|
-
|
|
554
|
-
@udf(returnType="double")
|
|
555
|
-
def as_double(x):
|
|
556
|
-
return float(x)
|
|
557
|
-
|
|
558
|
-
df = self.spark.createDataFrame(
|
|
559
|
-
[(1, "Foo", "foobar", 3.0)], ("one", "Foo", "foobar", "float")
|
|
560
|
-
).select(
|
|
561
|
-
add_one("one"),
|
|
562
|
-
add_two("one"),
|
|
563
|
-
to_upper("Foo"),
|
|
564
|
-
to_lower("Foo"),
|
|
565
|
-
substr("foobar", lit(0), lit(3)),
|
|
566
|
-
trunc("float"),
|
|
567
|
-
as_double("one"),
|
|
568
|
-
)
|
|
569
|
-
|
|
570
|
-
self.assertListEqual(
|
|
571
|
-
[tpe for _, tpe in df.dtypes],
|
|
572
|
-
["int", "double", "string", "string", "string", "bigint", "double"],
|
|
573
|
-
)
|
|
574
|
-
|
|
575
|
-
self.assertListEqual(list(df.first()), [2, 3.0, "FOO", "foo", "foo", 3, 1.0])
|
|
576
|
-
|
|
577
|
-
def test_udf_wrapper(self):
|
|
578
|
-
def f(x):
|
|
579
|
-
"""Identity"""
|
|
580
|
-
return x
|
|
581
|
-
|
|
582
|
-
return_type = IntegerType()
|
|
583
|
-
f_ = udf(f, return_type)
|
|
584
|
-
|
|
585
|
-
self.assertTrue(f.__doc__ in f_.__doc__)
|
|
586
|
-
self.assertEqual(f, f_.func)
|
|
587
|
-
self.assertEqual(return_type, f_.returnType)
|
|
588
|
-
|
|
589
|
-
class F:
|
|
590
|
-
"""Identity"""
|
|
591
|
-
|
|
592
|
-
def __call__(self, x):
|
|
593
|
-
return x
|
|
594
|
-
|
|
595
|
-
f = F()
|
|
596
|
-
return_type = IntegerType()
|
|
597
|
-
f_ = udf(f, return_type)
|
|
598
|
-
|
|
599
|
-
self.assertTrue(f.__doc__ in f_.__doc__)
|
|
600
|
-
self.assertEqual(f, f_.func)
|
|
601
|
-
self.assertEqual(return_type, f_.returnType)
|
|
602
|
-
|
|
603
|
-
f = functools.partial(f, x=1)
|
|
604
|
-
return_type = IntegerType()
|
|
605
|
-
f_ = udf(f, return_type)
|
|
606
|
-
|
|
607
|
-
self.assertTrue(f.__doc__ in f_.__doc__)
|
|
608
|
-
self.assertEqual(f, f_.func)
|
|
609
|
-
self.assertEqual(return_type, f_.returnType)
|
|
610
|
-
|
|
611
|
-
def test_udf_timestamp_ntz(self):
|
|
612
|
-
# SPARK-36626: Test TimestampNTZ in Python UDF
|
|
613
|
-
@udf(TimestampNTZType())
|
|
614
|
-
def noop(x):
|
|
615
|
-
assert x == datetime.datetime(1970, 1, 1, 0, 0)
|
|
616
|
-
return x
|
|
617
|
-
|
|
618
|
-
with self.sql_conf({"spark.sql.session.timeZone": "Pacific/Honolulu"}):
|
|
619
|
-
df = self.spark.createDataFrame(
|
|
620
|
-
[(datetime.datetime(1970, 1, 1, 0, 0),)], schema="dt timestamp_ntz"
|
|
621
|
-
).select(noop("dt").alias("dt"))
|
|
622
|
-
|
|
623
|
-
df.selectExpr("assert_true('1970-01-01 00:00:00' == CAST(dt AS STRING))").collect()
|
|
624
|
-
self.assertEqual(df.schema[0].dataType.typeName(), "timestamp_ntz")
|
|
625
|
-
self.assertEqual(df.first()[0], datetime.datetime(1970, 1, 1, 0, 0))
|
|
626
|
-
|
|
627
|
-
def test_udf_daytime_interval(self):
|
|
628
|
-
# SPARK-37277: Support DayTimeIntervalType in Python UDF
|
|
629
|
-
@udf(DayTimeIntervalType(DayTimeIntervalType.DAY, DayTimeIntervalType.SECOND))
|
|
630
|
-
def noop(x):
|
|
631
|
-
assert x == datetime.timedelta(microseconds=123)
|
|
632
|
-
return x
|
|
633
|
-
|
|
634
|
-
df = self.spark.createDataFrame(
|
|
635
|
-
[(datetime.timedelta(microseconds=123),)], schema="td interval day to second"
|
|
636
|
-
).select(noop("td").alias("td"))
|
|
637
|
-
|
|
638
|
-
df.select(
|
|
639
|
-
assert_true(lit("INTERVAL '0 00:00:00.000123' DAY TO SECOND") == df.td.cast("string"))
|
|
640
|
-
).collect()
|
|
641
|
-
self.assertEqual(df.schema[0].dataType.simpleString(), "interval day to second")
|
|
642
|
-
self.assertEqual(df.first()[0], datetime.timedelta(microseconds=123))
|
|
643
|
-
|
|
644
|
-
def test_nonparam_udf_with_aggregate(self):
|
|
645
|
-
import pyspark.sql.functions as f
|
|
646
|
-
|
|
647
|
-
df = self.spark.createDataFrame([(1, 2), (1, 2)])
|
|
648
|
-
f_udf = f.udf(lambda: "const_str")
|
|
649
|
-
rows = df.distinct().withColumn("a", f_udf()).collect()
|
|
650
|
-
self.assertEqual(rows, [Row(_1=1, _2=2, a="const_str")])
|
|
651
|
-
|
|
652
|
-
# SPARK-24721
|
|
653
|
-
@unittest.skipIf(not test_compiled, test_not_compiled_message) # type: ignore
|
|
654
|
-
def test_datasource_with_udf(self):
|
|
655
|
-
from pyspark.sql.functions import lit, col
|
|
656
|
-
|
|
657
|
-
path = tempfile.mkdtemp()
|
|
658
|
-
shutil.rmtree(path)
|
|
659
|
-
|
|
660
|
-
try:
|
|
661
|
-
self.spark.range(1).write.mode("overwrite").format("csv").save(path)
|
|
662
|
-
filesource_df = self.spark.read.option("inferSchema", True).csv(path).toDF("i")
|
|
663
|
-
datasource_df = (
|
|
664
|
-
self.spark.read.format("org.apache.spark.sql.sources.SimpleScanSource")
|
|
665
|
-
.option("from", 0)
|
|
666
|
-
.option("to", 1)
|
|
667
|
-
.load()
|
|
668
|
-
.toDF("i")
|
|
669
|
-
)
|
|
670
|
-
datasource_v2_df = (
|
|
671
|
-
self.spark.read.format("org.apache.spark.sql.connector.SimpleDataSourceV2")
|
|
672
|
-
.load()
|
|
673
|
-
.toDF("i", "j")
|
|
674
|
-
)
|
|
675
|
-
|
|
676
|
-
c1 = udf(lambda x: x + 1, "int")(lit(1))
|
|
677
|
-
c2 = udf(lambda x: x + 1, "int")(col("i"))
|
|
678
|
-
|
|
679
|
-
f1 = udf(lambda x: False, "boolean")(lit(1))
|
|
680
|
-
f2 = udf(lambda x: False, "boolean")(col("i"))
|
|
681
|
-
|
|
682
|
-
for df in [filesource_df, datasource_df, datasource_v2_df]:
|
|
683
|
-
result = df.withColumn("c", c1)
|
|
684
|
-
expected = df.withColumn("c", lit(2))
|
|
685
|
-
self.assertEqual(expected.collect(), result.collect())
|
|
686
|
-
|
|
687
|
-
for df in [filesource_df, datasource_df, datasource_v2_df]:
|
|
688
|
-
result = df.withColumn("c", c2)
|
|
689
|
-
expected = df.withColumn("c", col("i") + 1)
|
|
690
|
-
self.assertEqual(expected.collect(), result.collect())
|
|
691
|
-
|
|
692
|
-
for df in [filesource_df, datasource_df, datasource_v2_df]:
|
|
693
|
-
for f in [f1, f2]:
|
|
694
|
-
result = df.filter(f)
|
|
695
|
-
self.assertEqual(0, result.count())
|
|
696
|
-
finally:
|
|
697
|
-
shutil.rmtree(path)
|
|
698
|
-
|
|
699
|
-
# SPARK-42134
|
|
700
|
-
def test_file_dsv2_with_udf_filter(self):
|
|
701
|
-
from pyspark.sql.functions import lit
|
|
702
|
-
|
|
703
|
-
path = tempfile.mkdtemp()
|
|
704
|
-
shutil.rmtree(path)
|
|
705
|
-
|
|
706
|
-
try:
|
|
707
|
-
with self.sql_conf({"spark.sql.sources.useV1SourceList": ""}):
|
|
708
|
-
self.spark.range(1).write.mode("overwrite").format("parquet").save(path)
|
|
709
|
-
df = self.spark.read.parquet(path).toDF("i")
|
|
710
|
-
f = udf(lambda x: False, "boolean")(lit(1))
|
|
711
|
-
result = df.filter(f)
|
|
712
|
-
self.assertEqual(0, result.count())
|
|
713
|
-
|
|
714
|
-
finally:
|
|
715
|
-
shutil.rmtree(path)
|
|
716
|
-
|
|
717
|
-
# SPARK-25591
|
|
718
|
-
def test_same_accumulator_in_udfs(self):
|
|
719
|
-
data_schema = StructType(
|
|
720
|
-
[StructField("a", IntegerType(), True), StructField("b", IntegerType(), True)]
|
|
721
|
-
)
|
|
722
|
-
data = self.spark.createDataFrame([[1, 2]], schema=data_schema)
|
|
723
|
-
|
|
724
|
-
test_accum = self.sc.accumulator(0)
|
|
725
|
-
|
|
726
|
-
def first_udf(x):
|
|
727
|
-
test_accum.add(1)
|
|
728
|
-
return x
|
|
729
|
-
|
|
730
|
-
def second_udf(x):
|
|
731
|
-
test_accum.add(100)
|
|
732
|
-
return x
|
|
733
|
-
|
|
734
|
-
func_udf = udf(first_udf, IntegerType())
|
|
735
|
-
func_udf2 = udf(second_udf, IntegerType())
|
|
736
|
-
data = data.withColumn("out1", func_udf(data["a"]))
|
|
737
|
-
data = data.withColumn("out2", func_udf2(data["b"]))
|
|
738
|
-
data.collect()
|
|
739
|
-
self.assertEqual(test_accum.value, 101)
|
|
740
|
-
|
|
741
|
-
# SPARK-26293
|
|
742
|
-
def test_udf_in_subquery(self):
|
|
743
|
-
f = udf(lambda x: x, "long")
|
|
744
|
-
with self.tempView("v"):
|
|
745
|
-
self.spark.range(1).filter(f("id") >= 0).createTempView("v")
|
|
746
|
-
result = self.spark.sql(
|
|
747
|
-
"select i from values(0L) as data(i) where i in (select id from v)"
|
|
748
|
-
)
|
|
749
|
-
self.assertEqual(result.collect(), [Row(i=0)])
|
|
750
|
-
|
|
751
|
-
def test_udf_globals_not_overwritten(self):
|
|
752
|
-
@udf("string")
|
|
753
|
-
def f():
|
|
754
|
-
assert "itertools" not in str(map)
|
|
755
|
-
|
|
756
|
-
self.spark.range(1).select(f()).collect()
|
|
757
|
-
|
|
758
|
-
def test_worker_original_stdin_closed(self):
|
|
759
|
-
# Test if it closes the original standard input of worker inherited from the daemon,
|
|
760
|
-
# and replaces it with '/dev/null'. See SPARK-26175.
|
|
761
|
-
def task(iterator):
|
|
762
|
-
import sys
|
|
763
|
-
|
|
764
|
-
res = sys.stdin.read()
|
|
765
|
-
# Because the standard input is '/dev/null', it reaches to EOF.
|
|
766
|
-
assert res == "", "Expect read EOF from stdin."
|
|
767
|
-
return iterator
|
|
768
|
-
|
|
769
|
-
self.sc.parallelize(range(1), 1).mapPartitions(task).count()
|
|
770
|
-
|
|
771
|
-
def test_udf_with_256_args(self):
|
|
772
|
-
N = 256
|
|
773
|
-
data = [["data-%d" % i for i in range(N)]] * 5
|
|
774
|
-
df = self.spark.createDataFrame(data)
|
|
775
|
-
|
|
776
|
-
def f(*a):
|
|
777
|
-
return "success"
|
|
778
|
-
|
|
779
|
-
fUdf = udf(f, StringType())
|
|
780
|
-
|
|
781
|
-
r = df.select(fUdf(*df.columns))
|
|
782
|
-
self.assertEqual(r.first()[0], "success")
|
|
783
|
-
|
|
784
|
-
def test_udf_cache(self):
|
|
785
|
-
def func(x):
|
|
786
|
-
return x
|
|
787
|
-
|
|
788
|
-
df = self.spark.range(1)
|
|
789
|
-
df.select(udf(func)("id")).cache()
|
|
790
|
-
|
|
791
|
-
self.assertEqual(
|
|
792
|
-
df.select(udf(func)("id"))
|
|
793
|
-
._jdf.queryExecution()
|
|
794
|
-
.withCachedData()
|
|
795
|
-
.getClass()
|
|
796
|
-
.getSimpleName(),
|
|
797
|
-
"InMemoryRelation",
|
|
798
|
-
)
|
|
799
|
-
|
|
800
|
-
# SPARK-34545
|
|
801
|
-
def test_udf_input_serialization_valuecompare_disabled(self):
|
|
802
|
-
def f(e):
|
|
803
|
-
return e[0]
|
|
804
|
-
|
|
805
|
-
df = self.spark.createDataFrame([((1.0, 1.0), (1, 1))], ["c1", "c2"])
|
|
806
|
-
result = df.select(
|
|
807
|
-
"*", udf(f, DoubleType())("c1").alias("c3"), udf(f, IntegerType())("c2").alias("c4")
|
|
808
|
-
)
|
|
809
|
-
self.assertEqual(
|
|
810
|
-
result.collect(), [Row(c1=Row(_1=1.0, _2=1.0), c2=Row(_1=1, _2=1), c3=1.0, c4=1)]
|
|
811
|
-
)
|
|
812
|
-
|
|
813
|
-
# SPARK-33277
|
|
814
|
-
def test_udf_with_column_vector(self):
|
|
815
|
-
path = tempfile.mkdtemp()
|
|
816
|
-
shutil.rmtree(path)
|
|
817
|
-
|
|
818
|
-
try:
|
|
819
|
-
self.spark.range(0, 100000, 1, 1).write.parquet(path)
|
|
820
|
-
|
|
821
|
-
def f(x):
|
|
822
|
-
return 0
|
|
823
|
-
|
|
824
|
-
fUdf = udf(f, LongType())
|
|
825
|
-
|
|
826
|
-
for offheap in ["true", "false"]:
|
|
827
|
-
with self.sql_conf({"spark.sql.columnVector.offheap.enabled": offheap}):
|
|
828
|
-
self.assertEquals(
|
|
829
|
-
self.spark.read.parquet(path).select(fUdf("id")).head(), Row(0)
|
|
830
|
-
)
|
|
831
|
-
finally:
|
|
832
|
-
shutil.rmtree(path)
|
|
833
|
-
|
|
834
|
-
def test_udf_with_rand(self):
|
|
835
|
-
# SPARK-40121: rand() with Python UDF.
|
|
836
|
-
self.assertEqual(
|
|
837
|
-
len(self.spark.range(10).select(udf(lambda x: x, DoubleType())(rand())).collect()), 10
|
|
838
|
-
)
|
|
839
|
-
|
|
840
|
-
def test_nested_struct(self):
|
|
841
|
-
df = self.spark.range(1).selectExpr(
|
|
842
|
-
"struct(1, struct('John', 30, ('value', 10))) as nested_struct"
|
|
843
|
-
)
|
|
844
|
-
# Input
|
|
845
|
-
row = df.select(udf(lambda x: str(x))("nested_struct")).first()
|
|
846
|
-
self.assertEquals(
|
|
847
|
-
row[0], "Row(col1=1, col2=Row(col1='John', col2=30, col3=Row(col1='value', col2=10)))"
|
|
848
|
-
)
|
|
849
|
-
# Output
|
|
850
|
-
row = df.select(udf(lambda x: x, returnType=df.dtypes[0][1])("nested_struct")).first()
|
|
851
|
-
self.assertEquals(
|
|
852
|
-
row[0], Row(col1=1, col2=Row(col1="John", col2=30, col3=Row(col1="value", col2=10)))
|
|
853
|
-
)
|
|
854
|
-
|
|
855
|
-
def test_nested_map(self):
|
|
856
|
-
df = self.spark.range(1).selectExpr("map('a', map('b', 'c')) as nested_map")
|
|
857
|
-
# Input
|
|
858
|
-
row = df.select(udf(lambda x: str(x))("nested_map")).first()
|
|
859
|
-
self.assertEquals(row[0], "{'a': {'b': 'c'}}")
|
|
860
|
-
# Output
|
|
861
|
-
|
|
862
|
-
@udf(returnType=df.dtypes[0][1])
|
|
863
|
-
def f(x):
|
|
864
|
-
x["a"]["b"] = "d"
|
|
865
|
-
return x
|
|
866
|
-
|
|
867
|
-
row = df.select(f("nested_map")).first()
|
|
868
|
-
self.assertEquals(row[0], {"a": {"b": "d"}})
|
|
869
|
-
|
|
870
|
-
def test_nested_array(self):
|
|
871
|
-
df = self.spark.range(1).selectExpr("array(array(1, 2), array(3, 4)) as nested_array")
|
|
872
|
-
# Input
|
|
873
|
-
row = df.select(udf(lambda x: str(x))("nested_array")).first()
|
|
874
|
-
self.assertEquals(row[0], "[[1, 2], [3, 4]]")
|
|
875
|
-
# Output
|
|
876
|
-
|
|
877
|
-
@udf(returnType=df.dtypes[0][1])
|
|
878
|
-
def f(x):
|
|
879
|
-
x.append([4, 5])
|
|
880
|
-
return x
|
|
881
|
-
|
|
882
|
-
row = df.select(f("nested_array")).first()
|
|
883
|
-
self.assertEquals(row[0], [[1, 2], [3, 4], [4, 5]])
|
|
884
|
-
|
|
885
|
-
def test_complex_return_types(self):
|
|
886
|
-
row = (
|
|
887
|
-
self.spark.range(1)
|
|
888
|
-
.selectExpr("array(1, 2, 3) as array", "map('a', 'b') as map", "struct(1, 2) as struct")
|
|
889
|
-
.select(
|
|
890
|
-
udf(lambda x: x, "array<int>")("array"),
|
|
891
|
-
udf(lambda x: x, "map<string,string>")("map"),
|
|
892
|
-
udf(lambda x: x, "struct<col1:int,col2:int>")("struct"),
|
|
893
|
-
)
|
|
894
|
-
.first()
|
|
895
|
-
)
|
|
896
|
-
|
|
897
|
-
self.assertEquals(row[0], [1, 2, 3])
|
|
898
|
-
self.assertEquals(row[1], {"a": "b"})
|
|
899
|
-
self.assertEquals(row[2], Row(col1=1, col2=2))
|
|
900
|
-
|
|
901
|
-
def test_raise_stop_iteration(self):
|
|
902
|
-
@udf("int")
|
|
903
|
-
def test_udf(a):
|
|
904
|
-
if a < 5:
|
|
905
|
-
return a
|
|
906
|
-
else:
|
|
907
|
-
raise StopIteration()
|
|
908
|
-
|
|
909
|
-
assertDataFrameEqual(
|
|
910
|
-
self.spark.range(5).select(test_udf(col("id"))), [Row(i) for i in range(5)]
|
|
911
|
-
)
|
|
912
|
-
|
|
913
|
-
with self.assertRaisesRegex(PythonException, "StopIteration"):
|
|
914
|
-
self.spark.range(10).select(test_udf(col("id"))).show()
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
class UDFTests(BaseUDFTestsMixin, ReusedSQLTestCase):
|
|
918
|
-
@classmethod
|
|
919
|
-
def setUpClass(cls):
|
|
920
|
-
super(BaseUDFTestsMixin, cls).setUpClass()
|
|
921
|
-
cls.spark.conf.set("spark.sql.execution.pythonUDF.arrow.enabled", "false")
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
class UDFInitializationTests(unittest.TestCase):
|
|
925
|
-
def tearDown(self):
|
|
926
|
-
if SparkSession._instantiatedSession is not None:
|
|
927
|
-
SparkSession._instantiatedSession.stop()
|
|
928
|
-
|
|
929
|
-
if SparkContext._active_spark_context is not None:
|
|
930
|
-
SparkContext._active_spark_context.stop()
|
|
931
|
-
|
|
932
|
-
def test_udf_init_should_not_initialize_context(self):
|
|
933
|
-
UserDefinedFunction(lambda x: x, StringType())
|
|
934
|
-
|
|
935
|
-
self.assertIsNone(
|
|
936
|
-
SparkContext._active_spark_context,
|
|
937
|
-
"SparkContext shouldn't be initialized when UserDefinedFunction is created.",
|
|
938
|
-
)
|
|
939
|
-
self.assertIsNone(
|
|
940
|
-
SparkSession._instantiatedSession,
|
|
941
|
-
"SparkSession shouldn't be initialized when UserDefinedFunction is created.",
|
|
942
|
-
)
|
|
943
|
-
|
|
944
|
-
def test_err_parse_type_when_no_sc(self):
|
|
945
|
-
with self.assertRaisesRegex(
|
|
946
|
-
RuntimeError,
|
|
947
|
-
"SparkContext or SparkSession should be created first",
|
|
948
|
-
):
|
|
949
|
-
udf(lambda x: x, "integer")
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
if __name__ == "__main__":
|
|
953
|
-
from pyspark.sql.tests.test_udf import * # noqa: F401
|
|
954
|
-
|
|
955
|
-
try:
|
|
956
|
-
import xmlrunner # type: ignore
|
|
957
|
-
|
|
958
|
-
testRunner = xmlrunner.XMLTestRunner(output="target/test-reports", verbosity=2)
|
|
959
|
-
except ImportError:
|
|
960
|
-
testRunner = None
|
|
961
|
-
unittest.main(testRunner=testRunner, verbosity=2)
|