snowpark-connect 0.20.2__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/__init__.py +23 -0
- snowflake/snowpark_connect/analyze_plan/__init__.py +3 -0
- snowflake/snowpark_connect/analyze_plan/map_tree_string.py +38 -0
- snowflake/snowpark_connect/column_name_handler.py +735 -0
- snowflake/snowpark_connect/config.py +576 -0
- snowflake/snowpark_connect/constants.py +47 -0
- snowflake/snowpark_connect/control_server.py +52 -0
- snowflake/snowpark_connect/dataframe_name_handler.py +54 -0
- snowflake/snowpark_connect/date_time_format_mapping.py +399 -0
- snowflake/snowpark_connect/empty_dataframe.py +18 -0
- snowflake/snowpark_connect/error/__init__.py +11 -0
- snowflake/snowpark_connect/error/error_mapping.py +6174 -0
- snowflake/snowpark_connect/error/error_utils.py +321 -0
- snowflake/snowpark_connect/error/exceptions.py +24 -0
- snowflake/snowpark_connect/execute_plan/__init__.py +3 -0
- snowflake/snowpark_connect/execute_plan/map_execution_command.py +204 -0
- snowflake/snowpark_connect/execute_plan/map_execution_root.py +173 -0
- snowflake/snowpark_connect/execute_plan/utils.py +183 -0
- snowflake/snowpark_connect/expression/__init__.py +3 -0
- snowflake/snowpark_connect/expression/literal.py +90 -0
- snowflake/snowpark_connect/expression/map_cast.py +343 -0
- snowflake/snowpark_connect/expression/map_expression.py +293 -0
- snowflake/snowpark_connect/expression/map_extension.py +104 -0
- snowflake/snowpark_connect/expression/map_sql_expression.py +633 -0
- snowflake/snowpark_connect/expression/map_udf.py +142 -0
- snowflake/snowpark_connect/expression/map_unresolved_attribute.py +241 -0
- snowflake/snowpark_connect/expression/map_unresolved_extract_value.py +85 -0
- snowflake/snowpark_connect/expression/map_unresolved_function.py +9450 -0
- snowflake/snowpark_connect/expression/map_unresolved_star.py +218 -0
- snowflake/snowpark_connect/expression/map_update_fields.py +164 -0
- snowflake/snowpark_connect/expression/map_window_function.py +258 -0
- snowflake/snowpark_connect/expression/typer.py +125 -0
- snowflake/snowpark_connect/includes/__init__.py +0 -0
- snowflake/snowpark_connect/includes/jars/antlr4-runtime-4.9.3.jar +0 -0
- snowflake/snowpark_connect/includes/jars/commons-cli-1.5.0.jar +0 -0
- snowflake/snowpark_connect/includes/jars/commons-codec-1.16.1.jar +0 -0
- snowflake/snowpark_connect/includes/jars/commons-collections-3.2.2.jar +0 -0
- snowflake/snowpark_connect/includes/jars/commons-collections4-4.4.jar +0 -0
- snowflake/snowpark_connect/includes/jars/commons-compiler-3.1.9.jar +0 -0
- snowflake/snowpark_connect/includes/jars/commons-compress-1.26.0.jar +0 -0
- snowflake/snowpark_connect/includes/jars/commons-crypto-1.1.0.jar +0 -0
- snowflake/snowpark_connect/includes/jars/commons-dbcp-1.4.jar +0 -0
- snowflake/snowpark_connect/includes/jars/commons-io-2.16.1.jar +0 -0
- snowflake/snowpark_connect/includes/jars/commons-lang-2.6.jar +0 -0
- snowflake/snowpark_connect/includes/jars/commons-lang3-3.12.0.jar +0 -0
- snowflake/snowpark_connect/includes/jars/commons-logging-1.1.3.jar +0 -0
- snowflake/snowpark_connect/includes/jars/commons-math3-3.6.1.jar +0 -0
- snowflake/snowpark_connect/includes/jars/commons-pool-1.5.4.jar +0 -0
- snowflake/snowpark_connect/includes/jars/commons-text-1.10.0.jar +0 -0
- snowflake/snowpark_connect/includes/jars/hadoop-client-api-3.3.4.jar +0 -0
- snowflake/snowpark_connect/includes/jars/jackson-annotations-2.15.2.jar +0 -0
- snowflake/snowpark_connect/includes/jars/jackson-core-2.15.2.jar +0 -0
- snowflake/snowpark_connect/includes/jars/jackson-core-asl-1.9.13.jar +0 -0
- snowflake/snowpark_connect/includes/jars/jackson-databind-2.15.2.jar +0 -0
- snowflake/snowpark_connect/includes/jars/jackson-dataformat-yaml-2.15.2.jar +0 -0
- snowflake/snowpark_connect/includes/jars/jackson-datatype-jsr310-2.15.2.jar +0 -0
- snowflake/snowpark_connect/includes/jars/jackson-mapper-asl-1.9.13.jar +0 -0
- snowflake/snowpark_connect/includes/jars/jackson-module-scala_2.12-2.15.2.jar +0 -0
- snowflake/snowpark_connect/includes/jars/json4s-ast_2.12-3.7.0-M11.jar +0 -0
- snowflake/snowpark_connect/includes/jars/json4s-core_2.12-3.7.0-M11.jar +0 -0
- snowflake/snowpark_connect/includes/jars/json4s-jackson_2.12-3.7.0-M11.jar +0 -0
- snowflake/snowpark_connect/includes/jars/json4s-scalap_2.12-3.7.0-M11.jar +0 -0
- snowflake/snowpark_connect/includes/jars/kryo-shaded-4.0.2.jar +0 -0
- snowflake/snowpark_connect/includes/jars/log4j-1.2-api-2.20.0.jar +0 -0
- snowflake/snowpark_connect/includes/jars/log4j-api-2.20.0.jar +0 -0
- snowflake/snowpark_connect/includes/jars/log4j-core-2.20.0.jar +0 -0
- snowflake/snowpark_connect/includes/jars/log4j-slf4j2-impl-2.20.0.jar +0 -0
- snowflake/snowpark_connect/includes/jars/paranamer-2.8.jar +0 -0
- snowflake/snowpark_connect/includes/jars/scala-collection-compat_2.12-2.7.0.jar +0 -0
- snowflake/snowpark_connect/includes/jars/scala-compiler-2.12.18.jar +0 -0
- snowflake/snowpark_connect/includes/jars/scala-library-2.12.18.jar +0 -0
- snowflake/snowpark_connect/includes/jars/scala-parser-combinators_2.12-2.3.0.jar +0 -0
- snowflake/snowpark_connect/includes/jars/scala-reflect-2.12.18.jar +0 -0
- snowflake/snowpark_connect/includes/jars/scala-xml_2.12-2.1.0.jar +0 -0
- snowflake/snowpark_connect/includes/jars/slf4j-api-2.0.7.jar +0 -0
- snowflake/snowpark_connect/includes/jars/spark-catalyst_2.12-3.5.6.jar +0 -0
- snowflake/snowpark_connect/includes/jars/spark-common-utils_2.12-3.5.6.jar +0 -0
- snowflake/snowpark_connect/includes/jars/spark-core_2.12-3.5.6.jar +0 -0
- snowflake/snowpark_connect/includes/jars/spark-graphx_2.12-3.5.6.jar +0 -0
- snowflake/snowpark_connect/includes/jars/spark-hive-thriftserver_2.12-3.5.6.jar +0 -0
- snowflake/snowpark_connect/includes/jars/spark-hive_2.12-3.5.6.jar +0 -0
- snowflake/snowpark_connect/includes/jars/spark-kubernetes_2.12-3.5.6.jar +0 -0
- snowflake/snowpark_connect/includes/jars/spark-kvstore_2.12-3.5.6.jar +0 -0
- snowflake/snowpark_connect/includes/jars/spark-launcher_2.12-3.5.6.jar +0 -0
- snowflake/snowpark_connect/includes/jars/spark-mesos_2.12-3.5.6.jar +0 -0
- snowflake/snowpark_connect/includes/jars/spark-mllib-local_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-network-common_2.12-3.5.6.jar +0 -0
- snowflake/snowpark_connect/includes/jars/spark-network-shuffle_2.12-3.5.6.jar +0 -0
- snowflake/snowpark_connect/includes/jars/spark-repl_2.12-3.5.6.jar +0 -0
- snowflake/snowpark_connect/includes/jars/spark-sketch_2.12-3.5.6.jar +0 -0
- snowflake/snowpark_connect/includes/jars/spark-sql-api_2.12-3.5.6.jar +0 -0
- snowflake/snowpark_connect/includes/jars/spark-sql_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/jars/spark-tags_2.12-3.5.6.jar +0 -0
- snowflake/snowpark_connect/includes/jars/spark-unsafe_2.12-3.5.6.jar +0 -0
- snowflake/snowpark_connect/includes/jars/spark-yarn_2.12-3.5.6.jar +0 -0
- snowflake/snowpark_connect/includes/python/__init__.py +21 -0
- snowflake/snowpark_connect/includes/python/pyspark/__init__.py +173 -0
- snowflake/snowpark_connect/includes/python/pyspark/_globals.py +71 -0
- snowflake/snowpark_connect/includes/python/pyspark/_typing.pyi +43 -0
- snowflake/snowpark_connect/includes/python/pyspark/accumulators.py +341 -0
- snowflake/snowpark_connect/includes/python/pyspark/broadcast.py +383 -0
- snowflake/snowpark_connect/includes/python/pyspark/cloudpickle/__init__.py +8 -0
- snowflake/snowpark_connect/includes/python/pyspark/cloudpickle/cloudpickle.py +948 -0
- snowflake/snowpark_connect/includes/python/pyspark/cloudpickle/cloudpickle_fast.py +844 -0
- snowflake/snowpark_connect/includes/python/pyspark/cloudpickle/compat.py +18 -0
- snowflake/snowpark_connect/includes/python/pyspark/conf.py +276 -0
- snowflake/snowpark_connect/includes/python/pyspark/context.py +2601 -0
- snowflake/snowpark_connect/includes/python/pyspark/daemon.py +218 -0
- snowflake/snowpark_connect/includes/python/pyspark/errors/__init__.py +70 -0
- snowflake/snowpark_connect/includes/python/pyspark/errors/error_classes.py +889 -0
- snowflake/snowpark_connect/includes/python/pyspark/errors/exceptions/__init__.py +16 -0
- snowflake/snowpark_connect/includes/python/pyspark/errors/exceptions/base.py +228 -0
- snowflake/snowpark_connect/includes/python/pyspark/errors/exceptions/captured.py +307 -0
- snowflake/snowpark_connect/includes/python/pyspark/errors/exceptions/connect.py +190 -0
- snowflake/snowpark_connect/includes/python/pyspark/errors/tests/__init__.py +16 -0
- snowflake/snowpark_connect/includes/python/pyspark/errors/tests/test_errors.py +60 -0
- snowflake/snowpark_connect/includes/python/pyspark/errors/utils.py +116 -0
- snowflake/snowpark_connect/includes/python/pyspark/files.py +165 -0
- snowflake/snowpark_connect/includes/python/pyspark/find_spark_home.py +95 -0
- snowflake/snowpark_connect/includes/python/pyspark/install.py +203 -0
- snowflake/snowpark_connect/includes/python/pyspark/instrumentation_utils.py +190 -0
- snowflake/snowpark_connect/includes/python/pyspark/java_gateway.py +248 -0
- snowflake/snowpark_connect/includes/python/pyspark/join.py +118 -0
- snowflake/snowpark_connect/includes/python/pyspark/ml/__init__.py +71 -0
- snowflake/snowpark_connect/includes/python/pyspark/ml/_typing.pyi +84 -0
- snowflake/snowpark_connect/includes/python/pyspark/ml/base.py +414 -0
- snowflake/snowpark_connect/includes/python/pyspark/ml/classification.py +4332 -0
- snowflake/snowpark_connect/includes/python/pyspark/ml/clustering.py +2188 -0
- snowflake/snowpark_connect/includes/python/pyspark/ml/common.py +146 -0
- snowflake/snowpark_connect/includes/python/pyspark/ml/connect/__init__.py +44 -0
- snowflake/snowpark_connect/includes/python/pyspark/ml/connect/base.py +346 -0
- snowflake/snowpark_connect/includes/python/pyspark/ml/connect/classification.py +382 -0
- snowflake/snowpark_connect/includes/python/pyspark/ml/connect/evaluation.py +291 -0
- snowflake/snowpark_connect/includes/python/pyspark/ml/connect/feature.py +258 -0
- snowflake/snowpark_connect/includes/python/pyspark/ml/connect/functions.py +77 -0
- snowflake/snowpark_connect/includes/python/pyspark/ml/connect/io_utils.py +335 -0
- snowflake/snowpark_connect/includes/python/pyspark/ml/connect/pipeline.py +262 -0
- snowflake/snowpark_connect/includes/python/pyspark/ml/connect/summarizer.py +120 -0
- snowflake/snowpark_connect/includes/python/pyspark/ml/connect/tuning.py +579 -0
- snowflake/snowpark_connect/includes/python/pyspark/ml/connect/util.py +173 -0
- snowflake/snowpark_connect/includes/python/pyspark/ml/deepspeed/__init__.py +16 -0
- snowflake/snowpark_connect/includes/python/pyspark/ml/deepspeed/deepspeed_distributor.py +165 -0
- snowflake/snowpark_connect/includes/python/pyspark/ml/deepspeed/tests/test_deepspeed_distributor.py +306 -0
- snowflake/snowpark_connect/includes/python/pyspark/ml/dl_util.py +150 -0
- snowflake/snowpark_connect/includes/python/pyspark/ml/evaluation.py +1166 -0
- snowflake/snowpark_connect/includes/python/pyspark/ml/feature.py +7474 -0
- snowflake/snowpark_connect/includes/python/pyspark/ml/fpm.py +543 -0
- snowflake/snowpark_connect/includes/python/pyspark/ml/functions.py +842 -0
- snowflake/snowpark_connect/includes/python/pyspark/ml/image.py +271 -0
- snowflake/snowpark_connect/includes/python/pyspark/ml/linalg/__init__.py +1382 -0
- snowflake/snowpark_connect/includes/python/pyspark/ml/model_cache.py +55 -0
- snowflake/snowpark_connect/includes/python/pyspark/ml/param/__init__.py +602 -0
- snowflake/snowpark_connect/includes/python/pyspark/ml/param/_shared_params_code_gen.py +368 -0
- snowflake/snowpark_connect/includes/python/pyspark/ml/param/shared.py +878 -0
- snowflake/snowpark_connect/includes/python/pyspark/ml/pipeline.py +451 -0
- snowflake/snowpark_connect/includes/python/pyspark/ml/recommendation.py +748 -0
- snowflake/snowpark_connect/includes/python/pyspark/ml/regression.py +3335 -0
- snowflake/snowpark_connect/includes/python/pyspark/ml/stat.py +523 -0
- snowflake/snowpark_connect/includes/python/pyspark/ml/tests/__init__.py +16 -0
- snowflake/snowpark_connect/includes/python/pyspark/ml/tests/connect/test_connect_classification.py +53 -0
- snowflake/snowpark_connect/includes/python/pyspark/ml/tests/connect/test_connect_evaluation.py +50 -0
- snowflake/snowpark_connect/includes/python/pyspark/ml/tests/connect/test_connect_feature.py +43 -0
- snowflake/snowpark_connect/includes/python/pyspark/ml/tests/connect/test_connect_function.py +114 -0
- snowflake/snowpark_connect/includes/python/pyspark/ml/tests/connect/test_connect_pipeline.py +47 -0
- snowflake/snowpark_connect/includes/python/pyspark/ml/tests/connect/test_connect_summarizer.py +43 -0
- snowflake/snowpark_connect/includes/python/pyspark/ml/tests/connect/test_connect_tuning.py +46 -0
- snowflake/snowpark_connect/includes/python/pyspark/ml/tests/connect/test_legacy_mode_classification.py +238 -0
- snowflake/snowpark_connect/includes/python/pyspark/ml/tests/connect/test_legacy_mode_evaluation.py +194 -0
- snowflake/snowpark_connect/includes/python/pyspark/ml/tests/connect/test_legacy_mode_feature.py +156 -0
- snowflake/snowpark_connect/includes/python/pyspark/ml/tests/connect/test_legacy_mode_pipeline.py +184 -0
- snowflake/snowpark_connect/includes/python/pyspark/ml/tests/connect/test_legacy_mode_summarizer.py +78 -0
- snowflake/snowpark_connect/includes/python/pyspark/ml/tests/connect/test_legacy_mode_tuning.py +292 -0
- snowflake/snowpark_connect/includes/python/pyspark/ml/tests/connect/test_parity_torch_data_loader.py +50 -0
- snowflake/snowpark_connect/includes/python/pyspark/ml/tests/connect/test_parity_torch_distributor.py +152 -0
- snowflake/snowpark_connect/includes/python/pyspark/ml/tests/test_algorithms.py +456 -0
- snowflake/snowpark_connect/includes/python/pyspark/ml/tests/test_base.py +96 -0
- snowflake/snowpark_connect/includes/python/pyspark/ml/tests/test_dl_util.py +186 -0
- snowflake/snowpark_connect/includes/python/pyspark/ml/tests/test_evaluation.py +77 -0
- snowflake/snowpark_connect/includes/python/pyspark/ml/tests/test_feature.py +401 -0
- snowflake/snowpark_connect/includes/python/pyspark/ml/tests/test_functions.py +528 -0
- snowflake/snowpark_connect/includes/python/pyspark/ml/tests/test_image.py +82 -0
- snowflake/snowpark_connect/includes/python/pyspark/ml/tests/test_linalg.py +409 -0
- snowflake/snowpark_connect/includes/python/pyspark/ml/tests/test_model_cache.py +55 -0
- snowflake/snowpark_connect/includes/python/pyspark/ml/tests/test_param.py +441 -0
- snowflake/snowpark_connect/includes/python/pyspark/ml/tests/test_persistence.py +546 -0
- snowflake/snowpark_connect/includes/python/pyspark/ml/tests/test_pipeline.py +71 -0
- snowflake/snowpark_connect/includes/python/pyspark/ml/tests/test_stat.py +52 -0
- snowflake/snowpark_connect/includes/python/pyspark/ml/tests/test_training_summary.py +494 -0
- snowflake/snowpark_connect/includes/python/pyspark/ml/tests/test_util.py +85 -0
- snowflake/snowpark_connect/includes/python/pyspark/ml/tests/test_wrapper.py +138 -0
- snowflake/snowpark_connect/includes/python/pyspark/ml/tests/tuning/__init__.py +16 -0
- snowflake/snowpark_connect/includes/python/pyspark/ml/tests/tuning/test_cv_io_basic.py +151 -0
- snowflake/snowpark_connect/includes/python/pyspark/ml/tests/tuning/test_cv_io_nested.py +97 -0
- snowflake/snowpark_connect/includes/python/pyspark/ml/tests/tuning/test_cv_io_pipeline.py +143 -0
- snowflake/snowpark_connect/includes/python/pyspark/ml/tests/tuning/test_tuning.py +551 -0
- snowflake/snowpark_connect/includes/python/pyspark/ml/tests/tuning/test_tvs_io_basic.py +137 -0
- snowflake/snowpark_connect/includes/python/pyspark/ml/tests/tuning/test_tvs_io_nested.py +96 -0
- snowflake/snowpark_connect/includes/python/pyspark/ml/tests/tuning/test_tvs_io_pipeline.py +142 -0
- snowflake/snowpark_connect/includes/python/pyspark/ml/torch/__init__.py +16 -0
- snowflake/snowpark_connect/includes/python/pyspark/ml/torch/data.py +100 -0
- snowflake/snowpark_connect/includes/python/pyspark/ml/torch/distributor.py +1133 -0
- snowflake/snowpark_connect/includes/python/pyspark/ml/torch/log_communication.py +198 -0
- snowflake/snowpark_connect/includes/python/pyspark/ml/torch/tests/__init__.py +16 -0
- snowflake/snowpark_connect/includes/python/pyspark/ml/torch/tests/test_data_loader.py +137 -0
- snowflake/snowpark_connect/includes/python/pyspark/ml/torch/tests/test_distributor.py +561 -0
- snowflake/snowpark_connect/includes/python/pyspark/ml/torch/tests/test_log_communication.py +172 -0
- snowflake/snowpark_connect/includes/python/pyspark/ml/torch/torch_run_process_wrapper.py +83 -0
- snowflake/snowpark_connect/includes/python/pyspark/ml/tree.py +434 -0
- snowflake/snowpark_connect/includes/python/pyspark/ml/tuning.py +1741 -0
- snowflake/snowpark_connect/includes/python/pyspark/ml/util.py +749 -0
- snowflake/snowpark_connect/includes/python/pyspark/ml/wrapper.py +465 -0
- snowflake/snowpark_connect/includes/python/pyspark/mllib/__init__.py +44 -0
- snowflake/snowpark_connect/includes/python/pyspark/mllib/_typing.pyi +33 -0
- snowflake/snowpark_connect/includes/python/pyspark/mllib/classification.py +989 -0
- snowflake/snowpark_connect/includes/python/pyspark/mllib/clustering.py +1318 -0
- snowflake/snowpark_connect/includes/python/pyspark/mllib/common.py +174 -0
- snowflake/snowpark_connect/includes/python/pyspark/mllib/evaluation.py +691 -0
- snowflake/snowpark_connect/includes/python/pyspark/mllib/feature.py +1085 -0
- snowflake/snowpark_connect/includes/python/pyspark/mllib/fpm.py +233 -0
- snowflake/snowpark_connect/includes/python/pyspark/mllib/linalg/__init__.py +1653 -0
- snowflake/snowpark_connect/includes/python/pyspark/mllib/linalg/distributed.py +1662 -0
- snowflake/snowpark_connect/includes/python/pyspark/mllib/random.py +698 -0
- snowflake/snowpark_connect/includes/python/pyspark/mllib/recommendation.py +389 -0
- snowflake/snowpark_connect/includes/python/pyspark/mllib/regression.py +1067 -0
- snowflake/snowpark_connect/includes/python/pyspark/mllib/stat/KernelDensity.py +59 -0
- snowflake/snowpark_connect/includes/python/pyspark/mllib/stat/__init__.py +34 -0
- snowflake/snowpark_connect/includes/python/pyspark/mllib/stat/_statistics.py +409 -0
- snowflake/snowpark_connect/includes/python/pyspark/mllib/stat/distribution.py +39 -0
- snowflake/snowpark_connect/includes/python/pyspark/mllib/stat/test.py +86 -0
- snowflake/snowpark_connect/includes/python/pyspark/mllib/tests/__init__.py +16 -0
- snowflake/snowpark_connect/includes/python/pyspark/mllib/tests/test_algorithms.py +353 -0
- snowflake/snowpark_connect/includes/python/pyspark/mllib/tests/test_feature.py +192 -0
- snowflake/snowpark_connect/includes/python/pyspark/mllib/tests/test_linalg.py +680 -0
- snowflake/snowpark_connect/includes/python/pyspark/mllib/tests/test_stat.py +206 -0
- snowflake/snowpark_connect/includes/python/pyspark/mllib/tests/test_streaming_algorithms.py +471 -0
- snowflake/snowpark_connect/includes/python/pyspark/mllib/tests/test_util.py +108 -0
- snowflake/snowpark_connect/includes/python/pyspark/mllib/tree.py +888 -0
- snowflake/snowpark_connect/includes/python/pyspark/mllib/util.py +659 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/__init__.py +165 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/_typing.py +52 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/accessors.py +989 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/base.py +1804 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/categorical.py +822 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/config.py +539 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/correlation.py +262 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/data_type_ops/__init__.py +16 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/data_type_ops/base.py +519 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/data_type_ops/binary_ops.py +98 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/data_type_ops/boolean_ops.py +426 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/data_type_ops/categorical_ops.py +141 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/data_type_ops/complex_ops.py +145 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/data_type_ops/date_ops.py +127 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/data_type_ops/datetime_ops.py +171 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/data_type_ops/null_ops.py +83 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/data_type_ops/num_ops.py +588 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/data_type_ops/string_ops.py +154 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/data_type_ops/timedelta_ops.py +101 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/data_type_ops/udt_ops.py +29 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/datetimes.py +891 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/exceptions.py +150 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/extensions.py +388 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/frame.py +13738 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/generic.py +3560 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/groupby.py +4448 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/indexes/__init__.py +21 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/indexes/base.py +2783 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/indexes/category.py +773 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/indexes/datetimes.py +843 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/indexes/multi.py +1323 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/indexes/numeric.py +210 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/indexes/timedelta.py +197 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/indexing.py +1862 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/internal.py +1680 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/missing/__init__.py +48 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/missing/common.py +76 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/missing/frame.py +63 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/missing/general_functions.py +43 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/missing/groupby.py +93 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/missing/indexes.py +184 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/missing/resample.py +101 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/missing/scalars.py +29 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/missing/series.py +69 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/missing/window.py +168 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/mlflow.py +238 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/namespace.py +3807 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/numpy_compat.py +260 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/plot/__init__.py +17 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/plot/core.py +1213 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/plot/matplotlib.py +928 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/plot/plotly.py +261 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/resample.py +816 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/series.py +7440 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/sql_formatter.py +308 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/sql_processor.py +394 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/strings.py +2371 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/supported_api_gen.py +378 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/__init__.py +16 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/computation/__init__.py +16 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/computation/test_any_all.py +177 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/computation/test_apply_func.py +575 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/computation/test_binary_ops.py +235 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/computation/test_combine.py +653 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/computation/test_compute.py +463 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/computation/test_corrwith.py +86 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/computation/test_cov.py +151 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/computation/test_cumulative.py +139 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/computation/test_describe.py +458 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/computation/test_eval.py +86 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/computation/test_melt.py +202 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/computation/test_missing_data.py +520 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/computation/test_pivot.py +361 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/__init__.py +16 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/computation/__init__.py +16 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/computation/test_parity_any_all.py +40 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/computation/test_parity_apply_func.py +42 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/computation/test_parity_binary_ops.py +40 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/computation/test_parity_combine.py +37 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/computation/test_parity_compute.py +60 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/computation/test_parity_corrwith.py +40 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/computation/test_parity_cov.py +40 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/computation/test_parity_cumulative.py +90 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/computation/test_parity_describe.py +40 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/computation/test_parity_eval.py +40 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/computation/test_parity_melt.py +40 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/computation/test_parity_missing_data.py +42 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/computation/test_parity_pivot.py +37 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/data_type_ops/__init__.py +16 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/data_type_ops/test_parity_base.py +36 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/data_type_ops/test_parity_binary_ops.py +42 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/data_type_ops/test_parity_boolean_ops.py +47 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/data_type_ops/test_parity_categorical_ops.py +55 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/data_type_ops/test_parity_complex_ops.py +40 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/data_type_ops/test_parity_date_ops.py +47 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/data_type_ops/test_parity_datetime_ops.py +47 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/data_type_ops/test_parity_null_ops.py +42 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/data_type_ops/test_parity_num_arithmetic.py +43 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/data_type_ops/test_parity_num_ops.py +47 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/data_type_ops/test_parity_num_reverse.py +43 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/data_type_ops/test_parity_string_ops.py +47 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/data_type_ops/test_parity_timedelta_ops.py +47 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/data_type_ops/test_parity_udt_ops.py +40 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/data_type_ops/testing_utils.py +226 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/diff_frames_ops/__init__.py +16 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/diff_frames_ops/test_parity_align.py +39 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/diff_frames_ops/test_parity_basic_slow.py +55 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/diff_frames_ops/test_parity_cov_corrwith.py +39 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/diff_frames_ops/test_parity_dot_frame.py +39 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/diff_frames_ops/test_parity_dot_series.py +39 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/diff_frames_ops/test_parity_index.py +39 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/diff_frames_ops/test_parity_series.py +39 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/diff_frames_ops/test_parity_setitem_frame.py +43 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/diff_frames_ops/test_parity_setitem_series.py +43 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/frame/__init__.py +16 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/frame/test_parity_attrs.py +40 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/frame/test_parity_constructor.py +39 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/frame/test_parity_conversion.py +42 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/frame/test_parity_reindexing.py +42 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/frame/test_parity_reshaping.py +37 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/frame/test_parity_spark.py +40 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/frame/test_parity_take.py +42 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/frame/test_parity_time_series.py +48 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/frame/test_parity_truncate.py +40 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/groupby/__init__.py +16 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/groupby/test_parity_aggregate.py +40 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/groupby/test_parity_apply_func.py +41 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/groupby/test_parity_cumulative.py +67 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/groupby/test_parity_describe.py +40 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/groupby/test_parity_groupby.py +55 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/groupby/test_parity_head_tail.py +40 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/groupby/test_parity_index.py +38 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/groupby/test_parity_missing_data.py +55 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/groupby/test_parity_split_apply.py +39 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/groupby/test_parity_stat.py +38 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/indexes/__init__.py +16 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/indexes/test_parity_align.py +40 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/indexes/test_parity_base.py +50 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/indexes/test_parity_category.py +73 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/indexes/test_parity_datetime.py +39 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/indexes/test_parity_indexing.py +40 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/indexes/test_parity_reindex.py +40 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/indexes/test_parity_rename.py +40 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/indexes/test_parity_reset_index.py +48 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/indexes/test_parity_timedelta.py +39 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/io/__init__.py +16 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/io/test_parity_io.py +40 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/plot/__init__.py +16 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/plot/test_parity_frame_plot.py +45 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/plot/test_parity_frame_plot_matplotlib.py +45 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/plot/test_parity_frame_plot_plotly.py +49 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/plot/test_parity_series_plot.py +37 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/plot/test_parity_series_plot_matplotlib.py +53 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/plot/test_parity_series_plot_plotly.py +45 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/series/__init__.py +16 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/series/test_parity_all_any.py +38 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/series/test_parity_arg_ops.py +37 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/series/test_parity_as_of.py +37 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/series/test_parity_as_type.py +38 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/series/test_parity_compute.py +37 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/series/test_parity_conversion.py +40 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/series/test_parity_cumulative.py +40 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/series/test_parity_index.py +38 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/series/test_parity_missing_data.py +40 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/series/test_parity_series.py +37 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/series/test_parity_sort.py +38 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/series/test_parity_stat.py +38 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/test_parity_categorical.py +66 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/test_parity_config.py +37 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/test_parity_csv.py +37 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/test_parity_dataframe_conversion.py +42 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/test_parity_dataframe_spark_io.py +39 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/test_parity_default_index.py +49 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/test_parity_ewm.py +37 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/test_parity_expanding.py +39 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/test_parity_extension.py +49 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/test_parity_frame_spark.py +53 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/test_parity_generic_functions.py +43 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/test_parity_indexing.py +49 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/test_parity_indexops_spark.py +39 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/test_parity_internal.py +41 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/test_parity_namespace.py +39 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/test_parity_numpy_compat.py +60 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/test_parity_ops_on_diff_frames.py +48 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/test_parity_ops_on_diff_frames_groupby.py +39 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/test_parity_ops_on_diff_frames_groupby_expanding.py +44 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/test_parity_ops_on_diff_frames_groupby_rolling.py +84 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/test_parity_repr.py +37 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/test_parity_resample.py +45 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/test_parity_reshape.py +39 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/test_parity_rolling.py +39 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/test_parity_scalars.py +37 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/test_parity_series_conversion.py +39 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/test_parity_series_datetime.py +39 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/test_parity_series_string.py +39 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/test_parity_spark_functions.py +39 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/test_parity_sql.py +43 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/test_parity_stats.py +37 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/test_parity_typedef.py +36 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/test_parity_utils.py +37 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/test_parity_window.py +39 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/data_type_ops/__init__.py +16 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/data_type_ops/test_base.py +107 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/data_type_ops/test_binary_ops.py +224 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/data_type_ops/test_boolean_ops.py +825 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/data_type_ops/test_categorical_ops.py +562 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/data_type_ops/test_complex_ops.py +368 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/data_type_ops/test_date_ops.py +257 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/data_type_ops/test_datetime_ops.py +260 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/data_type_ops/test_null_ops.py +178 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/data_type_ops/test_num_arithmetic.py +184 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/data_type_ops/test_num_ops.py +497 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/data_type_ops/test_num_reverse.py +140 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/data_type_ops/test_string_ops.py +354 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/data_type_ops/test_timedelta_ops.py +219 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/data_type_ops/test_udt_ops.py +192 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/data_type_ops/testing_utils.py +228 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/diff_frames_ops/__init__.py +16 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/diff_frames_ops/test_align.py +118 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/diff_frames_ops/test_basic_slow.py +198 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/diff_frames_ops/test_cov_corrwith.py +181 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/diff_frames_ops/test_dot_frame.py +103 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/diff_frames_ops/test_dot_series.py +141 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/diff_frames_ops/test_index.py +109 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/diff_frames_ops/test_series.py +136 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/diff_frames_ops/test_setitem_frame.py +125 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/diff_frames_ops/test_setitem_series.py +217 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/frame/__init__.py +16 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/frame/test_attrs.py +384 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/frame/test_constructor.py +598 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/frame/test_conversion.py +73 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/frame/test_reindexing.py +869 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/frame/test_reshaping.py +487 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/frame/test_spark.py +309 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/frame/test_take.py +156 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/frame/test_time_series.py +149 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/frame/test_truncate.py +163 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/groupby/__init__.py +16 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/groupby/test_aggregate.py +311 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/groupby/test_apply_func.py +524 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/groupby/test_cumulative.py +419 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/groupby/test_describe.py +144 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/groupby/test_groupby.py +979 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/groupby/test_head_tail.py +234 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/groupby/test_index.py +206 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/groupby/test_missing_data.py +421 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/groupby/test_split_apply.py +187 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/groupby/test_stat.py +397 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/indexes/__init__.py +16 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/indexes/test_align.py +100 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/indexes/test_base.py +2743 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/indexes/test_category.py +484 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/indexes/test_datetime.py +276 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/indexes/test_indexing.py +432 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/indexes/test_reindex.py +310 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/indexes/test_rename.py +257 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/indexes/test_reset_index.py +160 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/indexes/test_timedelta.py +128 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/io/__init__.py +16 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/io/test_io.py +137 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/plot/__init__.py +16 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/plot/test_frame_plot.py +170 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/plot/test_frame_plot_matplotlib.py +547 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/plot/test_frame_plot_plotly.py +285 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/plot/test_series_plot.py +106 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/plot/test_series_plot_matplotlib.py +409 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/plot/test_series_plot_plotly.py +247 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/series/__init__.py +16 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/series/test_all_any.py +105 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/series/test_arg_ops.py +197 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/series/test_as_of.py +137 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/series/test_as_type.py +227 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/series/test_compute.py +634 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/series/test_conversion.py +88 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/series/test_cumulative.py +139 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/series/test_index.py +475 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/series/test_missing_data.py +265 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/series/test_series.py +818 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/series/test_sort.py +162 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/series/test_stat.py +780 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/test_categorical.py +741 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/test_config.py +160 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/test_csv.py +453 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/test_dataframe_conversion.py +281 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/test_dataframe_spark_io.py +487 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/test_default_index.py +109 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/test_ewm.py +434 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/test_expanding.py +253 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/test_extension.py +152 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/test_frame_spark.py +162 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/test_generic_functions.py +234 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/test_indexing.py +1339 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/test_indexops_spark.py +82 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/test_internal.py +124 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/test_namespace.py +638 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/test_numpy_compat.py +200 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/test_ops_on_diff_frames.py +1355 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/test_ops_on_diff_frames_groupby.py +655 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/test_ops_on_diff_frames_groupby_expanding.py +113 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/test_ops_on_diff_frames_groupby_rolling.py +118 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/test_repr.py +192 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/test_resample.py +346 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/test_reshape.py +495 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/test_rolling.py +263 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/test_scalars.py +59 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/test_series_conversion.py +85 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/test_series_datetime.py +364 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/test_series_string.py +362 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/test_spark_functions.py +46 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/test_sql.py +123 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/test_stats.py +581 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/test_typedef.py +447 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/test_utils.py +301 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/test_window.py +465 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/typedef/__init__.py +18 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/typedef/typehints.py +874 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/usage_logging/__init__.py +143 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/usage_logging/usage_logger.py +132 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/utils.py +1063 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/window.py +2702 -0
- snowflake/snowpark_connect/includes/python/pyspark/profiler.py +489 -0
- snowflake/snowpark_connect/includes/python/pyspark/py.typed +1 -0
- snowflake/snowpark_connect/includes/python/pyspark/python/pyspark/shell.py +123 -0
- snowflake/snowpark_connect/includes/python/pyspark/rdd.py +5518 -0
- snowflake/snowpark_connect/includes/python/pyspark/rddsampler.py +115 -0
- snowflake/snowpark_connect/includes/python/pyspark/resource/__init__.py +38 -0
- snowflake/snowpark_connect/includes/python/pyspark/resource/information.py +69 -0
- snowflake/snowpark_connect/includes/python/pyspark/resource/profile.py +317 -0
- snowflake/snowpark_connect/includes/python/pyspark/resource/requests.py +539 -0
- snowflake/snowpark_connect/includes/python/pyspark/resource/tests/__init__.py +16 -0
- snowflake/snowpark_connect/includes/python/pyspark/resource/tests/test_resources.py +83 -0
- snowflake/snowpark_connect/includes/python/pyspark/resultiterable.py +45 -0
- snowflake/snowpark_connect/includes/python/pyspark/serializers.py +681 -0
- snowflake/snowpark_connect/includes/python/pyspark/shell.py +123 -0
- snowflake/snowpark_connect/includes/python/pyspark/shuffle.py +854 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/__init__.py +75 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/_typing.pyi +80 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/avro/__init__.py +18 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/avro/functions.py +188 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/catalog.py +1270 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/column.py +1431 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/conf.py +99 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/connect/__init__.py +18 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/connect/_typing.py +90 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/connect/avro/__init__.py +18 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/connect/avro/functions.py +107 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/connect/catalog.py +356 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/connect/client/__init__.py +22 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/connect/client/artifact.py +412 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/connect/client/core.py +1689 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/connect/client/reattach.py +340 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/connect/column.py +514 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/connect/conf.py +128 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/connect/conversion.py +490 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/connect/dataframe.py +2172 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/connect/expressions.py +1056 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/connect/functions.py +3937 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/connect/group.py +418 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/connect/plan.py +2289 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/connect/proto/__init__.py +25 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/connect/proto/base_pb2.py +203 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/connect/proto/base_pb2.pyi +2718 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/connect/proto/base_pb2_grpc.py +423 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/connect/proto/catalog_pb2.py +109 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/connect/proto/catalog_pb2.pyi +1130 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/connect/proto/commands_pb2.py +141 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/connect/proto/commands_pb2.pyi +1766 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/connect/proto/common_pb2.py +47 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/connect/proto/common_pb2.pyi +123 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/connect/proto/example_plugins_pb2.py +53 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/connect/proto/example_plugins_pb2.pyi +112 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/connect/proto/expressions_pb2.py +107 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/connect/proto/expressions_pb2.pyi +1507 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/connect/proto/relations_pb2.py +195 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/connect/proto/relations_pb2.pyi +3613 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/connect/proto/types_pb2.py +95 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/connect/proto/types_pb2.pyi +980 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/connect/protobuf/__init__.py +18 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/connect/protobuf/functions.py +166 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/connect/readwriter.py +861 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/connect/session.py +952 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/connect/streaming/__init__.py +22 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/connect/streaming/query.py +295 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/connect/streaming/readwriter.py +618 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/connect/streaming/worker/__init__.py +18 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/connect/streaming/worker/foreach_batch_worker.py +87 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/connect/streaming/worker/listener_worker.py +100 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/connect/types.py +301 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/connect/udf.py +296 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/connect/udtf.py +200 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/connect/utils.py +58 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/connect/window.py +266 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/context.py +818 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/dataframe.py +5973 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/functions.py +15889 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/group.py +547 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/observation.py +152 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/pandas/__init__.py +21 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/pandas/_typing/__init__.pyi +344 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/pandas/_typing/protocols/__init__.pyi +17 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/pandas/_typing/protocols/frame.pyi +20 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/pandas/_typing/protocols/series.pyi +20 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/pandas/conversion.py +671 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/pandas/functions.py +480 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/pandas/functions.pyi +132 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/pandas/group_ops.py +523 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/pandas/map_ops.py +216 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/pandas/serializers.py +1019 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/pandas/typehints.py +172 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/pandas/types.py +972 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/pandas/utils.py +86 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/protobuf/__init__.py +18 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/protobuf/functions.py +334 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/readwriter.py +2159 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/session.py +2088 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/sql_formatter.py +84 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/streaming/__init__.py +21 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/streaming/listener.py +1050 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/streaming/query.py +746 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/streaming/readwriter.py +1652 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/streaming/state.py +288 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/tests/__init__.py +16 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/tests/connect/__init__.py +16 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/tests/connect/client/__init__.py +16 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/tests/connect/client/test_artifact.py +420 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/tests/connect/client/test_client.py +358 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/tests/connect/streaming/__init__.py +16 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/tests/connect/streaming/test_parity_foreach.py +36 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/tests/connect/streaming/test_parity_foreach_batch.py +44 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/tests/connect/streaming/test_parity_listener.py +116 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/tests/connect/streaming/test_parity_streaming.py +35 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/tests/connect/test_connect_basic.py +3612 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/tests/connect/test_connect_column.py +1042 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/tests/connect/test_connect_function.py +2381 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/tests/connect/test_connect_plan.py +1060 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/tests/connect/test_parity_arrow.py +163 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/tests/connect/test_parity_arrow_map.py +38 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/tests/connect/test_parity_arrow_python_udf.py +48 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/tests/connect/test_parity_catalog.py +36 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/tests/connect/test_parity_column.py +55 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/tests/connect/test_parity_conf.py +36 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/tests/connect/test_parity_dataframe.py +96 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/tests/connect/test_parity_datasources.py +44 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/tests/connect/test_parity_errors.py +36 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/tests/connect/test_parity_functions.py +59 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/tests/connect/test_parity_group.py +36 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/tests/connect/test_parity_pandas_cogrouped_map.py +59 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/tests/connect/test_parity_pandas_grouped_map.py +74 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/tests/connect/test_parity_pandas_grouped_map_with_state.py +62 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/tests/connect/test_parity_pandas_map.py +58 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/tests/connect/test_parity_pandas_udf.py +70 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/tests/connect/test_parity_pandas_udf_grouped_agg.py +50 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/tests/connect/test_parity_pandas_udf_scalar.py +68 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/tests/connect/test_parity_pandas_udf_window.py +40 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/tests/connect/test_parity_readwriter.py +46 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/tests/connect/test_parity_serde.py +44 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/tests/connect/test_parity_types.py +100 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/tests/connect/test_parity_udf.py +100 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/tests/connect/test_parity_udtf.py +163 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/tests/connect/test_session.py +181 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/tests/connect/test_utils.py +42 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/tests/pandas/__init__.py +16 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/tests/pandas/test_pandas_cogrouped_map.py +623 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/tests/pandas/test_pandas_grouped_map.py +869 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/tests/pandas/test_pandas_grouped_map_with_state.py +342 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/tests/pandas/test_pandas_map.py +436 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/tests/pandas/test_pandas_udf.py +363 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/tests/pandas/test_pandas_udf_grouped_agg.py +592 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/tests/pandas/test_pandas_udf_scalar.py +1503 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/tests/pandas/test_pandas_udf_typehints.py +392 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/tests/pandas/test_pandas_udf_typehints_with_future_annotations.py +375 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/tests/pandas/test_pandas_udf_window.py +411 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/tests/streaming/__init__.py +16 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/tests/streaming/test_streaming.py +401 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/tests/streaming/test_streaming_foreach.py +295 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/tests/streaming/test_streaming_foreach_batch.py +106 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/tests/streaming/test_streaming_listener.py +558 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/tests/test_arrow.py +1346 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/tests/test_arrow_map.py +182 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/tests/test_arrow_python_udf.py +202 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/tests/test_catalog.py +503 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/tests/test_column.py +225 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/tests/test_conf.py +83 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/tests/test_context.py +201 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/tests/test_dataframe.py +1931 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/tests/test_datasources.py +256 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/tests/test_errors.py +69 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/tests/test_functions.py +1349 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/tests/test_group.py +53 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/tests/test_pandas_sqlmetrics.py +68 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/tests/test_readwriter.py +283 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/tests/test_serde.py +155 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/tests/test_session.py +412 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/tests/test_types.py +1581 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/tests/test_udf.py +961 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/tests/test_udf_profiler.py +165 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/tests/test_udtf.py +1456 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/tests/test_utils.py +1686 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/types.py +2558 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/udf.py +714 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/udtf.py +325 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/utils.py +339 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/window.py +492 -0
- snowflake/snowpark_connect/includes/python/pyspark/statcounter.py +165 -0
- snowflake/snowpark_connect/includes/python/pyspark/status.py +112 -0
- snowflake/snowpark_connect/includes/python/pyspark/storagelevel.py +97 -0
- snowflake/snowpark_connect/includes/python/pyspark/streaming/__init__.py +22 -0
- snowflake/snowpark_connect/includes/python/pyspark/streaming/context.py +471 -0
- snowflake/snowpark_connect/includes/python/pyspark/streaming/dstream.py +933 -0
- snowflake/snowpark_connect/includes/python/pyspark/streaming/kinesis.py +205 -0
- snowflake/snowpark_connect/includes/python/pyspark/streaming/listener.py +83 -0
- snowflake/snowpark_connect/includes/python/pyspark/streaming/tests/__init__.py +16 -0
- snowflake/snowpark_connect/includes/python/pyspark/streaming/tests/test_context.py +184 -0
- snowflake/snowpark_connect/includes/python/pyspark/streaming/tests/test_dstream.py +706 -0
- snowflake/snowpark_connect/includes/python/pyspark/streaming/tests/test_kinesis.py +118 -0
- snowflake/snowpark_connect/includes/python/pyspark/streaming/tests/test_listener.py +160 -0
- snowflake/snowpark_connect/includes/python/pyspark/streaming/util.py +168 -0
- snowflake/snowpark_connect/includes/python/pyspark/taskcontext.py +502 -0
- snowflake/snowpark_connect/includes/python/pyspark/testing/__init__.py +21 -0
- snowflake/snowpark_connect/includes/python/pyspark/testing/connectutils.py +199 -0
- snowflake/snowpark_connect/includes/python/pyspark/testing/mllibutils.py +30 -0
- snowflake/snowpark_connect/includes/python/pyspark/testing/mlutils.py +275 -0
- snowflake/snowpark_connect/includes/python/pyspark/testing/objects.py +121 -0
- snowflake/snowpark_connect/includes/python/pyspark/testing/pandasutils.py +714 -0
- snowflake/snowpark_connect/includes/python/pyspark/testing/sqlutils.py +168 -0
- snowflake/snowpark_connect/includes/python/pyspark/testing/streamingutils.py +178 -0
- snowflake/snowpark_connect/includes/python/pyspark/testing/utils.py +636 -0
- snowflake/snowpark_connect/includes/python/pyspark/tests/__init__.py +16 -0
- snowflake/snowpark_connect/includes/python/pyspark/tests/test_appsubmit.py +306 -0
- snowflake/snowpark_connect/includes/python/pyspark/tests/test_broadcast.py +196 -0
- snowflake/snowpark_connect/includes/python/pyspark/tests/test_conf.py +44 -0
- snowflake/snowpark_connect/includes/python/pyspark/tests/test_context.py +346 -0
- snowflake/snowpark_connect/includes/python/pyspark/tests/test_daemon.py +89 -0
- snowflake/snowpark_connect/includes/python/pyspark/tests/test_install_spark.py +124 -0
- snowflake/snowpark_connect/includes/python/pyspark/tests/test_join.py +69 -0
- snowflake/snowpark_connect/includes/python/pyspark/tests/test_memory_profiler.py +167 -0
- snowflake/snowpark_connect/includes/python/pyspark/tests/test_pin_thread.py +194 -0
- snowflake/snowpark_connect/includes/python/pyspark/tests/test_profiler.py +168 -0
- snowflake/snowpark_connect/includes/python/pyspark/tests/test_rdd.py +939 -0
- snowflake/snowpark_connect/includes/python/pyspark/tests/test_rddbarrier.py +52 -0
- snowflake/snowpark_connect/includes/python/pyspark/tests/test_rddsampler.py +66 -0
- snowflake/snowpark_connect/includes/python/pyspark/tests/test_readwrite.py +368 -0
- snowflake/snowpark_connect/includes/python/pyspark/tests/test_serializers.py +257 -0
- snowflake/snowpark_connect/includes/python/pyspark/tests/test_shuffle.py +267 -0
- snowflake/snowpark_connect/includes/python/pyspark/tests/test_stage_sched.py +153 -0
- snowflake/snowpark_connect/includes/python/pyspark/tests/test_statcounter.py +130 -0
- snowflake/snowpark_connect/includes/python/pyspark/tests/test_taskcontext.py +350 -0
- snowflake/snowpark_connect/includes/python/pyspark/tests/test_util.py +97 -0
- snowflake/snowpark_connect/includes/python/pyspark/tests/test_worker.py +271 -0
- snowflake/snowpark_connect/includes/python/pyspark/traceback_utils.py +81 -0
- snowflake/snowpark_connect/includes/python/pyspark/util.py +416 -0
- snowflake/snowpark_connect/includes/python/pyspark/version.py +19 -0
- snowflake/snowpark_connect/includes/python/pyspark/worker.py +1307 -0
- snowflake/snowpark_connect/includes/python/pyspark/worker_util.py +46 -0
- snowflake/snowpark_connect/proto/__init__.py +10 -0
- snowflake/snowpark_connect/proto/control_pb2.py +35 -0
- snowflake/snowpark_connect/proto/control_pb2.pyi +38 -0
- snowflake/snowpark_connect/proto/control_pb2_grpc.py +183 -0
- snowflake/snowpark_connect/proto/snowflake_expression_ext_pb2.py +35 -0
- snowflake/snowpark_connect/proto/snowflake_expression_ext_pb2.pyi +53 -0
- snowflake/snowpark_connect/proto/snowflake_rdd_pb2.pyi +39 -0
- snowflake/snowpark_connect/proto/snowflake_relation_ext_pb2.py +47 -0
- snowflake/snowpark_connect/proto/snowflake_relation_ext_pb2.pyi +111 -0
- snowflake/snowpark_connect/relation/__init__.py +3 -0
- snowflake/snowpark_connect/relation/catalogs/__init__.py +12 -0
- snowflake/snowpark_connect/relation/catalogs/abstract_spark_catalog.py +287 -0
- snowflake/snowpark_connect/relation/catalogs/snowflake_catalog.py +467 -0
- snowflake/snowpark_connect/relation/catalogs/utils.py +51 -0
- snowflake/snowpark_connect/relation/io_utils.py +76 -0
- snowflake/snowpark_connect/relation/map_aggregate.py +322 -0
- snowflake/snowpark_connect/relation/map_catalog.py +151 -0
- snowflake/snowpark_connect/relation/map_column_ops.py +1068 -0
- snowflake/snowpark_connect/relation/map_crosstab.py +48 -0
- snowflake/snowpark_connect/relation/map_extension.py +412 -0
- snowflake/snowpark_connect/relation/map_join.py +341 -0
- snowflake/snowpark_connect/relation/map_local_relation.py +326 -0
- snowflake/snowpark_connect/relation/map_map_partitions.py +146 -0
- snowflake/snowpark_connect/relation/map_relation.py +253 -0
- snowflake/snowpark_connect/relation/map_row_ops.py +716 -0
- snowflake/snowpark_connect/relation/map_sample_by.py +35 -0
- snowflake/snowpark_connect/relation/map_show_string.py +50 -0
- snowflake/snowpark_connect/relation/map_sql.py +1874 -0
- snowflake/snowpark_connect/relation/map_stats.py +324 -0
- snowflake/snowpark_connect/relation/map_subquery_alias.py +32 -0
- snowflake/snowpark_connect/relation/map_udtf.py +288 -0
- snowflake/snowpark_connect/relation/read/__init__.py +7 -0
- snowflake/snowpark_connect/relation/read/jdbc_read_dbapi.py +668 -0
- snowflake/snowpark_connect/relation/read/map_read.py +367 -0
- snowflake/snowpark_connect/relation/read/map_read_csv.py +142 -0
- snowflake/snowpark_connect/relation/read/map_read_jdbc.py +108 -0
- snowflake/snowpark_connect/relation/read/map_read_json.py +344 -0
- snowflake/snowpark_connect/relation/read/map_read_parquet.py +194 -0
- snowflake/snowpark_connect/relation/read/map_read_socket.py +59 -0
- snowflake/snowpark_connect/relation/read/map_read_table.py +109 -0
- snowflake/snowpark_connect/relation/read/map_read_text.py +106 -0
- snowflake/snowpark_connect/relation/read/reader_config.py +399 -0
- snowflake/snowpark_connect/relation/read/utils.py +155 -0
- snowflake/snowpark_connect/relation/stage_locator.py +161 -0
- snowflake/snowpark_connect/relation/utils.py +219 -0
- snowflake/snowpark_connect/relation/write/__init__.py +3 -0
- snowflake/snowpark_connect/relation/write/jdbc_write_dbapi.py +339 -0
- snowflake/snowpark_connect/relation/write/map_write.py +436 -0
- snowflake/snowpark_connect/relation/write/map_write_jdbc.py +48 -0
- snowflake/snowpark_connect/resources/java_udfs-1.0-SNAPSHOT.jar +0 -0
- snowflake/snowpark_connect/resources_initializer.py +75 -0
- snowflake/snowpark_connect/server.py +1136 -0
- snowflake/snowpark_connect/start_server.py +32 -0
- snowflake/snowpark_connect/tcm.py +8 -0
- snowflake/snowpark_connect/type_mapping.py +1003 -0
- snowflake/snowpark_connect/typed_column.py +94 -0
- snowflake/snowpark_connect/utils/__init__.py +3 -0
- snowflake/snowpark_connect/utils/artifacts.py +48 -0
- snowflake/snowpark_connect/utils/attribute_handling.py +72 -0
- snowflake/snowpark_connect/utils/cache.py +84 -0
- snowflake/snowpark_connect/utils/concurrent.py +124 -0
- snowflake/snowpark_connect/utils/context.py +390 -0
- snowflake/snowpark_connect/utils/describe_query_cache.py +231 -0
- snowflake/snowpark_connect/utils/interrupt.py +85 -0
- snowflake/snowpark_connect/utils/io_utils.py +35 -0
- snowflake/snowpark_connect/utils/pandas_udtf_utils.py +117 -0
- snowflake/snowpark_connect/utils/profiling.py +47 -0
- snowflake/snowpark_connect/utils/session.py +180 -0
- snowflake/snowpark_connect/utils/snowpark_connect_logging.py +38 -0
- snowflake/snowpark_connect/utils/telemetry.py +513 -0
- snowflake/snowpark_connect/utils/udf_cache.py +392 -0
- snowflake/snowpark_connect/utils/udf_helper.py +328 -0
- snowflake/snowpark_connect/utils/udf_utils.py +310 -0
- snowflake/snowpark_connect/utils/udtf_helper.py +420 -0
- snowflake/snowpark_connect/utils/udtf_utils.py +799 -0
- snowflake/snowpark_connect/utils/xxhash64.py +247 -0
- snowflake/snowpark_connect/version.py +6 -0
- snowpark_connect-0.20.2.data/scripts/snowpark-connect +71 -0
- snowpark_connect-0.20.2.data/scripts/snowpark-session +11 -0
- snowpark_connect-0.20.2.data/scripts/snowpark-submit +354 -0
- snowpark_connect-0.20.2.dist-info/METADATA +37 -0
- snowpark_connect-0.20.2.dist-info/RECORD +879 -0
- snowpark_connect-0.20.2.dist-info/WHEEL +5 -0
- snowpark_connect-0.20.2.dist-info/licenses/LICENSE.txt +202 -0
- snowpark_connect-0.20.2.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,1307 @@
|
|
|
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
|
+
"""
|
|
19
|
+
Worker that receives input from Piped RDD.
|
|
20
|
+
"""
|
|
21
|
+
import os
|
|
22
|
+
import sys
|
|
23
|
+
import time
|
|
24
|
+
from inspect import currentframe, getframeinfo, getfullargspec
|
|
25
|
+
import importlib
|
|
26
|
+
import json
|
|
27
|
+
from typing import Any, Iterable, Iterator
|
|
28
|
+
|
|
29
|
+
# 'resource' is a Unix specific module.
|
|
30
|
+
has_resource_module = True
|
|
31
|
+
try:
|
|
32
|
+
import resource
|
|
33
|
+
except ImportError:
|
|
34
|
+
has_resource_module = False
|
|
35
|
+
import traceback
|
|
36
|
+
import warnings
|
|
37
|
+
import faulthandler
|
|
38
|
+
|
|
39
|
+
from pyspark.accumulators import _accumulatorRegistry
|
|
40
|
+
from pyspark.broadcast import Broadcast, _broadcastRegistry
|
|
41
|
+
from pyspark.java_gateway import local_connect_and_auth
|
|
42
|
+
from pyspark.taskcontext import BarrierTaskContext, TaskContext
|
|
43
|
+
from pyspark.files import SparkFiles
|
|
44
|
+
from pyspark.resource import ResourceInformation
|
|
45
|
+
from pyspark.rdd import PythonEvalType
|
|
46
|
+
from pyspark.serializers import (
|
|
47
|
+
write_with_length,
|
|
48
|
+
write_int,
|
|
49
|
+
read_long,
|
|
50
|
+
read_bool,
|
|
51
|
+
write_long,
|
|
52
|
+
read_int,
|
|
53
|
+
SpecialLengths,
|
|
54
|
+
UTF8Deserializer,
|
|
55
|
+
CPickleSerializer,
|
|
56
|
+
BatchedSerializer,
|
|
57
|
+
)
|
|
58
|
+
from pyspark.sql.pandas.serializers import (
|
|
59
|
+
ArrowStreamPandasUDFSerializer,
|
|
60
|
+
ArrowStreamPandasUDTFSerializer,
|
|
61
|
+
CogroupUDFSerializer,
|
|
62
|
+
ArrowStreamUDFSerializer,
|
|
63
|
+
ApplyInPandasWithStateSerializer,
|
|
64
|
+
)
|
|
65
|
+
from pyspark.sql.pandas.types import to_arrow_type
|
|
66
|
+
from pyspark.sql.types import BinaryType, StringType, StructType, _parse_datatype_json_string
|
|
67
|
+
from pyspark.util import fail_on_stopiteration, try_simplify_traceback
|
|
68
|
+
from pyspark import shuffle
|
|
69
|
+
from pyspark.errors import PySparkRuntimeError, PySparkTypeError
|
|
70
|
+
|
|
71
|
+
pickleSer = CPickleSerializer()
|
|
72
|
+
utf8_deserializer = UTF8Deserializer()
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
def report_times(outfile, boot, init, finish):
|
|
76
|
+
write_int(SpecialLengths.TIMING_DATA, outfile)
|
|
77
|
+
write_long(int(1000 * boot), outfile)
|
|
78
|
+
write_long(int(1000 * init), outfile)
|
|
79
|
+
write_long(int(1000 * finish), outfile)
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
def add_path(path):
|
|
83
|
+
# worker can be used, so do not add path multiple times
|
|
84
|
+
if path not in sys.path:
|
|
85
|
+
# overwrite system packages
|
|
86
|
+
sys.path.insert(1, path)
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
def read_command(serializer, file):
|
|
90
|
+
command = serializer._read_with_length(file)
|
|
91
|
+
if isinstance(command, Broadcast):
|
|
92
|
+
command = serializer.loads(command.value)
|
|
93
|
+
return command
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
def chain(f, g):
|
|
97
|
+
"""chain two functions together"""
|
|
98
|
+
return lambda *a: g(f(*a))
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
def wrap_udf(f, return_type):
|
|
102
|
+
if return_type.needConversion():
|
|
103
|
+
toInternal = return_type.toInternal
|
|
104
|
+
return lambda *a: toInternal(f(*a))
|
|
105
|
+
else:
|
|
106
|
+
return lambda *a: f(*a)
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
def wrap_scalar_pandas_udf(f, return_type):
|
|
110
|
+
arrow_return_type = to_arrow_type(return_type)
|
|
111
|
+
|
|
112
|
+
def verify_result_type(result):
|
|
113
|
+
if not hasattr(result, "__len__"):
|
|
114
|
+
pd_type = "pandas.DataFrame" if type(return_type) == StructType else "pandas.Series"
|
|
115
|
+
raise PySparkTypeError(
|
|
116
|
+
error_class="UDF_RETURN_TYPE",
|
|
117
|
+
message_parameters={
|
|
118
|
+
"expected": pd_type,
|
|
119
|
+
"actual": type(result).__name__,
|
|
120
|
+
},
|
|
121
|
+
)
|
|
122
|
+
return result
|
|
123
|
+
|
|
124
|
+
def verify_result_length(result, length):
|
|
125
|
+
if len(result) != length:
|
|
126
|
+
raise PySparkRuntimeError(
|
|
127
|
+
error_class="SCHEMA_MISMATCH_FOR_PANDAS_UDF",
|
|
128
|
+
message_parameters={
|
|
129
|
+
"expected": str(length),
|
|
130
|
+
"actual": str(len(result)),
|
|
131
|
+
},
|
|
132
|
+
)
|
|
133
|
+
return result
|
|
134
|
+
|
|
135
|
+
return lambda *a: (
|
|
136
|
+
verify_result_length(verify_result_type(f(*a)), len(a[0])),
|
|
137
|
+
arrow_return_type,
|
|
138
|
+
)
|
|
139
|
+
|
|
140
|
+
|
|
141
|
+
def wrap_arrow_batch_udf(f, return_type):
|
|
142
|
+
import pandas as pd
|
|
143
|
+
|
|
144
|
+
arrow_return_type = to_arrow_type(return_type)
|
|
145
|
+
|
|
146
|
+
# "result_func" ensures the result of a Python UDF to be consistent with/without Arrow
|
|
147
|
+
# optimization.
|
|
148
|
+
# Otherwise, an Arrow-optimized Python UDF raises "pyarrow.lib.ArrowTypeError: Expected a
|
|
149
|
+
# string or bytes dtype, got ..." whereas a non-Arrow-optimized Python UDF returns
|
|
150
|
+
# successfully.
|
|
151
|
+
result_func = lambda pdf: pdf # noqa: E731
|
|
152
|
+
if type(return_type) == StringType:
|
|
153
|
+
result_func = lambda r: str(r) if r is not None else r # noqa: E731
|
|
154
|
+
elif type(return_type) == BinaryType:
|
|
155
|
+
result_func = lambda r: bytes(r) if r is not None else r # noqa: E731
|
|
156
|
+
|
|
157
|
+
@fail_on_stopiteration
|
|
158
|
+
def evaluate(*args: pd.Series) -> pd.Series:
|
|
159
|
+
return pd.Series([result_func(f(*a)) for a in zip(*args)])
|
|
160
|
+
|
|
161
|
+
def verify_result_length(result, length):
|
|
162
|
+
if len(result) != length:
|
|
163
|
+
raise PySparkRuntimeError(
|
|
164
|
+
error_class="SCHEMA_MISMATCH_FOR_PANDAS_UDF",
|
|
165
|
+
message_parameters={
|
|
166
|
+
"expected": str(length),
|
|
167
|
+
"actual": str(len(result)),
|
|
168
|
+
},
|
|
169
|
+
)
|
|
170
|
+
return result
|
|
171
|
+
|
|
172
|
+
return lambda *a: (
|
|
173
|
+
verify_result_length(evaluate(*a), len(a[0])),
|
|
174
|
+
arrow_return_type,
|
|
175
|
+
)
|
|
176
|
+
|
|
177
|
+
|
|
178
|
+
def wrap_pandas_batch_iter_udf(f, return_type):
|
|
179
|
+
arrow_return_type = to_arrow_type(return_type)
|
|
180
|
+
iter_type_label = "pandas.DataFrame" if type(return_type) == StructType else "pandas.Series"
|
|
181
|
+
|
|
182
|
+
def verify_result(result):
|
|
183
|
+
if not isinstance(result, Iterator) and not hasattr(result, "__iter__"):
|
|
184
|
+
raise PySparkTypeError(
|
|
185
|
+
error_class="UDF_RETURN_TYPE",
|
|
186
|
+
message_parameters={
|
|
187
|
+
"expected": "iterator of {}".format(iter_type_label),
|
|
188
|
+
"actual": type(result).__name__,
|
|
189
|
+
},
|
|
190
|
+
)
|
|
191
|
+
return result
|
|
192
|
+
|
|
193
|
+
def verify_element(elem):
|
|
194
|
+
import pandas as pd
|
|
195
|
+
|
|
196
|
+
if not isinstance(elem, pd.DataFrame if type(return_type) == StructType else pd.Series):
|
|
197
|
+
raise PySparkTypeError(
|
|
198
|
+
error_class="UDF_RETURN_TYPE",
|
|
199
|
+
message_parameters={
|
|
200
|
+
"expected": "iterator of {}".format(iter_type_label),
|
|
201
|
+
"actual": "iterator of {}".format(type(elem).__name__),
|
|
202
|
+
},
|
|
203
|
+
)
|
|
204
|
+
|
|
205
|
+
verify_pandas_result(
|
|
206
|
+
elem, return_type, assign_cols_by_name=True, truncate_return_schema=True
|
|
207
|
+
)
|
|
208
|
+
|
|
209
|
+
return elem
|
|
210
|
+
|
|
211
|
+
return lambda *iterator: map(
|
|
212
|
+
lambda res: (res, arrow_return_type), map(verify_element, verify_result(f(*iterator)))
|
|
213
|
+
)
|
|
214
|
+
|
|
215
|
+
|
|
216
|
+
def verify_pandas_result(result, return_type, assign_cols_by_name, truncate_return_schema):
|
|
217
|
+
import pandas as pd
|
|
218
|
+
|
|
219
|
+
if type(return_type) == StructType:
|
|
220
|
+
if not isinstance(result, pd.DataFrame):
|
|
221
|
+
raise PySparkTypeError(
|
|
222
|
+
error_class="UDF_RETURN_TYPE",
|
|
223
|
+
message_parameters={
|
|
224
|
+
"expected": "pandas.DataFrame",
|
|
225
|
+
"actual": type(result).__name__,
|
|
226
|
+
},
|
|
227
|
+
)
|
|
228
|
+
|
|
229
|
+
# check the schema of the result only if it is not empty or has columns
|
|
230
|
+
if not result.empty or len(result.columns) != 0:
|
|
231
|
+
# if any column name of the result is a string
|
|
232
|
+
# the column names of the result have to match the return type
|
|
233
|
+
# see create_array in pyspark.sql.pandas.serializers.ArrowStreamPandasSerializer
|
|
234
|
+
field_names = set([field.name for field in return_type.fields])
|
|
235
|
+
# only the first len(field_names) result columns are considered
|
|
236
|
+
# when truncating the return schema
|
|
237
|
+
result_columns = (
|
|
238
|
+
result.columns[: len(field_names)] if truncate_return_schema else result.columns
|
|
239
|
+
)
|
|
240
|
+
column_names = set(result_columns)
|
|
241
|
+
if (
|
|
242
|
+
assign_cols_by_name
|
|
243
|
+
and any(isinstance(name, str) for name in result.columns)
|
|
244
|
+
and column_names != field_names
|
|
245
|
+
):
|
|
246
|
+
missing = sorted(list(field_names.difference(column_names)))
|
|
247
|
+
missing = f" Missing: {', '.join(missing)}." if missing else ""
|
|
248
|
+
|
|
249
|
+
extra = sorted(list(column_names.difference(field_names)))
|
|
250
|
+
extra = f" Unexpected: {', '.join(extra)}." if extra else ""
|
|
251
|
+
|
|
252
|
+
raise PySparkRuntimeError(
|
|
253
|
+
error_class="RESULT_COLUMNS_MISMATCH_FOR_PANDAS_UDF",
|
|
254
|
+
message_parameters={
|
|
255
|
+
"missing": missing,
|
|
256
|
+
"extra": extra,
|
|
257
|
+
},
|
|
258
|
+
)
|
|
259
|
+
# otherwise the number of columns of result have to match the return type
|
|
260
|
+
elif len(result_columns) != len(return_type):
|
|
261
|
+
raise PySparkRuntimeError(
|
|
262
|
+
error_class="RESULT_LENGTH_MISMATCH_FOR_PANDAS_UDF",
|
|
263
|
+
message_parameters={
|
|
264
|
+
"expected": str(len(return_type)),
|
|
265
|
+
"actual": str(len(result.columns)),
|
|
266
|
+
},
|
|
267
|
+
)
|
|
268
|
+
else:
|
|
269
|
+
if not isinstance(result, pd.Series):
|
|
270
|
+
raise PySparkTypeError(
|
|
271
|
+
error_class="UDF_RETURN_TYPE",
|
|
272
|
+
message_parameters={"expected": "pandas.Series", "actual": type(result).__name__},
|
|
273
|
+
)
|
|
274
|
+
|
|
275
|
+
|
|
276
|
+
def wrap_arrow_batch_iter_udf(f, return_type):
|
|
277
|
+
arrow_return_type = to_arrow_type(return_type)
|
|
278
|
+
|
|
279
|
+
def verify_result(result):
|
|
280
|
+
if not isinstance(result, Iterator) and not hasattr(result, "__iter__"):
|
|
281
|
+
raise PySparkTypeError(
|
|
282
|
+
error_class="UDF_RETURN_TYPE",
|
|
283
|
+
message_parameters={
|
|
284
|
+
"expected": "iterator of pyarrow.RecordBatch",
|
|
285
|
+
"actual": type(result).__name__,
|
|
286
|
+
},
|
|
287
|
+
)
|
|
288
|
+
return result
|
|
289
|
+
|
|
290
|
+
def verify_element(elem):
|
|
291
|
+
import pyarrow as pa
|
|
292
|
+
|
|
293
|
+
if not isinstance(elem, pa.RecordBatch):
|
|
294
|
+
raise PySparkTypeError(
|
|
295
|
+
error_class="UDF_RETURN_TYPE",
|
|
296
|
+
message_parameters={
|
|
297
|
+
"expected": "iterator of pyarrow.RecordBatch",
|
|
298
|
+
"actual": "iterator of {}".format(type(elem).__name__),
|
|
299
|
+
},
|
|
300
|
+
)
|
|
301
|
+
|
|
302
|
+
return elem
|
|
303
|
+
|
|
304
|
+
return lambda *iterator: map(
|
|
305
|
+
lambda res: (res, arrow_return_type), map(verify_element, verify_result(f(*iterator)))
|
|
306
|
+
)
|
|
307
|
+
|
|
308
|
+
|
|
309
|
+
def wrap_cogrouped_map_pandas_udf(f, return_type, argspec, runner_conf):
|
|
310
|
+
_assign_cols_by_name = assign_cols_by_name(runner_conf)
|
|
311
|
+
|
|
312
|
+
def wrapped(left_key_series, left_value_series, right_key_series, right_value_series):
|
|
313
|
+
import pandas as pd
|
|
314
|
+
|
|
315
|
+
left_df = pd.concat(left_value_series, axis=1)
|
|
316
|
+
right_df = pd.concat(right_value_series, axis=1)
|
|
317
|
+
|
|
318
|
+
if len(argspec.args) == 2:
|
|
319
|
+
result = f(left_df, right_df)
|
|
320
|
+
elif len(argspec.args) == 3:
|
|
321
|
+
key_series = left_key_series if not left_df.empty else right_key_series
|
|
322
|
+
key = tuple(s[0] for s in key_series)
|
|
323
|
+
result = f(key, left_df, right_df)
|
|
324
|
+
verify_pandas_result(
|
|
325
|
+
result, return_type, _assign_cols_by_name, truncate_return_schema=False
|
|
326
|
+
)
|
|
327
|
+
|
|
328
|
+
return result
|
|
329
|
+
|
|
330
|
+
return lambda kl, vl, kr, vr: [(wrapped(kl, vl, kr, vr), to_arrow_type(return_type))]
|
|
331
|
+
|
|
332
|
+
|
|
333
|
+
def wrap_grouped_map_pandas_udf(f, return_type, argspec, runner_conf):
|
|
334
|
+
_assign_cols_by_name = assign_cols_by_name(runner_conf)
|
|
335
|
+
|
|
336
|
+
def wrapped(key_series, value_series):
|
|
337
|
+
import pandas as pd
|
|
338
|
+
|
|
339
|
+
if len(argspec.args) == 1:
|
|
340
|
+
result = f(pd.concat(value_series, axis=1))
|
|
341
|
+
elif len(argspec.args) == 2:
|
|
342
|
+
key = tuple(s[0] for s in key_series)
|
|
343
|
+
result = f(key, pd.concat(value_series, axis=1))
|
|
344
|
+
verify_pandas_result(
|
|
345
|
+
result, return_type, _assign_cols_by_name, truncate_return_schema=False
|
|
346
|
+
)
|
|
347
|
+
|
|
348
|
+
return result
|
|
349
|
+
|
|
350
|
+
return lambda k, v: [(wrapped(k, v), to_arrow_type(return_type))]
|
|
351
|
+
|
|
352
|
+
|
|
353
|
+
def wrap_grouped_map_pandas_udf_with_state(f, return_type):
|
|
354
|
+
"""
|
|
355
|
+
Provides a new lambda instance wrapping user function of applyInPandasWithState.
|
|
356
|
+
|
|
357
|
+
The lambda instance receives (key series, iterator of value series, state) and performs
|
|
358
|
+
some conversion to be adapted with the signature of user function.
|
|
359
|
+
|
|
360
|
+
See the function doc of inner function `wrapped` for more details on what adapter does.
|
|
361
|
+
See the function doc of `mapper` function for
|
|
362
|
+
`eval_type == PythonEvalType.SQL_GROUPED_MAP_PANDAS_UDF_WITH_STATE` for more details on
|
|
363
|
+
the input parameters of lambda function.
|
|
364
|
+
|
|
365
|
+
Along with the returned iterator, the lambda instance will also produce the return_type as
|
|
366
|
+
converted to the arrow schema.
|
|
367
|
+
"""
|
|
368
|
+
|
|
369
|
+
def wrapped(key_series, value_series_gen, state):
|
|
370
|
+
"""
|
|
371
|
+
Provide an adapter of the user function performing below:
|
|
372
|
+
|
|
373
|
+
- Extract the first value of all columns in key series and produce as a tuple.
|
|
374
|
+
- If the state has timed out, call the user function with empty pandas DataFrame.
|
|
375
|
+
- If not, construct a new generator which converts each element of value series to
|
|
376
|
+
pandas DataFrame (lazy evaluation), and call the user function with the generator
|
|
377
|
+
- Verify each element of returned iterator to check the schema of pandas DataFrame.
|
|
378
|
+
"""
|
|
379
|
+
import pandas as pd
|
|
380
|
+
|
|
381
|
+
key = tuple(s[0] for s in key_series)
|
|
382
|
+
|
|
383
|
+
if state.hasTimedOut:
|
|
384
|
+
# Timeout processing pass empty iterator. Here we return an empty DataFrame instead.
|
|
385
|
+
values = [
|
|
386
|
+
pd.DataFrame(columns=pd.concat(next(value_series_gen), axis=1).columns),
|
|
387
|
+
]
|
|
388
|
+
else:
|
|
389
|
+
values = (pd.concat(x, axis=1) for x in value_series_gen)
|
|
390
|
+
|
|
391
|
+
result_iter = f(key, values, state)
|
|
392
|
+
|
|
393
|
+
def verify_element(result):
|
|
394
|
+
if not isinstance(result, pd.DataFrame):
|
|
395
|
+
raise PySparkTypeError(
|
|
396
|
+
error_class="UDF_RETURN_TYPE",
|
|
397
|
+
message_parameters={
|
|
398
|
+
"expected": "iterator of pandas.DataFrame",
|
|
399
|
+
"actual": "iterator of {}".format(type(result).__name__),
|
|
400
|
+
},
|
|
401
|
+
)
|
|
402
|
+
# the number of columns of result have to match the return type
|
|
403
|
+
# but it is fine for result to have no columns at all if it is empty
|
|
404
|
+
if not (
|
|
405
|
+
len(result.columns) == len(return_type)
|
|
406
|
+
or (len(result.columns) == 0 and result.empty)
|
|
407
|
+
):
|
|
408
|
+
raise PySparkRuntimeError(
|
|
409
|
+
error_class="RESULT_LENGTH_MISMATCH_FOR_PANDAS_UDF",
|
|
410
|
+
message_parameters={
|
|
411
|
+
"expected": str(len(return_type)),
|
|
412
|
+
"actual": str(len(result.columns)),
|
|
413
|
+
},
|
|
414
|
+
)
|
|
415
|
+
|
|
416
|
+
return result
|
|
417
|
+
|
|
418
|
+
if isinstance(result_iter, pd.DataFrame):
|
|
419
|
+
raise PySparkTypeError(
|
|
420
|
+
error_class="UDF_RETURN_TYPE",
|
|
421
|
+
message_parameters={
|
|
422
|
+
"expected": "iterable of pandas.DataFrame",
|
|
423
|
+
"actual": type(result_iter).__name__,
|
|
424
|
+
},
|
|
425
|
+
)
|
|
426
|
+
|
|
427
|
+
try:
|
|
428
|
+
iter(result_iter)
|
|
429
|
+
except TypeError:
|
|
430
|
+
raise PySparkTypeError(
|
|
431
|
+
error_class="UDF_RETURN_TYPE",
|
|
432
|
+
message_parameters={"expected": "iterable", "actual": type(result_iter).__name__},
|
|
433
|
+
)
|
|
434
|
+
|
|
435
|
+
result_iter_with_validation = (verify_element(x) for x in result_iter)
|
|
436
|
+
|
|
437
|
+
return (
|
|
438
|
+
result_iter_with_validation,
|
|
439
|
+
state,
|
|
440
|
+
)
|
|
441
|
+
|
|
442
|
+
return lambda k, v, s: [(wrapped(k, v, s), to_arrow_type(return_type))]
|
|
443
|
+
|
|
444
|
+
|
|
445
|
+
def wrap_grouped_agg_pandas_udf(f, return_type):
|
|
446
|
+
arrow_return_type = to_arrow_type(return_type)
|
|
447
|
+
|
|
448
|
+
def wrapped(*series):
|
|
449
|
+
import pandas as pd
|
|
450
|
+
|
|
451
|
+
result = f(*series)
|
|
452
|
+
return pd.Series([result])
|
|
453
|
+
|
|
454
|
+
return lambda *a: (wrapped(*a), arrow_return_type)
|
|
455
|
+
|
|
456
|
+
|
|
457
|
+
def wrap_window_agg_pandas_udf(f, return_type, runner_conf, udf_index):
|
|
458
|
+
window_bound_types_str = runner_conf.get("pandas_window_bound_types")
|
|
459
|
+
window_bound_type = [t.strip().lower() for t in window_bound_types_str.split(",")][udf_index]
|
|
460
|
+
if window_bound_type == "bounded":
|
|
461
|
+
return wrap_bounded_window_agg_pandas_udf(f, return_type)
|
|
462
|
+
elif window_bound_type == "unbounded":
|
|
463
|
+
return wrap_unbounded_window_agg_pandas_udf(f, return_type)
|
|
464
|
+
else:
|
|
465
|
+
raise PySparkRuntimeError(
|
|
466
|
+
error_class="INVALID_WINDOW_BOUND_TYPE",
|
|
467
|
+
message_parameters={
|
|
468
|
+
"window_bound_type": window_bound_type,
|
|
469
|
+
},
|
|
470
|
+
)
|
|
471
|
+
|
|
472
|
+
|
|
473
|
+
def wrap_unbounded_window_agg_pandas_udf(f, return_type):
|
|
474
|
+
# This is similar to grouped_agg_pandas_udf, the only difference
|
|
475
|
+
# is that window_agg_pandas_udf needs to repeat the return value
|
|
476
|
+
# to match window length, where grouped_agg_pandas_udf just returns
|
|
477
|
+
# the scalar value.
|
|
478
|
+
arrow_return_type = to_arrow_type(return_type)
|
|
479
|
+
|
|
480
|
+
def wrapped(*series):
|
|
481
|
+
import pandas as pd
|
|
482
|
+
|
|
483
|
+
result = f(*series)
|
|
484
|
+
return pd.Series([result]).repeat(len(series[0]))
|
|
485
|
+
|
|
486
|
+
return lambda *a: (wrapped(*a), arrow_return_type)
|
|
487
|
+
|
|
488
|
+
|
|
489
|
+
def wrap_bounded_window_agg_pandas_udf(f, return_type):
|
|
490
|
+
arrow_return_type = to_arrow_type(return_type)
|
|
491
|
+
|
|
492
|
+
def wrapped(begin_index, end_index, *series):
|
|
493
|
+
import pandas as pd
|
|
494
|
+
|
|
495
|
+
result = []
|
|
496
|
+
|
|
497
|
+
# Index operation is faster on np.ndarray,
|
|
498
|
+
# So we turn the index series into np array
|
|
499
|
+
# here for performance
|
|
500
|
+
begin_array = begin_index.values
|
|
501
|
+
end_array = end_index.values
|
|
502
|
+
|
|
503
|
+
for i in range(len(begin_array)):
|
|
504
|
+
# Note: Create a slice from a series for each window is
|
|
505
|
+
# actually pretty expensive. However, there
|
|
506
|
+
# is no easy way to reduce cost here.
|
|
507
|
+
# Note: s.iloc[i : j] is about 30% faster than s[i: j], with
|
|
508
|
+
# the caveat that the created slices shares the same
|
|
509
|
+
# memory with s. Therefore, user are not allowed to
|
|
510
|
+
# change the value of input series inside the window
|
|
511
|
+
# function. It is rare that user needs to modify the
|
|
512
|
+
# input series in the window function, and therefore,
|
|
513
|
+
# it is be a reasonable restriction.
|
|
514
|
+
# Note: Calling reset_index on the slices will increase the cost
|
|
515
|
+
# of creating slices by about 100%. Therefore, for performance
|
|
516
|
+
# reasons we don't do it here.
|
|
517
|
+
series_slices = [s.iloc[begin_array[i] : end_array[i]] for s in series]
|
|
518
|
+
result.append(f(*series_slices))
|
|
519
|
+
return pd.Series(result)
|
|
520
|
+
|
|
521
|
+
return lambda *a: (wrapped(*a), arrow_return_type)
|
|
522
|
+
|
|
523
|
+
|
|
524
|
+
def read_single_udf(pickleSer, infile, eval_type, runner_conf, udf_index):
|
|
525
|
+
num_arg = read_int(infile)
|
|
526
|
+
arg_offsets = [read_int(infile) for i in range(num_arg)]
|
|
527
|
+
chained_func = None
|
|
528
|
+
for i in range(read_int(infile)):
|
|
529
|
+
f, return_type = read_command(pickleSer, infile)
|
|
530
|
+
if chained_func is None:
|
|
531
|
+
chained_func = f
|
|
532
|
+
else:
|
|
533
|
+
chained_func = chain(chained_func, f)
|
|
534
|
+
|
|
535
|
+
if eval_type in (
|
|
536
|
+
PythonEvalType.SQL_SCALAR_PANDAS_ITER_UDF,
|
|
537
|
+
PythonEvalType.SQL_ARROW_BATCHED_UDF,
|
|
538
|
+
):
|
|
539
|
+
func = chained_func
|
|
540
|
+
else:
|
|
541
|
+
# make sure StopIteration's raised in the user code are not ignored
|
|
542
|
+
# when they are processed in a for loop, raise them as RuntimeError's instead
|
|
543
|
+
func = fail_on_stopiteration(chained_func)
|
|
544
|
+
|
|
545
|
+
# the last returnType will be the return type of UDF
|
|
546
|
+
if eval_type == PythonEvalType.SQL_SCALAR_PANDAS_UDF:
|
|
547
|
+
return arg_offsets, wrap_scalar_pandas_udf(func, return_type)
|
|
548
|
+
elif eval_type == PythonEvalType.SQL_ARROW_BATCHED_UDF:
|
|
549
|
+
return arg_offsets, wrap_arrow_batch_udf(func, return_type)
|
|
550
|
+
elif eval_type == PythonEvalType.SQL_SCALAR_PANDAS_ITER_UDF:
|
|
551
|
+
return arg_offsets, wrap_pandas_batch_iter_udf(func, return_type)
|
|
552
|
+
elif eval_type == PythonEvalType.SQL_MAP_PANDAS_ITER_UDF:
|
|
553
|
+
return arg_offsets, wrap_pandas_batch_iter_udf(func, return_type)
|
|
554
|
+
elif eval_type == PythonEvalType.SQL_MAP_ARROW_ITER_UDF:
|
|
555
|
+
return arg_offsets, wrap_arrow_batch_iter_udf(func, return_type)
|
|
556
|
+
elif eval_type == PythonEvalType.SQL_GROUPED_MAP_PANDAS_UDF:
|
|
557
|
+
argspec = getfullargspec(chained_func) # signature was lost when wrapping it
|
|
558
|
+
return arg_offsets, wrap_grouped_map_pandas_udf(func, return_type, argspec, runner_conf)
|
|
559
|
+
elif eval_type == PythonEvalType.SQL_GROUPED_MAP_PANDAS_UDF_WITH_STATE:
|
|
560
|
+
return arg_offsets, wrap_grouped_map_pandas_udf_with_state(func, return_type)
|
|
561
|
+
elif eval_type == PythonEvalType.SQL_COGROUPED_MAP_PANDAS_UDF:
|
|
562
|
+
argspec = getfullargspec(chained_func) # signature was lost when wrapping it
|
|
563
|
+
return arg_offsets, wrap_cogrouped_map_pandas_udf(func, return_type, argspec, runner_conf)
|
|
564
|
+
elif eval_type == PythonEvalType.SQL_GROUPED_AGG_PANDAS_UDF:
|
|
565
|
+
return arg_offsets, wrap_grouped_agg_pandas_udf(func, return_type)
|
|
566
|
+
elif eval_type == PythonEvalType.SQL_WINDOW_AGG_PANDAS_UDF:
|
|
567
|
+
return arg_offsets, wrap_window_agg_pandas_udf(func, return_type, runner_conf, udf_index)
|
|
568
|
+
elif eval_type == PythonEvalType.SQL_BATCHED_UDF:
|
|
569
|
+
return arg_offsets, wrap_udf(func, return_type)
|
|
570
|
+
else:
|
|
571
|
+
raise ValueError("Unknown eval type: {}".format(eval_type))
|
|
572
|
+
|
|
573
|
+
|
|
574
|
+
# Used by SQL_GROUPED_MAP_PANDAS_UDF and SQL_SCALAR_PANDAS_UDF and SQL_ARROW_BATCHED_UDF when
|
|
575
|
+
# returning StructType
|
|
576
|
+
def assign_cols_by_name(runner_conf):
|
|
577
|
+
return (
|
|
578
|
+
runner_conf.get(
|
|
579
|
+
"spark.sql.legacy.execution.pandas.groupedMap.assignColumnsByName", "true"
|
|
580
|
+
).lower()
|
|
581
|
+
== "true"
|
|
582
|
+
)
|
|
583
|
+
|
|
584
|
+
|
|
585
|
+
# Read and process a serialized user-defined table function (UDTF) from a socket.
|
|
586
|
+
# It expects the UDTF to be in a specific format and performs various checks to
|
|
587
|
+
# ensure the UDTF is valid. This function also prepares a mapper function for applying
|
|
588
|
+
# the UDTF logic to input rows.
|
|
589
|
+
def read_udtf(pickleSer, infile, eval_type):
|
|
590
|
+
if eval_type == PythonEvalType.SQL_ARROW_TABLE_UDF:
|
|
591
|
+
runner_conf = {}
|
|
592
|
+
# Load conf used for arrow evaluation.
|
|
593
|
+
num_conf = read_int(infile)
|
|
594
|
+
for i in range(num_conf):
|
|
595
|
+
k = utf8_deserializer.loads(infile)
|
|
596
|
+
v = utf8_deserializer.loads(infile)
|
|
597
|
+
runner_conf[k] = v
|
|
598
|
+
|
|
599
|
+
# NOTE: if timezone is set here, that implies respectSessionTimeZone is True
|
|
600
|
+
timezone = runner_conf.get("spark.sql.session.timeZone", None)
|
|
601
|
+
safecheck = (
|
|
602
|
+
runner_conf.get("spark.sql.execution.pandas.convertToArrowArraySafely", "false").lower()
|
|
603
|
+
== "true"
|
|
604
|
+
)
|
|
605
|
+
ser = ArrowStreamPandasUDTFSerializer(timezone, safecheck)
|
|
606
|
+
else:
|
|
607
|
+
# Each row is a group so do not batch but send one by one.
|
|
608
|
+
ser = BatchedSerializer(CPickleSerializer(), 1)
|
|
609
|
+
|
|
610
|
+
# See `PythonUDTFRunner.PythonUDFWriterThread.writeCommand'
|
|
611
|
+
num_arg = read_int(infile)
|
|
612
|
+
arg_offsets = [read_int(infile) for _ in range(num_arg)]
|
|
613
|
+
handler = read_command(pickleSer, infile)
|
|
614
|
+
if not isinstance(handler, type):
|
|
615
|
+
raise PySparkRuntimeError(
|
|
616
|
+
f"Invalid UDTF handler type. Expected a class (type 'type'), but "
|
|
617
|
+
f"got an instance of {type(handler).__name__}."
|
|
618
|
+
)
|
|
619
|
+
|
|
620
|
+
return_type = _parse_datatype_json_string(utf8_deserializer.loads(infile))
|
|
621
|
+
if not type(return_type) == StructType:
|
|
622
|
+
raise PySparkRuntimeError(
|
|
623
|
+
f"The return type of a UDTF must be a struct type, but got {type(return_type)}."
|
|
624
|
+
)
|
|
625
|
+
|
|
626
|
+
# Instantiate the UDTF class.
|
|
627
|
+
try:
|
|
628
|
+
udtf = handler()
|
|
629
|
+
except Exception as e:
|
|
630
|
+
raise PySparkRuntimeError(
|
|
631
|
+
error_class="UDTF_EXEC_ERROR",
|
|
632
|
+
message_parameters={"method_name": "__init__", "error": str(e)},
|
|
633
|
+
)
|
|
634
|
+
|
|
635
|
+
# Validate the UDTF
|
|
636
|
+
if not hasattr(udtf, "eval"):
|
|
637
|
+
raise PySparkRuntimeError(
|
|
638
|
+
"Failed to execute the user defined table function because it has not "
|
|
639
|
+
"implemented the 'eval' method. Please add the 'eval' method and try "
|
|
640
|
+
"the query again."
|
|
641
|
+
)
|
|
642
|
+
|
|
643
|
+
if eval_type == PythonEvalType.SQL_ARROW_TABLE_UDF:
|
|
644
|
+
|
|
645
|
+
def wrap_arrow_udtf(f, return_type):
|
|
646
|
+
import pandas as pd
|
|
647
|
+
|
|
648
|
+
arrow_return_type = to_arrow_type(return_type)
|
|
649
|
+
return_type_size = len(return_type)
|
|
650
|
+
|
|
651
|
+
def verify_result(result):
|
|
652
|
+
if not isinstance(result, pd.DataFrame):
|
|
653
|
+
raise PySparkTypeError(
|
|
654
|
+
error_class="INVALID_ARROW_UDTF_RETURN_TYPE",
|
|
655
|
+
message_parameters={
|
|
656
|
+
"type_name": type(result).__name__,
|
|
657
|
+
"value": str(result),
|
|
658
|
+
"func": f.__name__,
|
|
659
|
+
},
|
|
660
|
+
)
|
|
661
|
+
|
|
662
|
+
# Validate the output schema when the result dataframe has either output
|
|
663
|
+
# rows or columns. Note that we avoid using `df.empty` here because the
|
|
664
|
+
# result dataframe may contain an empty row. For example, when a UDTF is
|
|
665
|
+
# defined as follows: def eval(self): yield tuple().
|
|
666
|
+
if len(result) > 0 or len(result.columns) > 0:
|
|
667
|
+
if len(result.columns) != return_type_size:
|
|
668
|
+
raise PySparkRuntimeError(
|
|
669
|
+
error_class="UDTF_RETURN_SCHEMA_MISMATCH",
|
|
670
|
+
message_parameters={
|
|
671
|
+
"expected": str(return_type_size),
|
|
672
|
+
"actual": str(len(result.columns)),
|
|
673
|
+
"func": f.__name__,
|
|
674
|
+
},
|
|
675
|
+
)
|
|
676
|
+
|
|
677
|
+
# Verify the type and the schema of the result.
|
|
678
|
+
verify_pandas_result(
|
|
679
|
+
result, return_type, assign_cols_by_name=False, truncate_return_schema=False
|
|
680
|
+
)
|
|
681
|
+
return result
|
|
682
|
+
|
|
683
|
+
# Wrap the exception thrown from the UDTF in a PySparkRuntimeError.
|
|
684
|
+
def func(*args: Any) -> Any:
|
|
685
|
+
try:
|
|
686
|
+
return f(*args)
|
|
687
|
+
except Exception as e:
|
|
688
|
+
raise PySparkRuntimeError(
|
|
689
|
+
error_class="UDTF_EXEC_ERROR",
|
|
690
|
+
message_parameters={"method_name": f.__name__, "error": str(e)},
|
|
691
|
+
)
|
|
692
|
+
|
|
693
|
+
def check_return_value(res):
|
|
694
|
+
# Check whether the result of an arrow UDTF is iterable before
|
|
695
|
+
# using it to construct a pandas DataFrame.
|
|
696
|
+
if res is not None and not isinstance(res, Iterable):
|
|
697
|
+
raise PySparkRuntimeError(
|
|
698
|
+
error_class="UDTF_RETURN_NOT_ITERABLE",
|
|
699
|
+
message_parameters={
|
|
700
|
+
"type": type(res).__name__,
|
|
701
|
+
"func": f.__name__,
|
|
702
|
+
},
|
|
703
|
+
)
|
|
704
|
+
|
|
705
|
+
def evaluate(*args: pd.Series):
|
|
706
|
+
if len(args) == 0:
|
|
707
|
+
res = func()
|
|
708
|
+
check_return_value(res)
|
|
709
|
+
yield verify_result(pd.DataFrame(res)), arrow_return_type
|
|
710
|
+
else:
|
|
711
|
+
# Create tuples from the input pandas Series, each tuple
|
|
712
|
+
# represents a row across all Series.
|
|
713
|
+
row_tuples = zip(*args)
|
|
714
|
+
for row in row_tuples:
|
|
715
|
+
res = func(*row)
|
|
716
|
+
check_return_value(res)
|
|
717
|
+
yield verify_result(pd.DataFrame(res)), arrow_return_type
|
|
718
|
+
|
|
719
|
+
return evaluate
|
|
720
|
+
|
|
721
|
+
eval = wrap_arrow_udtf(getattr(udtf, "eval"), return_type)
|
|
722
|
+
|
|
723
|
+
if hasattr(udtf, "terminate"):
|
|
724
|
+
terminate = wrap_arrow_udtf(getattr(udtf, "terminate"), return_type)
|
|
725
|
+
else:
|
|
726
|
+
terminate = None
|
|
727
|
+
|
|
728
|
+
def mapper(_, it):
|
|
729
|
+
try:
|
|
730
|
+
for a in it:
|
|
731
|
+
# The eval function yields an iterator. Each element produced by this
|
|
732
|
+
# iterator is a tuple in the form of (pandas.DataFrame, arrow_return_type).
|
|
733
|
+
yield from eval(*[a[o] for o in arg_offsets])
|
|
734
|
+
finally:
|
|
735
|
+
if terminate is not None:
|
|
736
|
+
yield from terminate()
|
|
737
|
+
|
|
738
|
+
return mapper, None, ser, ser
|
|
739
|
+
|
|
740
|
+
else:
|
|
741
|
+
|
|
742
|
+
def wrap_udtf(f, return_type):
|
|
743
|
+
assert return_type.needConversion()
|
|
744
|
+
toInternal = return_type.toInternal
|
|
745
|
+
return_type_size = len(return_type)
|
|
746
|
+
|
|
747
|
+
def verify_and_convert_result(result):
|
|
748
|
+
if result is not None:
|
|
749
|
+
if hasattr(result, "__len__") and len(result) != return_type_size:
|
|
750
|
+
raise PySparkRuntimeError(
|
|
751
|
+
error_class="UDTF_RETURN_SCHEMA_MISMATCH",
|
|
752
|
+
message_parameters={
|
|
753
|
+
"expected": str(return_type_size),
|
|
754
|
+
"actual": str(len(result)),
|
|
755
|
+
"func": f.__name__,
|
|
756
|
+
},
|
|
757
|
+
)
|
|
758
|
+
|
|
759
|
+
if not (isinstance(result, (list, dict, tuple)) or hasattr(result, "__dict__")):
|
|
760
|
+
raise PySparkRuntimeError(
|
|
761
|
+
error_class="UDTF_INVALID_OUTPUT_ROW_TYPE",
|
|
762
|
+
message_parameters={
|
|
763
|
+
"type": type(result).__name__,
|
|
764
|
+
"func": f.__name__,
|
|
765
|
+
},
|
|
766
|
+
)
|
|
767
|
+
|
|
768
|
+
return toInternal(result)
|
|
769
|
+
|
|
770
|
+
# Evaluate the function and return a tuple back to the executor.
|
|
771
|
+
def evaluate(*a) -> tuple:
|
|
772
|
+
try:
|
|
773
|
+
res = f(*a)
|
|
774
|
+
except Exception as e:
|
|
775
|
+
raise PySparkRuntimeError(
|
|
776
|
+
error_class="UDTF_EXEC_ERROR",
|
|
777
|
+
message_parameters={"method_name": f.__name__, "error": str(e)},
|
|
778
|
+
)
|
|
779
|
+
|
|
780
|
+
if res is None:
|
|
781
|
+
# If the function returns None or does not have an explicit return statement,
|
|
782
|
+
# an empty tuple is returned to the executor.
|
|
783
|
+
# This is because directly constructing tuple(None) results in an exception.
|
|
784
|
+
return tuple()
|
|
785
|
+
|
|
786
|
+
if not isinstance(res, Iterable):
|
|
787
|
+
raise PySparkRuntimeError(
|
|
788
|
+
error_class="UDTF_RETURN_NOT_ITERABLE",
|
|
789
|
+
message_parameters={
|
|
790
|
+
"type": type(res).__name__,
|
|
791
|
+
"func": f.__name__,
|
|
792
|
+
},
|
|
793
|
+
)
|
|
794
|
+
|
|
795
|
+
# If the function returns a result, we map it to the internal representation and
|
|
796
|
+
# returns the results as a tuple.
|
|
797
|
+
return tuple(map(verify_and_convert_result, res))
|
|
798
|
+
|
|
799
|
+
return evaluate
|
|
800
|
+
|
|
801
|
+
eval = wrap_udtf(getattr(udtf, "eval"), return_type)
|
|
802
|
+
|
|
803
|
+
if hasattr(udtf, "terminate"):
|
|
804
|
+
terminate = wrap_udtf(getattr(udtf, "terminate"), return_type)
|
|
805
|
+
else:
|
|
806
|
+
terminate = None
|
|
807
|
+
|
|
808
|
+
# Return an iterator of iterators.
|
|
809
|
+
def mapper(_, it):
|
|
810
|
+
try:
|
|
811
|
+
for a in it:
|
|
812
|
+
yield eval(*[a[o] for o in arg_offsets])
|
|
813
|
+
finally:
|
|
814
|
+
if terminate is not None:
|
|
815
|
+
yield terminate()
|
|
816
|
+
|
|
817
|
+
return mapper, None, ser, ser
|
|
818
|
+
|
|
819
|
+
|
|
820
|
+
def read_udfs(pickleSer, infile, eval_type):
|
|
821
|
+
runner_conf = {}
|
|
822
|
+
|
|
823
|
+
if eval_type in (
|
|
824
|
+
PythonEvalType.SQL_ARROW_BATCHED_UDF,
|
|
825
|
+
PythonEvalType.SQL_SCALAR_PANDAS_UDF,
|
|
826
|
+
PythonEvalType.SQL_COGROUPED_MAP_PANDAS_UDF,
|
|
827
|
+
PythonEvalType.SQL_SCALAR_PANDAS_ITER_UDF,
|
|
828
|
+
PythonEvalType.SQL_MAP_PANDAS_ITER_UDF,
|
|
829
|
+
PythonEvalType.SQL_MAP_ARROW_ITER_UDF,
|
|
830
|
+
PythonEvalType.SQL_GROUPED_MAP_PANDAS_UDF,
|
|
831
|
+
PythonEvalType.SQL_GROUPED_AGG_PANDAS_UDF,
|
|
832
|
+
PythonEvalType.SQL_WINDOW_AGG_PANDAS_UDF,
|
|
833
|
+
PythonEvalType.SQL_GROUPED_MAP_PANDAS_UDF_WITH_STATE,
|
|
834
|
+
):
|
|
835
|
+
|
|
836
|
+
# Load conf used for pandas_udf evaluation
|
|
837
|
+
num_conf = read_int(infile)
|
|
838
|
+
for i in range(num_conf):
|
|
839
|
+
k = utf8_deserializer.loads(infile)
|
|
840
|
+
v = utf8_deserializer.loads(infile)
|
|
841
|
+
runner_conf[k] = v
|
|
842
|
+
|
|
843
|
+
state_object_schema = None
|
|
844
|
+
if eval_type == PythonEvalType.SQL_GROUPED_MAP_PANDAS_UDF_WITH_STATE:
|
|
845
|
+
state_object_schema = StructType.fromJson(json.loads(utf8_deserializer.loads(infile)))
|
|
846
|
+
|
|
847
|
+
# NOTE: if timezone is set here, that implies respectSessionTimeZone is True
|
|
848
|
+
timezone = runner_conf.get("spark.sql.session.timeZone", None)
|
|
849
|
+
safecheck = (
|
|
850
|
+
runner_conf.get("spark.sql.execution.pandas.convertToArrowArraySafely", "false").lower()
|
|
851
|
+
== "true"
|
|
852
|
+
)
|
|
853
|
+
|
|
854
|
+
if eval_type == PythonEvalType.SQL_COGROUPED_MAP_PANDAS_UDF:
|
|
855
|
+
ser = CogroupUDFSerializer(timezone, safecheck, assign_cols_by_name(runner_conf))
|
|
856
|
+
elif eval_type == PythonEvalType.SQL_GROUPED_MAP_PANDAS_UDF_WITH_STATE:
|
|
857
|
+
arrow_max_records_per_batch = runner_conf.get(
|
|
858
|
+
"spark.sql.execution.arrow.maxRecordsPerBatch", 10000
|
|
859
|
+
)
|
|
860
|
+
arrow_max_records_per_batch = int(arrow_max_records_per_batch)
|
|
861
|
+
|
|
862
|
+
ser = ApplyInPandasWithStateSerializer(
|
|
863
|
+
timezone,
|
|
864
|
+
safecheck,
|
|
865
|
+
assign_cols_by_name(runner_conf),
|
|
866
|
+
state_object_schema,
|
|
867
|
+
arrow_max_records_per_batch,
|
|
868
|
+
)
|
|
869
|
+
elif eval_type == PythonEvalType.SQL_MAP_ARROW_ITER_UDF:
|
|
870
|
+
ser = ArrowStreamUDFSerializer()
|
|
871
|
+
else:
|
|
872
|
+
# Scalar Pandas UDF handles struct type arguments as pandas DataFrames instead of
|
|
873
|
+
# pandas Series. See SPARK-27240.
|
|
874
|
+
df_for_struct = (
|
|
875
|
+
eval_type == PythonEvalType.SQL_SCALAR_PANDAS_UDF
|
|
876
|
+
or eval_type == PythonEvalType.SQL_SCALAR_PANDAS_ITER_UDF
|
|
877
|
+
or eval_type == PythonEvalType.SQL_MAP_PANDAS_ITER_UDF
|
|
878
|
+
)
|
|
879
|
+
# Arrow-optimized Python UDF takes a struct type argument as a Row
|
|
880
|
+
struct_in_pandas = (
|
|
881
|
+
"row" if eval_type == PythonEvalType.SQL_ARROW_BATCHED_UDF else "dict"
|
|
882
|
+
)
|
|
883
|
+
ndarray_as_list = eval_type == PythonEvalType.SQL_ARROW_BATCHED_UDF
|
|
884
|
+
# Arrow-optimized Python UDF uses explicit Arrow cast for type coercion
|
|
885
|
+
arrow_cast = eval_type == PythonEvalType.SQL_ARROW_BATCHED_UDF
|
|
886
|
+
ser = ArrowStreamPandasUDFSerializer(
|
|
887
|
+
timezone,
|
|
888
|
+
safecheck,
|
|
889
|
+
assign_cols_by_name(runner_conf),
|
|
890
|
+
df_for_struct,
|
|
891
|
+
struct_in_pandas,
|
|
892
|
+
ndarray_as_list,
|
|
893
|
+
arrow_cast,
|
|
894
|
+
)
|
|
895
|
+
else:
|
|
896
|
+
ser = BatchedSerializer(CPickleSerializer(), 100)
|
|
897
|
+
|
|
898
|
+
num_udfs = read_int(infile)
|
|
899
|
+
|
|
900
|
+
is_scalar_iter = eval_type == PythonEvalType.SQL_SCALAR_PANDAS_ITER_UDF
|
|
901
|
+
is_map_pandas_iter = eval_type == PythonEvalType.SQL_MAP_PANDAS_ITER_UDF
|
|
902
|
+
is_map_arrow_iter = eval_type == PythonEvalType.SQL_MAP_ARROW_ITER_UDF
|
|
903
|
+
|
|
904
|
+
if is_scalar_iter or is_map_pandas_iter or is_map_arrow_iter:
|
|
905
|
+
if is_scalar_iter:
|
|
906
|
+
assert num_udfs == 1, "One SCALAR_ITER UDF expected here."
|
|
907
|
+
if is_map_pandas_iter:
|
|
908
|
+
assert num_udfs == 1, "One MAP_PANDAS_ITER UDF expected here."
|
|
909
|
+
if is_map_arrow_iter:
|
|
910
|
+
assert num_udfs == 1, "One MAP_ARROW_ITER UDF expected here."
|
|
911
|
+
|
|
912
|
+
arg_offsets, udf = read_single_udf(pickleSer, infile, eval_type, runner_conf, udf_index=0)
|
|
913
|
+
|
|
914
|
+
def func(_, iterator):
|
|
915
|
+
num_input_rows = 0
|
|
916
|
+
|
|
917
|
+
def map_batch(batch):
|
|
918
|
+
nonlocal num_input_rows
|
|
919
|
+
|
|
920
|
+
udf_args = [batch[offset] for offset in arg_offsets]
|
|
921
|
+
num_input_rows += len(udf_args[0])
|
|
922
|
+
if len(udf_args) == 1:
|
|
923
|
+
return udf_args[0]
|
|
924
|
+
else:
|
|
925
|
+
return tuple(udf_args)
|
|
926
|
+
|
|
927
|
+
iterator = map(map_batch, iterator)
|
|
928
|
+
result_iter = udf(iterator)
|
|
929
|
+
|
|
930
|
+
num_output_rows = 0
|
|
931
|
+
for result_batch, result_type in result_iter:
|
|
932
|
+
num_output_rows += len(result_batch)
|
|
933
|
+
# This assert is for Scalar Iterator UDF to fail fast.
|
|
934
|
+
# The length of the entire input can only be explicitly known
|
|
935
|
+
# by consuming the input iterator in user side. Therefore,
|
|
936
|
+
# it's very unlikely the output length is higher than
|
|
937
|
+
# input length.
|
|
938
|
+
assert (
|
|
939
|
+
is_map_pandas_iter or is_map_arrow_iter or num_output_rows <= num_input_rows
|
|
940
|
+
), "Pandas SCALAR_ITER UDF outputted more rows than input rows."
|
|
941
|
+
yield (result_batch, result_type)
|
|
942
|
+
|
|
943
|
+
if is_scalar_iter:
|
|
944
|
+
try:
|
|
945
|
+
next(iterator)
|
|
946
|
+
except StopIteration:
|
|
947
|
+
pass
|
|
948
|
+
else:
|
|
949
|
+
raise PySparkRuntimeError(
|
|
950
|
+
error_class="STOP_ITERATION_OCCURRED_FROM_SCALAR_ITER_PANDAS_UDF",
|
|
951
|
+
message_parameters={},
|
|
952
|
+
)
|
|
953
|
+
|
|
954
|
+
if num_output_rows != num_input_rows:
|
|
955
|
+
raise PySparkRuntimeError(
|
|
956
|
+
error_class="RESULT_LENGTH_MISMATCH_FOR_SCALAR_ITER_PANDAS_UDF",
|
|
957
|
+
message_parameters={
|
|
958
|
+
"output_length": str(num_output_rows),
|
|
959
|
+
"input_length": str(num_input_rows),
|
|
960
|
+
},
|
|
961
|
+
)
|
|
962
|
+
|
|
963
|
+
# profiling is not supported for UDF
|
|
964
|
+
return func, None, ser, ser
|
|
965
|
+
|
|
966
|
+
def extract_key_value_indexes(grouped_arg_offsets):
|
|
967
|
+
"""
|
|
968
|
+
Helper function to extract the key and value indexes from arg_offsets for the grouped and
|
|
969
|
+
cogrouped pandas udfs. See BasePandasGroupExec.resolveArgOffsets for equivalent scala code.
|
|
970
|
+
|
|
971
|
+
Parameters
|
|
972
|
+
----------
|
|
973
|
+
grouped_arg_offsets: list
|
|
974
|
+
List containing the key and value indexes of columns of the
|
|
975
|
+
DataFrames to be passed to the udf. It consists of n repeating groups where n is the
|
|
976
|
+
number of DataFrames. Each group has the following format:
|
|
977
|
+
group[0]: length of group
|
|
978
|
+
group[1]: length of key indexes
|
|
979
|
+
group[2.. group[1] +2]: key attributes
|
|
980
|
+
group[group[1] +3 group[0]]: value attributes
|
|
981
|
+
"""
|
|
982
|
+
parsed = []
|
|
983
|
+
idx = 0
|
|
984
|
+
while idx < len(grouped_arg_offsets):
|
|
985
|
+
offsets_len = grouped_arg_offsets[idx]
|
|
986
|
+
idx += 1
|
|
987
|
+
offsets = grouped_arg_offsets[idx : idx + offsets_len]
|
|
988
|
+
split_index = offsets[0] + 1
|
|
989
|
+
offset_keys = offsets[1:split_index]
|
|
990
|
+
offset_values = offsets[split_index:]
|
|
991
|
+
parsed.append([offset_keys, offset_values])
|
|
992
|
+
idx += offsets_len
|
|
993
|
+
return parsed
|
|
994
|
+
|
|
995
|
+
if eval_type == PythonEvalType.SQL_GROUPED_MAP_PANDAS_UDF:
|
|
996
|
+
# We assume there is only one UDF here because grouped map doesn't
|
|
997
|
+
# support combining multiple UDFs.
|
|
998
|
+
assert num_udfs == 1
|
|
999
|
+
|
|
1000
|
+
# See FlatMapGroupsInPandasExec for how arg_offsets are used to
|
|
1001
|
+
# distinguish between grouping attributes and data attributes
|
|
1002
|
+
arg_offsets, f = read_single_udf(pickleSer, infile, eval_type, runner_conf, udf_index=0)
|
|
1003
|
+
parsed_offsets = extract_key_value_indexes(arg_offsets)
|
|
1004
|
+
|
|
1005
|
+
# Create function like this:
|
|
1006
|
+
# mapper a: f([a[0]], [a[0], a[1]])
|
|
1007
|
+
def mapper(a):
|
|
1008
|
+
keys = [a[o] for o in parsed_offsets[0][0]]
|
|
1009
|
+
vals = [a[o] for o in parsed_offsets[0][1]]
|
|
1010
|
+
return f(keys, vals)
|
|
1011
|
+
|
|
1012
|
+
elif eval_type == PythonEvalType.SQL_GROUPED_MAP_PANDAS_UDF_WITH_STATE:
|
|
1013
|
+
# We assume there is only one UDF here because grouped map doesn't
|
|
1014
|
+
# support combining multiple UDFs.
|
|
1015
|
+
assert num_udfs == 1
|
|
1016
|
+
|
|
1017
|
+
# See FlatMapGroupsInPandas(WithState)Exec for how arg_offsets are used to
|
|
1018
|
+
# distinguish between grouping attributes and data attributes
|
|
1019
|
+
arg_offsets, f = read_single_udf(pickleSer, infile, eval_type, runner_conf, udf_index=0)
|
|
1020
|
+
parsed_offsets = extract_key_value_indexes(arg_offsets)
|
|
1021
|
+
|
|
1022
|
+
def mapper(a):
|
|
1023
|
+
"""
|
|
1024
|
+
The function receives (iterator of data, state) and performs extraction of key and
|
|
1025
|
+
value from the data, with retaining lazy evaluation.
|
|
1026
|
+
|
|
1027
|
+
See `load_stream` in `ApplyInPandasWithStateSerializer` for more details on the input
|
|
1028
|
+
and see `wrap_grouped_map_pandas_udf_with_state` for more details on how output will
|
|
1029
|
+
be used.
|
|
1030
|
+
"""
|
|
1031
|
+
from itertools import tee
|
|
1032
|
+
|
|
1033
|
+
state = a[1]
|
|
1034
|
+
data_gen = (x[0] for x in a[0])
|
|
1035
|
+
|
|
1036
|
+
# We know there should be at least one item in the iterator/generator.
|
|
1037
|
+
# We want to peek the first element to construct the key, hence applying
|
|
1038
|
+
# tee to construct the key while we retain another iterator/generator
|
|
1039
|
+
# for values.
|
|
1040
|
+
keys_gen, values_gen = tee(data_gen)
|
|
1041
|
+
keys_elem = next(keys_gen)
|
|
1042
|
+
keys = [keys_elem[o] for o in parsed_offsets[0][0]]
|
|
1043
|
+
|
|
1044
|
+
# This must be generator comprehension - do not materialize.
|
|
1045
|
+
vals = ([x[o] for o in parsed_offsets[0][1]] for x in values_gen)
|
|
1046
|
+
|
|
1047
|
+
return f(keys, vals, state)
|
|
1048
|
+
|
|
1049
|
+
elif eval_type == PythonEvalType.SQL_COGROUPED_MAP_PANDAS_UDF:
|
|
1050
|
+
# We assume there is only one UDF here because cogrouped map doesn't
|
|
1051
|
+
# support combining multiple UDFs.
|
|
1052
|
+
assert num_udfs == 1
|
|
1053
|
+
arg_offsets, f = read_single_udf(pickleSer, infile, eval_type, runner_conf, udf_index=0)
|
|
1054
|
+
|
|
1055
|
+
parsed_offsets = extract_key_value_indexes(arg_offsets)
|
|
1056
|
+
|
|
1057
|
+
def mapper(a):
|
|
1058
|
+
df1_keys = [a[0][o] for o in parsed_offsets[0][0]]
|
|
1059
|
+
df1_vals = [a[0][o] for o in parsed_offsets[0][1]]
|
|
1060
|
+
df2_keys = [a[1][o] for o in parsed_offsets[1][0]]
|
|
1061
|
+
df2_vals = [a[1][o] for o in parsed_offsets[1][1]]
|
|
1062
|
+
return f(df1_keys, df1_vals, df2_keys, df2_vals)
|
|
1063
|
+
|
|
1064
|
+
else:
|
|
1065
|
+
udfs = []
|
|
1066
|
+
for i in range(num_udfs):
|
|
1067
|
+
udfs.append(read_single_udf(pickleSer, infile, eval_type, runner_conf, udf_index=i))
|
|
1068
|
+
|
|
1069
|
+
def mapper(a):
|
|
1070
|
+
result = tuple(f(*[a[o] for o in arg_offsets]) for (arg_offsets, f) in udfs)
|
|
1071
|
+
# In the special case of a single UDF this will return a single result rather
|
|
1072
|
+
# than a tuple of results; this is the format that the JVM side expects.
|
|
1073
|
+
if len(result) == 1:
|
|
1074
|
+
return result[0]
|
|
1075
|
+
else:
|
|
1076
|
+
return result
|
|
1077
|
+
|
|
1078
|
+
def func(_, it):
|
|
1079
|
+
return map(mapper, it)
|
|
1080
|
+
|
|
1081
|
+
# profiling is not supported for UDF
|
|
1082
|
+
return func, None, ser, ser
|
|
1083
|
+
|
|
1084
|
+
|
|
1085
|
+
def main(infile, outfile):
|
|
1086
|
+
faulthandler_log_path = os.environ.get("PYTHON_FAULTHANDLER_DIR", None)
|
|
1087
|
+
try:
|
|
1088
|
+
if faulthandler_log_path:
|
|
1089
|
+
faulthandler_log_path = os.path.join(faulthandler_log_path, str(os.getpid()))
|
|
1090
|
+
faulthandler_log_file = open(faulthandler_log_path, "w")
|
|
1091
|
+
faulthandler.enable(file=faulthandler_log_file)
|
|
1092
|
+
|
|
1093
|
+
boot_time = time.time()
|
|
1094
|
+
split_index = read_int(infile)
|
|
1095
|
+
if split_index == -1: # for unit tests
|
|
1096
|
+
sys.exit(-1)
|
|
1097
|
+
|
|
1098
|
+
version = utf8_deserializer.loads(infile)
|
|
1099
|
+
if version != "%d.%d" % sys.version_info[:2]:
|
|
1100
|
+
raise PySparkRuntimeError(
|
|
1101
|
+
error_class="PYTHON_VERSION_MISMATCH",
|
|
1102
|
+
message_parameters={
|
|
1103
|
+
"worker_version": str(sys.version_info[:2]),
|
|
1104
|
+
"driver_version": str(version),
|
|
1105
|
+
},
|
|
1106
|
+
)
|
|
1107
|
+
|
|
1108
|
+
# read inputs only for a barrier task
|
|
1109
|
+
isBarrier = read_bool(infile)
|
|
1110
|
+
boundPort = read_int(infile)
|
|
1111
|
+
secret = UTF8Deserializer().loads(infile)
|
|
1112
|
+
|
|
1113
|
+
# set up memory limits
|
|
1114
|
+
memory_limit_mb = int(os.environ.get("PYSPARK_EXECUTOR_MEMORY_MB", "-1"))
|
|
1115
|
+
if memory_limit_mb > 0 and has_resource_module:
|
|
1116
|
+
total_memory = resource.RLIMIT_AS
|
|
1117
|
+
try:
|
|
1118
|
+
(soft_limit, hard_limit) = resource.getrlimit(total_memory)
|
|
1119
|
+
msg = "Current mem limits: {0} of max {1}\n".format(soft_limit, hard_limit)
|
|
1120
|
+
print(msg, file=sys.stderr)
|
|
1121
|
+
|
|
1122
|
+
# convert to bytes
|
|
1123
|
+
new_limit = memory_limit_mb * 1024 * 1024
|
|
1124
|
+
|
|
1125
|
+
if soft_limit == resource.RLIM_INFINITY or new_limit < soft_limit:
|
|
1126
|
+
msg = "Setting mem limits to {0} of max {1}\n".format(new_limit, new_limit)
|
|
1127
|
+
print(msg, file=sys.stderr)
|
|
1128
|
+
resource.setrlimit(total_memory, (new_limit, new_limit))
|
|
1129
|
+
|
|
1130
|
+
except (resource.error, OSError, ValueError) as e:
|
|
1131
|
+
# not all systems support resource limits, so warn instead of failing
|
|
1132
|
+
lineno = (
|
|
1133
|
+
getframeinfo(currentframe()).lineno + 1 if currentframe() is not None else 0
|
|
1134
|
+
)
|
|
1135
|
+
if "__file__" in globals():
|
|
1136
|
+
print(
|
|
1137
|
+
warnings.formatwarning(
|
|
1138
|
+
"Failed to set memory limit: {0}".format(e),
|
|
1139
|
+
ResourceWarning,
|
|
1140
|
+
__file__,
|
|
1141
|
+
lineno,
|
|
1142
|
+
),
|
|
1143
|
+
file=sys.stderr,
|
|
1144
|
+
)
|
|
1145
|
+
|
|
1146
|
+
# initialize global state
|
|
1147
|
+
taskContext = None
|
|
1148
|
+
if isBarrier:
|
|
1149
|
+
taskContext = BarrierTaskContext._getOrCreate()
|
|
1150
|
+
BarrierTaskContext._initialize(boundPort, secret)
|
|
1151
|
+
# Set the task context instance here, so we can get it by TaskContext.get for
|
|
1152
|
+
# both TaskContext and BarrierTaskContext
|
|
1153
|
+
TaskContext._setTaskContext(taskContext)
|
|
1154
|
+
else:
|
|
1155
|
+
taskContext = TaskContext._getOrCreate()
|
|
1156
|
+
# read inputs for TaskContext info
|
|
1157
|
+
taskContext._stageId = read_int(infile)
|
|
1158
|
+
taskContext._partitionId = read_int(infile)
|
|
1159
|
+
taskContext._attemptNumber = read_int(infile)
|
|
1160
|
+
taskContext._taskAttemptId = read_long(infile)
|
|
1161
|
+
taskContext._cpus = read_int(infile)
|
|
1162
|
+
taskContext._resources = {}
|
|
1163
|
+
for r in range(read_int(infile)):
|
|
1164
|
+
key = utf8_deserializer.loads(infile)
|
|
1165
|
+
name = utf8_deserializer.loads(infile)
|
|
1166
|
+
addresses = []
|
|
1167
|
+
taskContext._resources = {}
|
|
1168
|
+
for a in range(read_int(infile)):
|
|
1169
|
+
addresses.append(utf8_deserializer.loads(infile))
|
|
1170
|
+
taskContext._resources[key] = ResourceInformation(name, addresses)
|
|
1171
|
+
|
|
1172
|
+
taskContext._localProperties = dict()
|
|
1173
|
+
for i in range(read_int(infile)):
|
|
1174
|
+
k = utf8_deserializer.loads(infile)
|
|
1175
|
+
v = utf8_deserializer.loads(infile)
|
|
1176
|
+
taskContext._localProperties[k] = v
|
|
1177
|
+
|
|
1178
|
+
shuffle.MemoryBytesSpilled = 0
|
|
1179
|
+
shuffle.DiskBytesSpilled = 0
|
|
1180
|
+
_accumulatorRegistry.clear()
|
|
1181
|
+
|
|
1182
|
+
# fetch name of workdir
|
|
1183
|
+
spark_files_dir = utf8_deserializer.loads(infile)
|
|
1184
|
+
SparkFiles._root_directory = spark_files_dir
|
|
1185
|
+
SparkFiles._is_running_on_worker = True
|
|
1186
|
+
|
|
1187
|
+
# fetch names of includes (*.zip and *.egg files) and construct PYTHONPATH
|
|
1188
|
+
add_path(spark_files_dir) # *.py files that were added will be copied here
|
|
1189
|
+
num_python_includes = read_int(infile)
|
|
1190
|
+
for _ in range(num_python_includes):
|
|
1191
|
+
filename = utf8_deserializer.loads(infile)
|
|
1192
|
+
add_path(os.path.join(spark_files_dir, filename))
|
|
1193
|
+
|
|
1194
|
+
importlib.invalidate_caches()
|
|
1195
|
+
|
|
1196
|
+
# fetch names and values of broadcast variables
|
|
1197
|
+
needs_broadcast_decryption_server = read_bool(infile)
|
|
1198
|
+
num_broadcast_variables = read_int(infile)
|
|
1199
|
+
if needs_broadcast_decryption_server:
|
|
1200
|
+
# read the decrypted data from a server in the jvm
|
|
1201
|
+
port = read_int(infile)
|
|
1202
|
+
auth_secret = utf8_deserializer.loads(infile)
|
|
1203
|
+
(broadcast_sock_file, _) = local_connect_and_auth(port, auth_secret)
|
|
1204
|
+
|
|
1205
|
+
for _ in range(num_broadcast_variables):
|
|
1206
|
+
bid = read_long(infile)
|
|
1207
|
+
if bid >= 0:
|
|
1208
|
+
if needs_broadcast_decryption_server:
|
|
1209
|
+
read_bid = read_long(broadcast_sock_file)
|
|
1210
|
+
assert read_bid == bid
|
|
1211
|
+
_broadcastRegistry[bid] = Broadcast(sock_file=broadcast_sock_file)
|
|
1212
|
+
else:
|
|
1213
|
+
path = utf8_deserializer.loads(infile)
|
|
1214
|
+
_broadcastRegistry[bid] = Broadcast(path=path)
|
|
1215
|
+
|
|
1216
|
+
else:
|
|
1217
|
+
bid = -bid - 1
|
|
1218
|
+
_broadcastRegistry.pop(bid)
|
|
1219
|
+
|
|
1220
|
+
if needs_broadcast_decryption_server:
|
|
1221
|
+
broadcast_sock_file.write(b"1")
|
|
1222
|
+
broadcast_sock_file.close()
|
|
1223
|
+
|
|
1224
|
+
_accumulatorRegistry.clear()
|
|
1225
|
+
eval_type = read_int(infile)
|
|
1226
|
+
if eval_type == PythonEvalType.NON_UDF:
|
|
1227
|
+
func, profiler, deserializer, serializer = read_command(pickleSer, infile)
|
|
1228
|
+
elif eval_type in (PythonEvalType.SQL_TABLE_UDF, PythonEvalType.SQL_ARROW_TABLE_UDF):
|
|
1229
|
+
func, profiler, deserializer, serializer = read_udtf(pickleSer, infile, eval_type)
|
|
1230
|
+
else:
|
|
1231
|
+
func, profiler, deserializer, serializer = read_udfs(pickleSer, infile, eval_type)
|
|
1232
|
+
|
|
1233
|
+
init_time = time.time()
|
|
1234
|
+
|
|
1235
|
+
def process():
|
|
1236
|
+
iterator = deserializer.load_stream(infile)
|
|
1237
|
+
out_iter = func(split_index, iterator)
|
|
1238
|
+
try:
|
|
1239
|
+
serializer.dump_stream(out_iter, outfile)
|
|
1240
|
+
finally:
|
|
1241
|
+
if hasattr(out_iter, "close"):
|
|
1242
|
+
out_iter.close()
|
|
1243
|
+
|
|
1244
|
+
if profiler:
|
|
1245
|
+
profiler.profile(process)
|
|
1246
|
+
else:
|
|
1247
|
+
process()
|
|
1248
|
+
|
|
1249
|
+
# Reset task context to None. This is a guard code to avoid residual context when worker
|
|
1250
|
+
# reuse.
|
|
1251
|
+
TaskContext._setTaskContext(None)
|
|
1252
|
+
BarrierTaskContext._setTaskContext(None)
|
|
1253
|
+
except BaseException as e:
|
|
1254
|
+
try:
|
|
1255
|
+
exc_info = None
|
|
1256
|
+
if os.environ.get("SPARK_SIMPLIFIED_TRACEBACK", False):
|
|
1257
|
+
tb = try_simplify_traceback(sys.exc_info()[-1])
|
|
1258
|
+
if tb is not None:
|
|
1259
|
+
e.__cause__ = None
|
|
1260
|
+
exc_info = "".join(traceback.format_exception(type(e), e, tb))
|
|
1261
|
+
if exc_info is None:
|
|
1262
|
+
exc_info = traceback.format_exc()
|
|
1263
|
+
|
|
1264
|
+
write_int(SpecialLengths.PYTHON_EXCEPTION_THROWN, outfile)
|
|
1265
|
+
write_with_length(exc_info.encode("utf-8"), outfile)
|
|
1266
|
+
except IOError:
|
|
1267
|
+
# JVM close the socket
|
|
1268
|
+
pass
|
|
1269
|
+
except BaseException:
|
|
1270
|
+
# Write the error to stderr if it happened while serializing
|
|
1271
|
+
print("PySpark worker failed with exception:", file=sys.stderr)
|
|
1272
|
+
print(traceback.format_exc(), file=sys.stderr)
|
|
1273
|
+
sys.exit(-1)
|
|
1274
|
+
finally:
|
|
1275
|
+
if faulthandler_log_path:
|
|
1276
|
+
faulthandler.disable()
|
|
1277
|
+
faulthandler_log_file.close()
|
|
1278
|
+
os.remove(faulthandler_log_path)
|
|
1279
|
+
finish_time = time.time()
|
|
1280
|
+
report_times(outfile, boot_time, init_time, finish_time)
|
|
1281
|
+
write_long(shuffle.MemoryBytesSpilled, outfile)
|
|
1282
|
+
write_long(shuffle.DiskBytesSpilled, outfile)
|
|
1283
|
+
|
|
1284
|
+
# Mark the beginning of the accumulators section of the output
|
|
1285
|
+
write_int(SpecialLengths.END_OF_DATA_SECTION, outfile)
|
|
1286
|
+
write_int(len(_accumulatorRegistry), outfile)
|
|
1287
|
+
for (aid, accum) in _accumulatorRegistry.items():
|
|
1288
|
+
pickleSer._write_with_length((aid, accum._value), outfile)
|
|
1289
|
+
|
|
1290
|
+
# check end of stream
|
|
1291
|
+
if read_int(infile) == SpecialLengths.END_OF_STREAM:
|
|
1292
|
+
write_int(SpecialLengths.END_OF_STREAM, outfile)
|
|
1293
|
+
else:
|
|
1294
|
+
# write a different value to tell JVM to not reuse this worker
|
|
1295
|
+
write_int(SpecialLengths.END_OF_DATA_SECTION, outfile)
|
|
1296
|
+
sys.exit(-1)
|
|
1297
|
+
|
|
1298
|
+
|
|
1299
|
+
if __name__ == "__main__":
|
|
1300
|
+
# Read information about how to connect back to the JVM from the environment.
|
|
1301
|
+
java_port = int(os.environ["PYTHON_WORKER_FACTORY_PORT"])
|
|
1302
|
+
auth_secret = os.environ["PYTHON_WORKER_FACTORY_SECRET"]
|
|
1303
|
+
(sock_file, _) = local_connect_and_auth(java_port, auth_secret)
|
|
1304
|
+
# TODO: Remove the following two lines and use `Process.pid()` when we drop JDK 8.
|
|
1305
|
+
write_int(os.getpid(), sock_file)
|
|
1306
|
+
sock_file.flush()
|
|
1307
|
+
main(sock_file, sock_file)
|