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,1431 @@
|
|
|
1
|
+
#
|
|
2
|
+
# Licensed to the Apache Software Foundation (ASF) under one or more
|
|
3
|
+
# contributor license agreements. See the NOTICE file distributed with
|
|
4
|
+
# this work for additional information regarding copyright ownership.
|
|
5
|
+
# The ASF licenses this file to You under the Apache License, Version 2.0
|
|
6
|
+
# (the "License"); you may not use this file except in compliance with
|
|
7
|
+
# the License. You may obtain a copy of the License at
|
|
8
|
+
#
|
|
9
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
#
|
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
# See the License for the specific language governing permissions and
|
|
15
|
+
# limitations under the License.
|
|
16
|
+
#
|
|
17
|
+
|
|
18
|
+
import sys
|
|
19
|
+
import json
|
|
20
|
+
import warnings
|
|
21
|
+
from typing import (
|
|
22
|
+
cast,
|
|
23
|
+
overload,
|
|
24
|
+
Any,
|
|
25
|
+
Callable,
|
|
26
|
+
Iterable,
|
|
27
|
+
List,
|
|
28
|
+
Optional,
|
|
29
|
+
Tuple,
|
|
30
|
+
TYPE_CHECKING,
|
|
31
|
+
Union,
|
|
32
|
+
)
|
|
33
|
+
|
|
34
|
+
from py4j.java_gateway import JavaObject, JVMView
|
|
35
|
+
|
|
36
|
+
from pyspark import copy_func
|
|
37
|
+
from pyspark.context import SparkContext
|
|
38
|
+
from pyspark.errors import PySparkAttributeError, PySparkTypeError, PySparkValueError
|
|
39
|
+
from pyspark.sql.types import DataType
|
|
40
|
+
from pyspark.sql.utils import get_active_spark_context
|
|
41
|
+
|
|
42
|
+
if TYPE_CHECKING:
|
|
43
|
+
from pyspark.sql._typing import ColumnOrName, LiteralType, DecimalLiteral, DateTimeLiteral
|
|
44
|
+
from pyspark.sql.window import WindowSpec
|
|
45
|
+
|
|
46
|
+
__all__ = ["Column"]
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
def _create_column_from_literal(literal: Union["LiteralType", "DecimalLiteral"]) -> "Column":
|
|
50
|
+
sc = get_active_spark_context()
|
|
51
|
+
return cast(JVMView, sc._jvm).functions.lit(literal)
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
def _create_column_from_name(name: str) -> "Column":
|
|
55
|
+
sc = get_active_spark_context()
|
|
56
|
+
return cast(JVMView, sc._jvm).functions.col(name)
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
def _to_java_column(col: "ColumnOrName") -> JavaObject:
|
|
60
|
+
if isinstance(col, Column):
|
|
61
|
+
jcol = col._jc
|
|
62
|
+
elif isinstance(col, str):
|
|
63
|
+
jcol = _create_column_from_name(col)
|
|
64
|
+
else:
|
|
65
|
+
raise PySparkTypeError(
|
|
66
|
+
error_class="NOT_COLUMN_OR_STR",
|
|
67
|
+
message_parameters={"arg_name": "col", "arg_type": type(col).__name__},
|
|
68
|
+
)
|
|
69
|
+
return jcol
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
def _to_java_expr(col: "ColumnOrName") -> JavaObject:
|
|
73
|
+
return _to_java_column(col).expr()
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
def _to_seq(
|
|
77
|
+
sc: SparkContext,
|
|
78
|
+
cols: Iterable["ColumnOrName"],
|
|
79
|
+
converter: Optional[Callable[["ColumnOrName"], JavaObject]] = None,
|
|
80
|
+
) -> JavaObject:
|
|
81
|
+
"""
|
|
82
|
+
Convert a list of Columns (or names) into a JVM Seq of Column.
|
|
83
|
+
|
|
84
|
+
An optional `converter` could be used to convert items in `cols`
|
|
85
|
+
into JVM Column objects.
|
|
86
|
+
"""
|
|
87
|
+
if converter:
|
|
88
|
+
cols = [converter(c) for c in cols]
|
|
89
|
+
assert sc._jvm is not None
|
|
90
|
+
return sc._jvm.PythonUtils.toSeq(cols)
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
def _to_list(
|
|
94
|
+
sc: SparkContext,
|
|
95
|
+
cols: List["ColumnOrName"],
|
|
96
|
+
converter: Optional[Callable[["ColumnOrName"], JavaObject]] = None,
|
|
97
|
+
) -> JavaObject:
|
|
98
|
+
"""
|
|
99
|
+
Convert a list of Columns (or names) into a JVM (Scala) List of Columns.
|
|
100
|
+
|
|
101
|
+
An optional `converter` could be used to convert items in `cols`
|
|
102
|
+
into JVM Column objects.
|
|
103
|
+
"""
|
|
104
|
+
if converter:
|
|
105
|
+
cols = [converter(c) for c in cols]
|
|
106
|
+
assert sc._jvm is not None
|
|
107
|
+
return sc._jvm.PythonUtils.toList(cols)
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
def _unary_op(
|
|
111
|
+
name: str,
|
|
112
|
+
doc: str = "unary operator",
|
|
113
|
+
) -> Callable[["Column"], "Column"]:
|
|
114
|
+
"""Create a method for given unary operator"""
|
|
115
|
+
|
|
116
|
+
def _(self: "Column") -> "Column":
|
|
117
|
+
jc = getattr(self._jc, name)()
|
|
118
|
+
return Column(jc)
|
|
119
|
+
|
|
120
|
+
_.__doc__ = doc
|
|
121
|
+
return _
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
def _func_op(name: str, doc: str = "") -> Callable[["Column"], "Column"]:
|
|
125
|
+
def _(self: "Column") -> "Column":
|
|
126
|
+
sc = get_active_spark_context()
|
|
127
|
+
jc = getattr(cast(JVMView, sc._jvm).functions, name)(self._jc)
|
|
128
|
+
return Column(jc)
|
|
129
|
+
|
|
130
|
+
_.__doc__ = doc
|
|
131
|
+
return _
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
def _bin_func_op(
|
|
135
|
+
name: str,
|
|
136
|
+
reverse: bool = False,
|
|
137
|
+
doc: str = "binary function",
|
|
138
|
+
) -> Callable[["Column", Union["Column", "LiteralType", "DecimalLiteral"]], "Column"]:
|
|
139
|
+
def _(self: "Column", other: Union["Column", "LiteralType", "DecimalLiteral"]) -> "Column":
|
|
140
|
+
sc = get_active_spark_context()
|
|
141
|
+
fn = getattr(cast(JVMView, sc._jvm).functions, name)
|
|
142
|
+
jc = other._jc if isinstance(other, Column) else _create_column_from_literal(other)
|
|
143
|
+
njc = fn(self._jc, jc) if not reverse else fn(jc, self._jc)
|
|
144
|
+
return Column(njc)
|
|
145
|
+
|
|
146
|
+
_.__doc__ = doc
|
|
147
|
+
return _
|
|
148
|
+
|
|
149
|
+
|
|
150
|
+
def _bin_op(
|
|
151
|
+
name: str,
|
|
152
|
+
doc: str = "binary operator",
|
|
153
|
+
) -> Callable[
|
|
154
|
+
["Column", Union["Column", "LiteralType", "DecimalLiteral", "DateTimeLiteral"]], "Column"
|
|
155
|
+
]:
|
|
156
|
+
"""Create a method for given binary operator"""
|
|
157
|
+
|
|
158
|
+
def _(
|
|
159
|
+
self: "Column",
|
|
160
|
+
other: Union["Column", "LiteralType", "DecimalLiteral", "DateTimeLiteral"],
|
|
161
|
+
) -> "Column":
|
|
162
|
+
jc = other._jc if isinstance(other, Column) else other
|
|
163
|
+
njc = getattr(self._jc, name)(jc)
|
|
164
|
+
return Column(njc)
|
|
165
|
+
|
|
166
|
+
_.__doc__ = doc
|
|
167
|
+
return _
|
|
168
|
+
|
|
169
|
+
|
|
170
|
+
def _reverse_op(
|
|
171
|
+
name: str,
|
|
172
|
+
doc: str = "binary operator",
|
|
173
|
+
) -> Callable[["Column", Union["LiteralType", "DecimalLiteral"]], "Column"]:
|
|
174
|
+
"""Create a method for binary operator (this object is on right side)"""
|
|
175
|
+
|
|
176
|
+
def _(self: "Column", other: Union["LiteralType", "DecimalLiteral"]) -> "Column":
|
|
177
|
+
jother = _create_column_from_literal(other)
|
|
178
|
+
jc = getattr(jother, name)(self._jc)
|
|
179
|
+
return Column(jc)
|
|
180
|
+
|
|
181
|
+
_.__doc__ = doc
|
|
182
|
+
return _
|
|
183
|
+
|
|
184
|
+
|
|
185
|
+
class Column:
|
|
186
|
+
|
|
187
|
+
"""
|
|
188
|
+
A column in a DataFrame.
|
|
189
|
+
|
|
190
|
+
.. versionadded:: 1.3.0
|
|
191
|
+
|
|
192
|
+
.. versionchanged:: 3.4.0
|
|
193
|
+
Supports Spark Connect.
|
|
194
|
+
|
|
195
|
+
Examples
|
|
196
|
+
--------
|
|
197
|
+
Column instances can be created by
|
|
198
|
+
|
|
199
|
+
>>> df = spark.createDataFrame(
|
|
200
|
+
... [(2, "Alice"), (5, "Bob")], ["age", "name"])
|
|
201
|
+
|
|
202
|
+
Select a column out of a DataFrame
|
|
203
|
+
>>> df.name
|
|
204
|
+
Column<'name'>
|
|
205
|
+
>>> df["name"]
|
|
206
|
+
Column<'name'>
|
|
207
|
+
|
|
208
|
+
Create from an expression
|
|
209
|
+
|
|
210
|
+
>>> df.age + 1
|
|
211
|
+
Column<...>
|
|
212
|
+
>>> 1 / df.age
|
|
213
|
+
Column<...>
|
|
214
|
+
"""
|
|
215
|
+
|
|
216
|
+
def __init__(self, jc: JavaObject) -> None:
|
|
217
|
+
self._jc = jc
|
|
218
|
+
|
|
219
|
+
# arithmetic operators
|
|
220
|
+
__neg__ = _func_op("negate")
|
|
221
|
+
__add__ = cast(
|
|
222
|
+
Callable[["Column", Union["Column", "LiteralType", "DecimalLiteral"]], "Column"],
|
|
223
|
+
_bin_op("plus"),
|
|
224
|
+
)
|
|
225
|
+
__sub__ = cast(
|
|
226
|
+
Callable[["Column", Union["Column", "LiteralType", "DecimalLiteral"]], "Column"],
|
|
227
|
+
_bin_op("minus"),
|
|
228
|
+
)
|
|
229
|
+
__mul__ = cast(
|
|
230
|
+
Callable[["Column", Union["Column", "LiteralType", "DecimalLiteral"]], "Column"],
|
|
231
|
+
_bin_op("multiply"),
|
|
232
|
+
)
|
|
233
|
+
__div__ = cast(
|
|
234
|
+
Callable[["Column", Union["Column", "LiteralType", "DecimalLiteral"]], "Column"],
|
|
235
|
+
_bin_op("divide"),
|
|
236
|
+
)
|
|
237
|
+
__truediv__ = cast(
|
|
238
|
+
Callable[["Column", Union["Column", "LiteralType", "DecimalLiteral"]], "Column"],
|
|
239
|
+
_bin_op("divide"),
|
|
240
|
+
)
|
|
241
|
+
__mod__ = cast(
|
|
242
|
+
Callable[["Column", Union["Column", "LiteralType", "DecimalLiteral"]], "Column"],
|
|
243
|
+
_bin_op("mod"),
|
|
244
|
+
)
|
|
245
|
+
__radd__ = cast(
|
|
246
|
+
Callable[["Column", Union["LiteralType", "DecimalLiteral"]], "Column"], _bin_op("plus")
|
|
247
|
+
)
|
|
248
|
+
__rsub__ = _reverse_op("minus")
|
|
249
|
+
__rmul__ = cast(
|
|
250
|
+
Callable[["Column", Union["LiteralType", "DecimalLiteral"]], "Column"], _bin_op("multiply")
|
|
251
|
+
)
|
|
252
|
+
__rdiv__ = _reverse_op("divide")
|
|
253
|
+
__rtruediv__ = _reverse_op("divide")
|
|
254
|
+
__rmod__ = _reverse_op("mod")
|
|
255
|
+
|
|
256
|
+
__pow__ = _bin_func_op("pow")
|
|
257
|
+
__rpow__ = cast(
|
|
258
|
+
Callable[["Column", Union["LiteralType", "DecimalLiteral"]], "Column"],
|
|
259
|
+
_bin_func_op("pow", reverse=True),
|
|
260
|
+
)
|
|
261
|
+
|
|
262
|
+
# logistic operators
|
|
263
|
+
def __eq__( # type: ignore[override]
|
|
264
|
+
self,
|
|
265
|
+
other: Union["Column", "LiteralType", "DecimalLiteral", "DateTimeLiteral"],
|
|
266
|
+
) -> "Column":
|
|
267
|
+
"""binary function"""
|
|
268
|
+
return _bin_op("equalTo")(self, other)
|
|
269
|
+
|
|
270
|
+
def __ne__( # type: ignore[override]
|
|
271
|
+
self,
|
|
272
|
+
other: Any,
|
|
273
|
+
) -> "Column":
|
|
274
|
+
"""binary function"""
|
|
275
|
+
return _bin_op("notEqual")(self, other)
|
|
276
|
+
|
|
277
|
+
__lt__ = _bin_op("lt")
|
|
278
|
+
__le__ = _bin_op("leq")
|
|
279
|
+
__ge__ = _bin_op("geq")
|
|
280
|
+
__gt__ = _bin_op("gt")
|
|
281
|
+
|
|
282
|
+
_eqNullSafe_doc = """
|
|
283
|
+
Equality test that is safe for null values.
|
|
284
|
+
|
|
285
|
+
.. versionadded:: 2.3.0
|
|
286
|
+
|
|
287
|
+
.. versionchanged:: 3.4.0
|
|
288
|
+
Supports Spark Connect.
|
|
289
|
+
|
|
290
|
+
Parameters
|
|
291
|
+
----------
|
|
292
|
+
other
|
|
293
|
+
a value or :class:`Column`
|
|
294
|
+
|
|
295
|
+
Examples
|
|
296
|
+
--------
|
|
297
|
+
>>> from pyspark.sql import Row
|
|
298
|
+
>>> df1 = spark.createDataFrame([
|
|
299
|
+
... Row(id=1, value='foo'),
|
|
300
|
+
... Row(id=2, value=None)
|
|
301
|
+
... ])
|
|
302
|
+
>>> df1.select(
|
|
303
|
+
... df1['value'] == 'foo',
|
|
304
|
+
... df1['value'].eqNullSafe('foo'),
|
|
305
|
+
... df1['value'].eqNullSafe(None)
|
|
306
|
+
... ).show()
|
|
307
|
+
+-------------+---------------+----------------+
|
|
308
|
+
|(value = foo)|(value <=> foo)|(value <=> NULL)|
|
|
309
|
+
+-------------+---------------+----------------+
|
|
310
|
+
| true| true| false|
|
|
311
|
+
| NULL| false| true|
|
|
312
|
+
+-------------+---------------+----------------+
|
|
313
|
+
>>> df2 = spark.createDataFrame([
|
|
314
|
+
... Row(value = 'bar'),
|
|
315
|
+
... Row(value = None)
|
|
316
|
+
... ])
|
|
317
|
+
>>> df1.join(df2, df1["value"] == df2["value"]).count()
|
|
318
|
+
0
|
|
319
|
+
>>> df1.join(df2, df1["value"].eqNullSafe(df2["value"])).count()
|
|
320
|
+
1
|
|
321
|
+
>>> df2 = spark.createDataFrame([
|
|
322
|
+
... Row(id=1, value=float('NaN')),
|
|
323
|
+
... Row(id=2, value=42.0),
|
|
324
|
+
... Row(id=3, value=None)
|
|
325
|
+
... ])
|
|
326
|
+
>>> df2.select(
|
|
327
|
+
... df2['value'].eqNullSafe(None),
|
|
328
|
+
... df2['value'].eqNullSafe(float('NaN')),
|
|
329
|
+
... df2['value'].eqNullSafe(42.0)
|
|
330
|
+
... ).show()
|
|
331
|
+
+----------------+---------------+----------------+
|
|
332
|
+
|(value <=> NULL)|(value <=> NaN)|(value <=> 42.0)|
|
|
333
|
+
+----------------+---------------+----------------+
|
|
334
|
+
| false| true| false|
|
|
335
|
+
| false| false| true|
|
|
336
|
+
| true| false| false|
|
|
337
|
+
+----------------+---------------+----------------+
|
|
338
|
+
|
|
339
|
+
Notes
|
|
340
|
+
-----
|
|
341
|
+
Unlike Pandas, PySpark doesn't consider NaN values to be NULL. See the
|
|
342
|
+
`NaN Semantics <https://spark.apache.org/docs/latest/sql-ref-datatypes.html#nan-semantics>`_
|
|
343
|
+
for details.
|
|
344
|
+
"""
|
|
345
|
+
eqNullSafe = _bin_op("eqNullSafe", _eqNullSafe_doc)
|
|
346
|
+
|
|
347
|
+
# `and`, `or`, `not` cannot be overloaded in Python,
|
|
348
|
+
# so use bitwise operators as boolean operators
|
|
349
|
+
__and__ = _bin_op("and")
|
|
350
|
+
__or__ = _bin_op("or")
|
|
351
|
+
__invert__ = _func_op("not")
|
|
352
|
+
__rand__ = _bin_op("and")
|
|
353
|
+
__ror__ = _bin_op("or")
|
|
354
|
+
|
|
355
|
+
# container operators
|
|
356
|
+
def __contains__(self, item: Any) -> None:
|
|
357
|
+
raise PySparkValueError(
|
|
358
|
+
error_class="CANNOT_APPLY_IN_FOR_COLUMN",
|
|
359
|
+
message_parameters={},
|
|
360
|
+
)
|
|
361
|
+
|
|
362
|
+
# bitwise operators
|
|
363
|
+
_bitwiseOR_doc = """
|
|
364
|
+
Compute bitwise OR of this expression with another expression.
|
|
365
|
+
|
|
366
|
+
.. versionchanged:: 3.4.0
|
|
367
|
+
Supports Spark Connect.
|
|
368
|
+
|
|
369
|
+
Parameters
|
|
370
|
+
----------
|
|
371
|
+
other
|
|
372
|
+
a value or :class:`Column` to calculate bitwise or(|) with
|
|
373
|
+
this :class:`Column`.
|
|
374
|
+
|
|
375
|
+
Examples
|
|
376
|
+
--------
|
|
377
|
+
>>> from pyspark.sql import Row
|
|
378
|
+
>>> df = spark.createDataFrame([Row(a=170, b=75)])
|
|
379
|
+
>>> df.select(df.a.bitwiseOR(df.b)).collect()
|
|
380
|
+
[Row((a | b)=235)]
|
|
381
|
+
"""
|
|
382
|
+
_bitwiseAND_doc = """
|
|
383
|
+
Compute bitwise AND of this expression with another expression.
|
|
384
|
+
|
|
385
|
+
.. versionchanged:: 3.4.0
|
|
386
|
+
Supports Spark Connect.
|
|
387
|
+
|
|
388
|
+
Parameters
|
|
389
|
+
----------
|
|
390
|
+
other
|
|
391
|
+
a value or :class:`Column` to calculate bitwise and(&) with
|
|
392
|
+
this :class:`Column`.
|
|
393
|
+
|
|
394
|
+
Examples
|
|
395
|
+
--------
|
|
396
|
+
>>> from pyspark.sql import Row
|
|
397
|
+
>>> df = spark.createDataFrame([Row(a=170, b=75)])
|
|
398
|
+
>>> df.select(df.a.bitwiseAND(df.b)).collect()
|
|
399
|
+
[Row((a & b)=10)]
|
|
400
|
+
"""
|
|
401
|
+
_bitwiseXOR_doc = """
|
|
402
|
+
Compute bitwise XOR of this expression with another expression.
|
|
403
|
+
|
|
404
|
+
.. versionchanged:: 3.4.0
|
|
405
|
+
Supports Spark Connect.
|
|
406
|
+
|
|
407
|
+
Parameters
|
|
408
|
+
----------
|
|
409
|
+
other
|
|
410
|
+
a value or :class:`Column` to calculate bitwise xor(^) with
|
|
411
|
+
this :class:`Column`.
|
|
412
|
+
|
|
413
|
+
Examples
|
|
414
|
+
--------
|
|
415
|
+
>>> from pyspark.sql import Row
|
|
416
|
+
>>> df = spark.createDataFrame([Row(a=170, b=75)])
|
|
417
|
+
>>> df.select(df.a.bitwiseXOR(df.b)).collect()
|
|
418
|
+
[Row((a ^ b)=225)]
|
|
419
|
+
"""
|
|
420
|
+
|
|
421
|
+
bitwiseOR = _bin_op("bitwiseOR", _bitwiseOR_doc)
|
|
422
|
+
bitwiseAND = _bin_op("bitwiseAND", _bitwiseAND_doc)
|
|
423
|
+
bitwiseXOR = _bin_op("bitwiseXOR", _bitwiseXOR_doc)
|
|
424
|
+
|
|
425
|
+
def getItem(self, key: Any) -> "Column":
|
|
426
|
+
"""
|
|
427
|
+
An expression that gets an item at position ``ordinal`` out of a list,
|
|
428
|
+
or gets an item by key out of a dict.
|
|
429
|
+
|
|
430
|
+
.. versionadded:: 1.3.0
|
|
431
|
+
|
|
432
|
+
.. versionchanged:: 3.4.0
|
|
433
|
+
Supports Spark Connect.
|
|
434
|
+
|
|
435
|
+
Parameters
|
|
436
|
+
----------
|
|
437
|
+
key
|
|
438
|
+
a literal value, or a :class:`Column` expression.
|
|
439
|
+
The result will only be true at a location if the item matches in the column.
|
|
440
|
+
|
|
441
|
+
.. deprecated:: 3.0.0
|
|
442
|
+
:class:`Column` as a parameter is deprecated.
|
|
443
|
+
|
|
444
|
+
Returns
|
|
445
|
+
-------
|
|
446
|
+
:class:`Column`
|
|
447
|
+
Column representing the item(s) got at position out of a list or by key out of a dict.
|
|
448
|
+
|
|
449
|
+
Examples
|
|
450
|
+
--------
|
|
451
|
+
>>> df = spark.createDataFrame([([1, 2], {"key": "value"})], ["l", "d"])
|
|
452
|
+
>>> df.select(df.l.getItem(0), df.d.getItem("key")).show()
|
|
453
|
+
+----+------+
|
|
454
|
+
|l[0]|d[key]|
|
|
455
|
+
+----+------+
|
|
456
|
+
| 1| value|
|
|
457
|
+
+----+------+
|
|
458
|
+
"""
|
|
459
|
+
if isinstance(key, Column):
|
|
460
|
+
warnings.warn(
|
|
461
|
+
"A column as 'key' in getItem is deprecated as of Spark 3.0, and will not "
|
|
462
|
+
"be supported in the future release. Use `column[key]` or `column.key` syntax "
|
|
463
|
+
"instead.",
|
|
464
|
+
FutureWarning,
|
|
465
|
+
)
|
|
466
|
+
return self[key]
|
|
467
|
+
|
|
468
|
+
def getField(self, name: Any) -> "Column":
|
|
469
|
+
"""
|
|
470
|
+
An expression that gets a field by name in a :class:`StructType`.
|
|
471
|
+
|
|
472
|
+
.. versionadded:: 1.3.0
|
|
473
|
+
|
|
474
|
+
.. versionchanged:: 3.4.0
|
|
475
|
+
Supports Spark Connect.
|
|
476
|
+
|
|
477
|
+
Parameters
|
|
478
|
+
----------
|
|
479
|
+
name
|
|
480
|
+
a literal value, or a :class:`Column` expression.
|
|
481
|
+
The result will only be true at a location if the field matches in the Column.
|
|
482
|
+
|
|
483
|
+
.. deprecated:: 3.0.0
|
|
484
|
+
:class:`Column` as a parameter is deprecated.
|
|
485
|
+
Returns
|
|
486
|
+
-------
|
|
487
|
+
:class:`Column`
|
|
488
|
+
Column representing whether each element of Column got by name.
|
|
489
|
+
|
|
490
|
+
Examples
|
|
491
|
+
--------
|
|
492
|
+
>>> from pyspark.sql import Row
|
|
493
|
+
>>> df = spark.createDataFrame([Row(r=Row(a=1, b="b"))])
|
|
494
|
+
>>> df.select(df.r.getField("b")).show()
|
|
495
|
+
+---+
|
|
496
|
+
|r.b|
|
|
497
|
+
+---+
|
|
498
|
+
| b|
|
|
499
|
+
+---+
|
|
500
|
+
>>> df.select(df.r.a).show()
|
|
501
|
+
+---+
|
|
502
|
+
|r.a|
|
|
503
|
+
+---+
|
|
504
|
+
| 1|
|
|
505
|
+
+---+
|
|
506
|
+
"""
|
|
507
|
+
if isinstance(name, Column):
|
|
508
|
+
warnings.warn(
|
|
509
|
+
"A column as 'name' in getField is deprecated as of Spark 3.0, and will not "
|
|
510
|
+
"be supported in the future release. Use `column[name]` or `column.name` syntax "
|
|
511
|
+
"instead.",
|
|
512
|
+
FutureWarning,
|
|
513
|
+
)
|
|
514
|
+
return self[name]
|
|
515
|
+
|
|
516
|
+
def withField(self, fieldName: str, col: "Column") -> "Column":
|
|
517
|
+
"""
|
|
518
|
+
An expression that adds/replaces a field in :class:`StructType` by name.
|
|
519
|
+
|
|
520
|
+
.. versionadded:: 3.1.0
|
|
521
|
+
|
|
522
|
+
.. versionchanged:: 3.4.0
|
|
523
|
+
Supports Spark Connect.
|
|
524
|
+
|
|
525
|
+
Parameters
|
|
526
|
+
----------
|
|
527
|
+
fieldName : str
|
|
528
|
+
a literal value.
|
|
529
|
+
The result will only be true at a location if any field matches in the Column.
|
|
530
|
+
col : :class:`Column`
|
|
531
|
+
A :class:`Column` expression for the column with `fieldName`.
|
|
532
|
+
|
|
533
|
+
Returns
|
|
534
|
+
-------
|
|
535
|
+
:class:`Column`
|
|
536
|
+
Column representing whether each element of Column
|
|
537
|
+
which field was added/replaced by fieldName.
|
|
538
|
+
|
|
539
|
+
Examples
|
|
540
|
+
--------
|
|
541
|
+
>>> from pyspark.sql import Row
|
|
542
|
+
>>> from pyspark.sql.functions import lit
|
|
543
|
+
>>> df = spark.createDataFrame([Row(a=Row(b=1, c=2))])
|
|
544
|
+
>>> df.withColumn('a', df['a'].withField('b', lit(3))).select('a.b').show()
|
|
545
|
+
+---+
|
|
546
|
+
| b|
|
|
547
|
+
+---+
|
|
548
|
+
| 3|
|
|
549
|
+
+---+
|
|
550
|
+
>>> df.withColumn('a', df['a'].withField('d', lit(4))).select('a.d').show()
|
|
551
|
+
+---+
|
|
552
|
+
| d|
|
|
553
|
+
+---+
|
|
554
|
+
| 4|
|
|
555
|
+
+---+
|
|
556
|
+
"""
|
|
557
|
+
if not isinstance(fieldName, str):
|
|
558
|
+
raise PySparkTypeError(
|
|
559
|
+
error_class="NOT_STR",
|
|
560
|
+
message_parameters={"arg_name": "fieldName", "arg_type": type(fieldName).__name__},
|
|
561
|
+
)
|
|
562
|
+
|
|
563
|
+
if not isinstance(col, Column):
|
|
564
|
+
raise PySparkTypeError(
|
|
565
|
+
error_class="NOT_COLUMN",
|
|
566
|
+
message_parameters={"arg_name": "col", "arg_type": type(col).__name__},
|
|
567
|
+
)
|
|
568
|
+
|
|
569
|
+
return Column(self._jc.withField(fieldName, col._jc))
|
|
570
|
+
|
|
571
|
+
def dropFields(self, *fieldNames: str) -> "Column":
|
|
572
|
+
"""
|
|
573
|
+
An expression that drops fields in :class:`StructType` by name.
|
|
574
|
+
This is a no-op if the schema doesn't contain field name(s).
|
|
575
|
+
|
|
576
|
+
.. versionadded:: 3.1.0
|
|
577
|
+
|
|
578
|
+
.. versionchanged:: 3.4.0
|
|
579
|
+
Supports Spark Connect.
|
|
580
|
+
|
|
581
|
+
Parameters
|
|
582
|
+
----------
|
|
583
|
+
fieldNames : str
|
|
584
|
+
Desired field names (collects all positional arguments passed)
|
|
585
|
+
The result will drop at a location if any field matches in the Column.
|
|
586
|
+
|
|
587
|
+
Returns
|
|
588
|
+
-------
|
|
589
|
+
:class:`Column`
|
|
590
|
+
Column representing whether each element of Column with field dropped by fieldName.
|
|
591
|
+
|
|
592
|
+
Examples
|
|
593
|
+
--------
|
|
594
|
+
>>> from pyspark.sql import Row
|
|
595
|
+
>>> from pyspark.sql.functions import col, lit
|
|
596
|
+
>>> df = spark.createDataFrame([
|
|
597
|
+
... Row(a=Row(b=1, c=2, d=3, e=Row(f=4, g=5, h=6)))])
|
|
598
|
+
>>> df.withColumn('a', df['a'].dropFields('b')).show()
|
|
599
|
+
+-----------------+
|
|
600
|
+
| a|
|
|
601
|
+
+-----------------+
|
|
602
|
+
|{2, 3, {4, 5, 6}}|
|
|
603
|
+
+-----------------+
|
|
604
|
+
|
|
605
|
+
>>> df.withColumn('a', df['a'].dropFields('b', 'c')).show()
|
|
606
|
+
+--------------+
|
|
607
|
+
| a|
|
|
608
|
+
+--------------+
|
|
609
|
+
|{3, {4, 5, 6}}|
|
|
610
|
+
+--------------+
|
|
611
|
+
|
|
612
|
+
This method supports dropping multiple nested fields directly e.g.
|
|
613
|
+
|
|
614
|
+
>>> df.withColumn("a", col("a").dropFields("e.g", "e.h")).show()
|
|
615
|
+
+--------------+
|
|
616
|
+
| a|
|
|
617
|
+
+--------------+
|
|
618
|
+
|{1, 2, 3, {4}}|
|
|
619
|
+
+--------------+
|
|
620
|
+
|
|
621
|
+
However, if you are going to add/replace multiple nested fields,
|
|
622
|
+
it is preferred to extract out the nested struct before
|
|
623
|
+
adding/replacing multiple fields e.g.
|
|
624
|
+
|
|
625
|
+
>>> df.select(col("a").withField(
|
|
626
|
+
... "e", col("a.e").dropFields("g", "h")).alias("a")
|
|
627
|
+
... ).show()
|
|
628
|
+
+--------------+
|
|
629
|
+
| a|
|
|
630
|
+
+--------------+
|
|
631
|
+
|{1, 2, 3, {4}}|
|
|
632
|
+
+--------------+
|
|
633
|
+
|
|
634
|
+
"""
|
|
635
|
+
sc = get_active_spark_context()
|
|
636
|
+
jc = self._jc.dropFields(_to_seq(sc, fieldNames))
|
|
637
|
+
return Column(jc)
|
|
638
|
+
|
|
639
|
+
def __getattr__(self, item: Any) -> "Column":
|
|
640
|
+
"""
|
|
641
|
+
An expression that gets an item at position ``ordinal`` out of a list,
|
|
642
|
+
or gets an item by key out of a dict.
|
|
643
|
+
|
|
644
|
+
.. versionadded:: 1.3.0
|
|
645
|
+
|
|
646
|
+
.. versionchanged:: 3.4.0
|
|
647
|
+
Supports Spark Connect.
|
|
648
|
+
|
|
649
|
+
Parameters
|
|
650
|
+
----------
|
|
651
|
+
item
|
|
652
|
+
a literal value.
|
|
653
|
+
|
|
654
|
+
Returns
|
|
655
|
+
-------
|
|
656
|
+
:class:`Column`
|
|
657
|
+
Column representing the item got by key out of a dict.
|
|
658
|
+
|
|
659
|
+
Examples
|
|
660
|
+
--------
|
|
661
|
+
>>> df = spark.createDataFrame([('abcedfg', {"key": "value"})], ["l", "d"])
|
|
662
|
+
>>> df.select(df.d.key).show()
|
|
663
|
+
+------+
|
|
664
|
+
|d[key]|
|
|
665
|
+
+------+
|
|
666
|
+
| value|
|
|
667
|
+
+------+
|
|
668
|
+
"""
|
|
669
|
+
if item.startswith("__"):
|
|
670
|
+
raise PySparkAttributeError(
|
|
671
|
+
error_class="CANNOT_ACCESS_TO_DUNDER",
|
|
672
|
+
message_parameters={},
|
|
673
|
+
)
|
|
674
|
+
return self[item]
|
|
675
|
+
|
|
676
|
+
def __getitem__(self, k: Any) -> "Column":
|
|
677
|
+
"""
|
|
678
|
+
An expression that gets an item at position ``ordinal`` out of a list,
|
|
679
|
+
or gets an item by key out of a dict.
|
|
680
|
+
|
|
681
|
+
.. versionadded:: 1.3.0
|
|
682
|
+
|
|
683
|
+
.. versionchanged:: 3.4.0
|
|
684
|
+
Supports Spark Connect.
|
|
685
|
+
|
|
686
|
+
Parameters
|
|
687
|
+
----------
|
|
688
|
+
k
|
|
689
|
+
a literal value, or a slice object without step.
|
|
690
|
+
|
|
691
|
+
Returns
|
|
692
|
+
-------
|
|
693
|
+
:class:`Column`
|
|
694
|
+
Column representing the item got by key out of a dict, or substrings sliced by
|
|
695
|
+
the given slice object.
|
|
696
|
+
|
|
697
|
+
Examples
|
|
698
|
+
--------
|
|
699
|
+
>>> df = spark.createDataFrame([('abcedfg', {"key": "value"})], ["l", "d"])
|
|
700
|
+
>>> df.select(df.l[slice(1, 3)], df.d['key']).show()
|
|
701
|
+
+------------------+------+
|
|
702
|
+
|substring(l, 1, 3)|d[key]|
|
|
703
|
+
+------------------+------+
|
|
704
|
+
| abc| value|
|
|
705
|
+
+------------------+------+
|
|
706
|
+
"""
|
|
707
|
+
if isinstance(k, slice):
|
|
708
|
+
if k.step is not None:
|
|
709
|
+
raise PySparkValueError(
|
|
710
|
+
error_class="SLICE_WITH_STEP",
|
|
711
|
+
message_parameters={},
|
|
712
|
+
)
|
|
713
|
+
return self.substr(k.start, k.stop)
|
|
714
|
+
else:
|
|
715
|
+
return _bin_op("apply")(self, k)
|
|
716
|
+
|
|
717
|
+
def __iter__(self) -> None:
|
|
718
|
+
raise PySparkTypeError(
|
|
719
|
+
error_class="NOT_ITERABLE", message_parameters={"objectName": "Column"}
|
|
720
|
+
)
|
|
721
|
+
|
|
722
|
+
# string methods
|
|
723
|
+
_contains_doc = """
|
|
724
|
+
Contains the other element. Returns a boolean :class:`Column` based on a string match.
|
|
725
|
+
|
|
726
|
+
.. versionchanged:: 3.4.0
|
|
727
|
+
Supports Spark Connect.
|
|
728
|
+
|
|
729
|
+
Parameters
|
|
730
|
+
----------
|
|
731
|
+
other
|
|
732
|
+
string in line. A value as a literal or a :class:`Column`.
|
|
733
|
+
|
|
734
|
+
Examples
|
|
735
|
+
--------
|
|
736
|
+
>>> df = spark.createDataFrame(
|
|
737
|
+
... [(2, "Alice"), (5, "Bob")], ["age", "name"])
|
|
738
|
+
>>> df.filter(df.name.contains('o')).collect()
|
|
739
|
+
[Row(age=5, name='Bob')]
|
|
740
|
+
"""
|
|
741
|
+
_startswith_doc = """
|
|
742
|
+
String starts with. Returns a boolean :class:`Column` based on a string match.
|
|
743
|
+
|
|
744
|
+
.. versionchanged:: 3.4.0
|
|
745
|
+
Supports Spark Connect.
|
|
746
|
+
|
|
747
|
+
Parameters
|
|
748
|
+
----------
|
|
749
|
+
other : :class:`Column` or str
|
|
750
|
+
string at start of line (do not use a regex `^`)
|
|
751
|
+
|
|
752
|
+
Examples
|
|
753
|
+
--------
|
|
754
|
+
>>> df = spark.createDataFrame(
|
|
755
|
+
... [(2, "Alice"), (5, "Bob")], ["age", "name"])
|
|
756
|
+
>>> df.filter(df.name.startswith('Al')).collect()
|
|
757
|
+
[Row(age=2, name='Alice')]
|
|
758
|
+
>>> df.filter(df.name.startswith('^Al')).collect()
|
|
759
|
+
[]
|
|
760
|
+
"""
|
|
761
|
+
_endswith_doc = """
|
|
762
|
+
String ends with. Returns a boolean :class:`Column` based on a string match.
|
|
763
|
+
|
|
764
|
+
.. versionchanged:: 3.4.0
|
|
765
|
+
Supports Spark Connect.
|
|
766
|
+
|
|
767
|
+
Parameters
|
|
768
|
+
----------
|
|
769
|
+
other : :class:`Column` or str
|
|
770
|
+
string at end of line (do not use a regex `$`)
|
|
771
|
+
|
|
772
|
+
Examples
|
|
773
|
+
--------
|
|
774
|
+
>>> df = spark.createDataFrame(
|
|
775
|
+
... [(2, "Alice"), (5, "Bob")], ["age", "name"])
|
|
776
|
+
>>> df.filter(df.name.endswith('ice')).collect()
|
|
777
|
+
[Row(age=2, name='Alice')]
|
|
778
|
+
>>> df.filter(df.name.endswith('ice$')).collect()
|
|
779
|
+
[]
|
|
780
|
+
"""
|
|
781
|
+
|
|
782
|
+
contains = _bin_op("contains", _contains_doc)
|
|
783
|
+
startswith = _bin_op("startsWith", _startswith_doc)
|
|
784
|
+
endswith = _bin_op("endsWith", _endswith_doc)
|
|
785
|
+
|
|
786
|
+
def like(self: "Column", other: str) -> "Column":
|
|
787
|
+
"""
|
|
788
|
+
SQL like expression. Returns a boolean :class:`Column` based on a SQL LIKE match.
|
|
789
|
+
|
|
790
|
+
.. versionchanged:: 3.4.0
|
|
791
|
+
Supports Spark Connect.
|
|
792
|
+
|
|
793
|
+
Parameters
|
|
794
|
+
----------
|
|
795
|
+
other : str
|
|
796
|
+
a SQL LIKE pattern
|
|
797
|
+
|
|
798
|
+
See Also
|
|
799
|
+
--------
|
|
800
|
+
pyspark.sql.Column.rlike
|
|
801
|
+
|
|
802
|
+
Returns
|
|
803
|
+
-------
|
|
804
|
+
:class:`Column`
|
|
805
|
+
Column of booleans showing whether each element
|
|
806
|
+
in the Column is matched by SQL LIKE pattern.
|
|
807
|
+
|
|
808
|
+
Examples
|
|
809
|
+
--------
|
|
810
|
+
>>> df = spark.createDataFrame(
|
|
811
|
+
... [(2, "Alice"), (5, "Bob")], ["age", "name"])
|
|
812
|
+
>>> df.filter(df.name.like('Al%')).collect()
|
|
813
|
+
[Row(age=2, name='Alice')]
|
|
814
|
+
"""
|
|
815
|
+
njc = getattr(self._jc, "like")(other)
|
|
816
|
+
return Column(njc)
|
|
817
|
+
|
|
818
|
+
def rlike(self: "Column", other: str) -> "Column":
|
|
819
|
+
"""
|
|
820
|
+
SQL RLIKE expression (LIKE with Regex). Returns a boolean :class:`Column` based on a regex
|
|
821
|
+
match.
|
|
822
|
+
|
|
823
|
+
.. versionchanged:: 3.4.0
|
|
824
|
+
Supports Spark Connect.
|
|
825
|
+
|
|
826
|
+
Parameters
|
|
827
|
+
----------
|
|
828
|
+
other : str
|
|
829
|
+
an extended regex expression
|
|
830
|
+
|
|
831
|
+
Returns
|
|
832
|
+
-------
|
|
833
|
+
:class:`Column`
|
|
834
|
+
Column of booleans showing whether each element
|
|
835
|
+
in the Column is matched by extended regex expression.
|
|
836
|
+
|
|
837
|
+
Examples
|
|
838
|
+
--------
|
|
839
|
+
>>> df = spark.createDataFrame(
|
|
840
|
+
... [(2, "Alice"), (5, "Bob")], ["age", "name"])
|
|
841
|
+
>>> df.filter(df.name.rlike('ice$')).collect()
|
|
842
|
+
[Row(age=2, name='Alice')]
|
|
843
|
+
"""
|
|
844
|
+
njc = getattr(self._jc, "rlike")(other)
|
|
845
|
+
return Column(njc)
|
|
846
|
+
|
|
847
|
+
def ilike(self: "Column", other: str) -> "Column":
|
|
848
|
+
"""
|
|
849
|
+
SQL ILIKE expression (case insensitive LIKE). Returns a boolean :class:`Column`
|
|
850
|
+
based on a case insensitive match.
|
|
851
|
+
|
|
852
|
+
.. versionadded:: 3.3.0
|
|
853
|
+
|
|
854
|
+
.. versionchanged:: 3.4.0
|
|
855
|
+
Supports Spark Connect.
|
|
856
|
+
|
|
857
|
+
Parameters
|
|
858
|
+
----------
|
|
859
|
+
other : str
|
|
860
|
+
a SQL LIKE pattern
|
|
861
|
+
|
|
862
|
+
See Also
|
|
863
|
+
--------
|
|
864
|
+
pyspark.sql.Column.rlike
|
|
865
|
+
|
|
866
|
+
Returns
|
|
867
|
+
-------
|
|
868
|
+
:class:`Column`
|
|
869
|
+
Column of booleans showing whether each element
|
|
870
|
+
in the Column is matched by SQL LIKE pattern.
|
|
871
|
+
|
|
872
|
+
Examples
|
|
873
|
+
--------
|
|
874
|
+
>>> df = spark.createDataFrame(
|
|
875
|
+
... [(2, "Alice"), (5, "Bob")], ["age", "name"])
|
|
876
|
+
>>> df.filter(df.name.ilike('%Ice')).collect()
|
|
877
|
+
[Row(age=2, name='Alice')]
|
|
878
|
+
"""
|
|
879
|
+
njc = getattr(self._jc, "ilike")(other)
|
|
880
|
+
return Column(njc)
|
|
881
|
+
|
|
882
|
+
@overload
|
|
883
|
+
def substr(self, startPos: int, length: int) -> "Column":
|
|
884
|
+
...
|
|
885
|
+
|
|
886
|
+
@overload
|
|
887
|
+
def substr(self, startPos: "Column", length: "Column") -> "Column":
|
|
888
|
+
...
|
|
889
|
+
|
|
890
|
+
def substr(self, startPos: Union[int, "Column"], length: Union[int, "Column"]) -> "Column":
|
|
891
|
+
"""
|
|
892
|
+
Return a :class:`Column` which is a substring of the column.
|
|
893
|
+
|
|
894
|
+
.. versionadded:: 1.3.0
|
|
895
|
+
|
|
896
|
+
.. versionchanged:: 3.4.0
|
|
897
|
+
Supports Spark Connect.
|
|
898
|
+
|
|
899
|
+
Parameters
|
|
900
|
+
----------
|
|
901
|
+
startPos : :class:`Column` or int
|
|
902
|
+
start position
|
|
903
|
+
length : :class:`Column` or int
|
|
904
|
+
length of the substring
|
|
905
|
+
|
|
906
|
+
Returns
|
|
907
|
+
-------
|
|
908
|
+
:class:`Column`
|
|
909
|
+
Column representing whether each element of Column is substr of origin Column.
|
|
910
|
+
|
|
911
|
+
Examples
|
|
912
|
+
--------
|
|
913
|
+
>>> df = spark.createDataFrame(
|
|
914
|
+
... [(2, "Alice"), (5, "Bob")], ["age", "name"])
|
|
915
|
+
>>> df.select(df.name.substr(1, 3).alias("col")).collect()
|
|
916
|
+
[Row(col='Ali'), Row(col='Bob')]
|
|
917
|
+
"""
|
|
918
|
+
if type(startPos) != type(length):
|
|
919
|
+
raise PySparkTypeError(
|
|
920
|
+
error_class="NOT_SAME_TYPE",
|
|
921
|
+
message_parameters={
|
|
922
|
+
"arg_name1": "startPos",
|
|
923
|
+
"arg_name2": "length",
|
|
924
|
+
"arg_type1": type(startPos).__name__,
|
|
925
|
+
"arg_type2": type(length).__name__,
|
|
926
|
+
},
|
|
927
|
+
)
|
|
928
|
+
if isinstance(startPos, int):
|
|
929
|
+
jc = self._jc.substr(startPos, length)
|
|
930
|
+
elif isinstance(startPos, Column):
|
|
931
|
+
jc = self._jc.substr(startPos._jc, cast("Column", length)._jc)
|
|
932
|
+
else:
|
|
933
|
+
raise PySparkTypeError(
|
|
934
|
+
error_class="NOT_COLUMN_OR_INT",
|
|
935
|
+
message_parameters={"arg_name": "startPos", "arg_type": type(startPos).__name__},
|
|
936
|
+
)
|
|
937
|
+
return Column(jc)
|
|
938
|
+
|
|
939
|
+
def isin(self, *cols: Any) -> "Column":
|
|
940
|
+
"""
|
|
941
|
+
A boolean expression that is evaluated to true if the value of this
|
|
942
|
+
expression is contained by the evaluated values of the arguments.
|
|
943
|
+
|
|
944
|
+
.. versionadded:: 1.5.0
|
|
945
|
+
|
|
946
|
+
.. versionchanged:: 3.4.0
|
|
947
|
+
Supports Spark Connect.
|
|
948
|
+
|
|
949
|
+
Parameters
|
|
950
|
+
----------
|
|
951
|
+
cols
|
|
952
|
+
The result will only be true at a location if any value matches in the Column.
|
|
953
|
+
|
|
954
|
+
Returns
|
|
955
|
+
-------
|
|
956
|
+
:class:`Column`
|
|
957
|
+
Column of booleans showing whether each element in the Column is contained in cols.
|
|
958
|
+
|
|
959
|
+
Examples
|
|
960
|
+
--------
|
|
961
|
+
>>> df = spark.createDataFrame(
|
|
962
|
+
... [(2, "Alice"), (5, "Bob")], ["age", "name"])
|
|
963
|
+
>>> df[df.name.isin("Bob", "Mike")].collect()
|
|
964
|
+
[Row(age=5, name='Bob')]
|
|
965
|
+
>>> df[df.age.isin([1, 2, 3])].collect()
|
|
966
|
+
[Row(age=2, name='Alice')]
|
|
967
|
+
"""
|
|
968
|
+
if len(cols) == 1 and isinstance(cols[0], (list, set)):
|
|
969
|
+
cols = cast(Tuple, cols[0])
|
|
970
|
+
cols = cast(
|
|
971
|
+
Tuple,
|
|
972
|
+
[c._jc if isinstance(c, Column) else _create_column_from_literal(c) for c in cols],
|
|
973
|
+
)
|
|
974
|
+
sc = get_active_spark_context()
|
|
975
|
+
jc = getattr(self._jc, "isin")(_to_seq(sc, cols))
|
|
976
|
+
return Column(jc)
|
|
977
|
+
|
|
978
|
+
# order
|
|
979
|
+
_asc_doc = """
|
|
980
|
+
Returns a sort expression based on the ascending order of the column.
|
|
981
|
+
|
|
982
|
+
.. versionchanged:: 3.4.0
|
|
983
|
+
Supports Spark Connect.
|
|
984
|
+
|
|
985
|
+
Examples
|
|
986
|
+
--------
|
|
987
|
+
>>> from pyspark.sql import Row
|
|
988
|
+
>>> df = spark.createDataFrame([('Tom', 80), ('Alice', None)], ["name", "height"])
|
|
989
|
+
>>> df.select(df.name).orderBy(df.name.asc()).collect()
|
|
990
|
+
[Row(name='Alice'), Row(name='Tom')]
|
|
991
|
+
"""
|
|
992
|
+
_asc_nulls_first_doc = """
|
|
993
|
+
Returns a sort expression based on ascending order of the column, and null values
|
|
994
|
+
return before non-null values.
|
|
995
|
+
|
|
996
|
+
.. versionadded:: 2.4.0
|
|
997
|
+
|
|
998
|
+
.. versionchanged:: 3.4.0
|
|
999
|
+
Supports Spark Connect.
|
|
1000
|
+
|
|
1001
|
+
Examples
|
|
1002
|
+
--------
|
|
1003
|
+
>>> from pyspark.sql import Row
|
|
1004
|
+
>>> df = spark.createDataFrame([('Tom', 80), (None, 60), ('Alice', None)], ["name", "height"])
|
|
1005
|
+
>>> df.select(df.name).orderBy(df.name.asc_nulls_first()).collect()
|
|
1006
|
+
[Row(name=None), Row(name='Alice'), Row(name='Tom')]
|
|
1007
|
+
|
|
1008
|
+
"""
|
|
1009
|
+
_asc_nulls_last_doc = """
|
|
1010
|
+
Returns a sort expression based on ascending order of the column, and null values
|
|
1011
|
+
appear after non-null values.
|
|
1012
|
+
|
|
1013
|
+
.. versionadded:: 2.4.0
|
|
1014
|
+
|
|
1015
|
+
.. versionchanged:: 3.4.0
|
|
1016
|
+
Supports Spark Connect.
|
|
1017
|
+
|
|
1018
|
+
Examples
|
|
1019
|
+
--------
|
|
1020
|
+
>>> from pyspark.sql import Row
|
|
1021
|
+
>>> df = spark.createDataFrame([('Tom', 80), (None, 60), ('Alice', None)], ["name", "height"])
|
|
1022
|
+
>>> df.select(df.name).orderBy(df.name.asc_nulls_last()).collect()
|
|
1023
|
+
[Row(name='Alice'), Row(name='Tom'), Row(name=None)]
|
|
1024
|
+
|
|
1025
|
+
"""
|
|
1026
|
+
_desc_doc = """
|
|
1027
|
+
Returns a sort expression based on the descending order of the column.
|
|
1028
|
+
|
|
1029
|
+
.. versionadded:: 2.4.0
|
|
1030
|
+
|
|
1031
|
+
.. versionchanged:: 3.4.0
|
|
1032
|
+
Supports Spark Connect.
|
|
1033
|
+
|
|
1034
|
+
Examples
|
|
1035
|
+
--------
|
|
1036
|
+
>>> from pyspark.sql import Row
|
|
1037
|
+
>>> df = spark.createDataFrame([('Tom', 80), ('Alice', None)], ["name", "height"])
|
|
1038
|
+
>>> df.select(df.name).orderBy(df.name.desc()).collect()
|
|
1039
|
+
[Row(name='Tom'), Row(name='Alice')]
|
|
1040
|
+
"""
|
|
1041
|
+
_desc_nulls_first_doc = """
|
|
1042
|
+
Returns a sort expression based on the descending order of the column, and null values
|
|
1043
|
+
appear before non-null values.
|
|
1044
|
+
|
|
1045
|
+
.. versionadded:: 2.4.0
|
|
1046
|
+
|
|
1047
|
+
.. versionchanged:: 3.4.0
|
|
1048
|
+
Supports Spark Connect.
|
|
1049
|
+
|
|
1050
|
+
Examples
|
|
1051
|
+
--------
|
|
1052
|
+
>>> from pyspark.sql import Row
|
|
1053
|
+
>>> df = spark.createDataFrame([('Tom', 80), (None, 60), ('Alice', None)], ["name", "height"])
|
|
1054
|
+
>>> df.select(df.name).orderBy(df.name.desc_nulls_first()).collect()
|
|
1055
|
+
[Row(name=None), Row(name='Tom'), Row(name='Alice')]
|
|
1056
|
+
|
|
1057
|
+
"""
|
|
1058
|
+
_desc_nulls_last_doc = """
|
|
1059
|
+
Returns a sort expression based on the descending order of the column, and null values
|
|
1060
|
+
appear after non-null values.
|
|
1061
|
+
|
|
1062
|
+
.. versionadded:: 2.4.0
|
|
1063
|
+
|
|
1064
|
+
.. versionchanged:: 3.4.0
|
|
1065
|
+
Supports Spark Connect.
|
|
1066
|
+
|
|
1067
|
+
Examples
|
|
1068
|
+
--------
|
|
1069
|
+
>>> from pyspark.sql import Row
|
|
1070
|
+
>>> df = spark.createDataFrame([('Tom', 80), (None, 60), ('Alice', None)], ["name", "height"])
|
|
1071
|
+
>>> df.select(df.name).orderBy(df.name.desc_nulls_last()).collect()
|
|
1072
|
+
[Row(name='Tom'), Row(name='Alice'), Row(name=None)]
|
|
1073
|
+
"""
|
|
1074
|
+
|
|
1075
|
+
asc = _unary_op("asc", _asc_doc)
|
|
1076
|
+
asc_nulls_first = _unary_op("asc_nulls_first", _asc_nulls_first_doc)
|
|
1077
|
+
asc_nulls_last = _unary_op("asc_nulls_last", _asc_nulls_last_doc)
|
|
1078
|
+
desc = _unary_op("desc", _desc_doc)
|
|
1079
|
+
desc_nulls_first = _unary_op("desc_nulls_first", _desc_nulls_first_doc)
|
|
1080
|
+
desc_nulls_last = _unary_op("desc_nulls_last", _desc_nulls_last_doc)
|
|
1081
|
+
|
|
1082
|
+
_isNull_doc = """
|
|
1083
|
+
True if the current expression is null.
|
|
1084
|
+
|
|
1085
|
+
.. versionchanged:: 3.4.0
|
|
1086
|
+
Supports Spark Connect.
|
|
1087
|
+
|
|
1088
|
+
Examples
|
|
1089
|
+
--------
|
|
1090
|
+
>>> from pyspark.sql import Row
|
|
1091
|
+
>>> df = spark.createDataFrame([Row(name='Tom', height=80), Row(name='Alice', height=None)])
|
|
1092
|
+
>>> df.filter(df.height.isNull()).collect()
|
|
1093
|
+
[Row(name='Alice', height=None)]
|
|
1094
|
+
"""
|
|
1095
|
+
_isNotNull_doc = """
|
|
1096
|
+
True if the current expression is NOT null.
|
|
1097
|
+
|
|
1098
|
+
.. versionchanged:: 3.4.0
|
|
1099
|
+
Supports Spark Connect.
|
|
1100
|
+
|
|
1101
|
+
Examples
|
|
1102
|
+
--------
|
|
1103
|
+
>>> from pyspark.sql import Row
|
|
1104
|
+
>>> df = spark.createDataFrame([Row(name='Tom', height=80), Row(name='Alice', height=None)])
|
|
1105
|
+
>>> df.filter(df.height.isNotNull()).collect()
|
|
1106
|
+
[Row(name='Tom', height=80)]
|
|
1107
|
+
"""
|
|
1108
|
+
|
|
1109
|
+
isNull = _unary_op("isNull", _isNull_doc)
|
|
1110
|
+
isNotNull = _unary_op("isNotNull", _isNotNull_doc)
|
|
1111
|
+
|
|
1112
|
+
def alias(self, *alias: str, **kwargs: Any) -> "Column":
|
|
1113
|
+
"""
|
|
1114
|
+
Returns this column aliased with a new name or names (in the case of expressions that
|
|
1115
|
+
return more than one column, such as explode).
|
|
1116
|
+
|
|
1117
|
+
.. versionadded:: 1.3.0
|
|
1118
|
+
|
|
1119
|
+
.. versionchanged:: 3.4.0
|
|
1120
|
+
Supports Spark Connect.
|
|
1121
|
+
|
|
1122
|
+
Parameters
|
|
1123
|
+
----------
|
|
1124
|
+
alias : str
|
|
1125
|
+
desired column names (collects all positional arguments passed)
|
|
1126
|
+
|
|
1127
|
+
Other Parameters
|
|
1128
|
+
----------------
|
|
1129
|
+
metadata: dict
|
|
1130
|
+
a dict of information to be stored in ``metadata`` attribute of the
|
|
1131
|
+
corresponding :class:`StructField <pyspark.sql.types.StructField>` (optional, keyword
|
|
1132
|
+
only argument)
|
|
1133
|
+
|
|
1134
|
+
.. versionchanged:: 2.2.0
|
|
1135
|
+
Added optional ``metadata`` argument.
|
|
1136
|
+
|
|
1137
|
+
Returns
|
|
1138
|
+
-------
|
|
1139
|
+
:class:`Column`
|
|
1140
|
+
Column representing whether each element of Column is aliased with new name or names.
|
|
1141
|
+
|
|
1142
|
+
Examples
|
|
1143
|
+
--------
|
|
1144
|
+
>>> df = spark.createDataFrame(
|
|
1145
|
+
... [(2, "Alice"), (5, "Bob")], ["age", "name"])
|
|
1146
|
+
>>> df.select(df.age.alias("age2")).collect()
|
|
1147
|
+
[Row(age2=2), Row(age2=5)]
|
|
1148
|
+
>>> df.select(df.age.alias("age3", metadata={'max': 99})).schema['age3'].metadata['max']
|
|
1149
|
+
99
|
|
1150
|
+
"""
|
|
1151
|
+
|
|
1152
|
+
metadata = kwargs.pop("metadata", None)
|
|
1153
|
+
assert not kwargs, "Unexpected kwargs where passed: %s" % kwargs
|
|
1154
|
+
|
|
1155
|
+
sc = get_active_spark_context()
|
|
1156
|
+
if len(alias) == 1:
|
|
1157
|
+
if metadata:
|
|
1158
|
+
assert sc._jvm is not None
|
|
1159
|
+
jmeta = sc._jvm.org.apache.spark.sql.types.Metadata.fromJson(json.dumps(metadata))
|
|
1160
|
+
return Column(getattr(self._jc, "as")(alias[0], jmeta))
|
|
1161
|
+
else:
|
|
1162
|
+
return Column(getattr(self._jc, "as")(alias[0]))
|
|
1163
|
+
else:
|
|
1164
|
+
if metadata:
|
|
1165
|
+
raise PySparkValueError(
|
|
1166
|
+
error_class="ONLY_ALLOWED_FOR_SINGLE_COLUMN",
|
|
1167
|
+
message_parameters={"arg_name": "metadata"},
|
|
1168
|
+
)
|
|
1169
|
+
return Column(getattr(self._jc, "as")(_to_seq(sc, list(alias))))
|
|
1170
|
+
|
|
1171
|
+
name = copy_func(alias, sinceversion=2.0, doc=":func:`name` is an alias for :func:`alias`.")
|
|
1172
|
+
|
|
1173
|
+
def cast(self, dataType: Union[DataType, str]) -> "Column":
|
|
1174
|
+
"""
|
|
1175
|
+
Casts the column into type ``dataType``.
|
|
1176
|
+
|
|
1177
|
+
.. versionadded:: 1.3.0
|
|
1178
|
+
|
|
1179
|
+
.. versionchanged:: 3.4.0
|
|
1180
|
+
Supports Spark Connect.
|
|
1181
|
+
|
|
1182
|
+
Parameters
|
|
1183
|
+
----------
|
|
1184
|
+
dataType : :class:`DataType` or str
|
|
1185
|
+
a DataType or Python string literal with a DDL-formatted string
|
|
1186
|
+
to use when parsing the column to the same type.
|
|
1187
|
+
|
|
1188
|
+
Returns
|
|
1189
|
+
-------
|
|
1190
|
+
:class:`Column`
|
|
1191
|
+
Column representing whether each element of Column is cast into new type.
|
|
1192
|
+
|
|
1193
|
+
Examples
|
|
1194
|
+
--------
|
|
1195
|
+
>>> from pyspark.sql.types import StringType
|
|
1196
|
+
>>> df = spark.createDataFrame(
|
|
1197
|
+
... [(2, "Alice"), (5, "Bob")], ["age", "name"])
|
|
1198
|
+
>>> df.select(df.age.cast("string").alias('ages')).collect()
|
|
1199
|
+
[Row(ages='2'), Row(ages='5')]
|
|
1200
|
+
>>> df.select(df.age.cast(StringType()).alias('ages')).collect()
|
|
1201
|
+
[Row(ages='2'), Row(ages='5')]
|
|
1202
|
+
"""
|
|
1203
|
+
if isinstance(dataType, str):
|
|
1204
|
+
jc = self._jc.cast(dataType)
|
|
1205
|
+
elif isinstance(dataType, DataType):
|
|
1206
|
+
from pyspark.sql import SparkSession
|
|
1207
|
+
|
|
1208
|
+
spark = SparkSession._getActiveSessionOrCreate()
|
|
1209
|
+
jdt = spark._jsparkSession.parseDataType(dataType.json())
|
|
1210
|
+
jc = self._jc.cast(jdt)
|
|
1211
|
+
else:
|
|
1212
|
+
raise PySparkTypeError(
|
|
1213
|
+
error_class="NOT_DATATYPE_OR_STR",
|
|
1214
|
+
message_parameters={"arg_name": "dataType", "arg_type": type(dataType).__name__},
|
|
1215
|
+
)
|
|
1216
|
+
return Column(jc)
|
|
1217
|
+
|
|
1218
|
+
astype = copy_func(cast, sinceversion=1.4, doc=":func:`astype` is an alias for :func:`cast`.")
|
|
1219
|
+
|
|
1220
|
+
def between(
|
|
1221
|
+
self,
|
|
1222
|
+
lowerBound: Union["Column", "LiteralType", "DateTimeLiteral", "DecimalLiteral"],
|
|
1223
|
+
upperBound: Union["Column", "LiteralType", "DateTimeLiteral", "DecimalLiteral"],
|
|
1224
|
+
) -> "Column":
|
|
1225
|
+
"""
|
|
1226
|
+
True if the current column is between the lower bound and upper bound, inclusive.
|
|
1227
|
+
|
|
1228
|
+
.. versionadded:: 1.3.0
|
|
1229
|
+
|
|
1230
|
+
.. versionchanged:: 3.4.0
|
|
1231
|
+
Supports Spark Connect.
|
|
1232
|
+
|
|
1233
|
+
Parameters
|
|
1234
|
+
----------
|
|
1235
|
+
lowerBound : :class:`Column`, int, float, string, bool, datetime, date or Decimal
|
|
1236
|
+
a boolean expression that boundary start, inclusive.
|
|
1237
|
+
upperBound : :class:`Column`, int, float, string, bool, datetime, date or Decimal
|
|
1238
|
+
a boolean expression that boundary end, inclusive.
|
|
1239
|
+
|
|
1240
|
+
Returns
|
|
1241
|
+
-------
|
|
1242
|
+
:class:`Column`
|
|
1243
|
+
Column of booleans showing whether each element of Column
|
|
1244
|
+
is between left and right (inclusive).
|
|
1245
|
+
|
|
1246
|
+
Examples
|
|
1247
|
+
--------
|
|
1248
|
+
>>> df = spark.createDataFrame(
|
|
1249
|
+
... [(2, "Alice"), (5, "Bob")], ["age", "name"])
|
|
1250
|
+
>>> df.select(df.name, df.age.between(2, 4)).show()
|
|
1251
|
+
+-----+---------------------------+
|
|
1252
|
+
| name|((age >= 2) AND (age <= 4))|
|
|
1253
|
+
+-----+---------------------------+
|
|
1254
|
+
|Alice| true|
|
|
1255
|
+
| Bob| false|
|
|
1256
|
+
+-----+---------------------------+
|
|
1257
|
+
"""
|
|
1258
|
+
return (self >= lowerBound) & (self <= upperBound)
|
|
1259
|
+
|
|
1260
|
+
def when(self, condition: "Column", value: Any) -> "Column":
|
|
1261
|
+
"""
|
|
1262
|
+
Evaluates a list of conditions and returns one of multiple possible result expressions.
|
|
1263
|
+
If :func:`Column.otherwise` is not invoked, None is returned for unmatched conditions.
|
|
1264
|
+
|
|
1265
|
+
.. versionadded:: 1.4.0
|
|
1266
|
+
|
|
1267
|
+
.. versionchanged:: 3.4.0
|
|
1268
|
+
Supports Spark Connect.
|
|
1269
|
+
|
|
1270
|
+
Parameters
|
|
1271
|
+
----------
|
|
1272
|
+
condition : :class:`Column`
|
|
1273
|
+
a boolean :class:`Column` expression.
|
|
1274
|
+
value
|
|
1275
|
+
a literal value, or a :class:`Column` expression.
|
|
1276
|
+
|
|
1277
|
+
Returns
|
|
1278
|
+
-------
|
|
1279
|
+
:class:`Column`
|
|
1280
|
+
Column representing whether each element of Column is in conditions.
|
|
1281
|
+
|
|
1282
|
+
Examples
|
|
1283
|
+
--------
|
|
1284
|
+
>>> from pyspark.sql import functions as sf
|
|
1285
|
+
>>> df = spark.createDataFrame(
|
|
1286
|
+
... [(2, "Alice"), (5, "Bob")], ["age", "name"])
|
|
1287
|
+
>>> df.select(df.name, sf.when(df.age > 4, 1).when(df.age < 3, -1).otherwise(0)).show()
|
|
1288
|
+
+-----+------------------------------------------------------------+
|
|
1289
|
+
| name|CASE WHEN (age > 4) THEN 1 WHEN (age < 3) THEN -1 ELSE 0 END|
|
|
1290
|
+
+-----+------------------------------------------------------------+
|
|
1291
|
+
|Alice| -1|
|
|
1292
|
+
| Bob| 1|
|
|
1293
|
+
+-----+------------------------------------------------------------+
|
|
1294
|
+
|
|
1295
|
+
See Also
|
|
1296
|
+
--------
|
|
1297
|
+
pyspark.sql.functions.when
|
|
1298
|
+
"""
|
|
1299
|
+
if not isinstance(condition, Column):
|
|
1300
|
+
raise PySparkTypeError(
|
|
1301
|
+
error_class="NOT_COLUMN",
|
|
1302
|
+
message_parameters={"arg_name": "condition", "arg_type": type(condition).__name__},
|
|
1303
|
+
)
|
|
1304
|
+
v = value._jc if isinstance(value, Column) else value
|
|
1305
|
+
jc = self._jc.when(condition._jc, v)
|
|
1306
|
+
return Column(jc)
|
|
1307
|
+
|
|
1308
|
+
def otherwise(self, value: Any) -> "Column":
|
|
1309
|
+
"""
|
|
1310
|
+
Evaluates a list of conditions and returns one of multiple possible result expressions.
|
|
1311
|
+
If :func:`Column.otherwise` is not invoked, None is returned for unmatched conditions.
|
|
1312
|
+
|
|
1313
|
+
.. versionadded:: 1.4.0
|
|
1314
|
+
|
|
1315
|
+
.. versionchanged:: 3.4.0
|
|
1316
|
+
Supports Spark Connect.
|
|
1317
|
+
|
|
1318
|
+
Parameters
|
|
1319
|
+
----------
|
|
1320
|
+
value
|
|
1321
|
+
a literal value, or a :class:`Column` expression.
|
|
1322
|
+
|
|
1323
|
+
Returns
|
|
1324
|
+
-------
|
|
1325
|
+
:class:`Column`
|
|
1326
|
+
Column representing whether each element of Column is unmatched conditions.
|
|
1327
|
+
|
|
1328
|
+
Examples
|
|
1329
|
+
--------
|
|
1330
|
+
>>> from pyspark.sql import functions as sf
|
|
1331
|
+
>>> df = spark.createDataFrame(
|
|
1332
|
+
... [(2, "Alice"), (5, "Bob")], ["age", "name"])
|
|
1333
|
+
>>> df.select(df.name, sf.when(df.age > 3, 1).otherwise(0)).show()
|
|
1334
|
+
+-----+-------------------------------------+
|
|
1335
|
+
| name|CASE WHEN (age > 3) THEN 1 ELSE 0 END|
|
|
1336
|
+
+-----+-------------------------------------+
|
|
1337
|
+
|Alice| 0|
|
|
1338
|
+
| Bob| 1|
|
|
1339
|
+
+-----+-------------------------------------+
|
|
1340
|
+
|
|
1341
|
+
See Also
|
|
1342
|
+
--------
|
|
1343
|
+
pyspark.sql.functions.when
|
|
1344
|
+
"""
|
|
1345
|
+
v = value._jc if isinstance(value, Column) else value
|
|
1346
|
+
jc = self._jc.otherwise(v)
|
|
1347
|
+
return Column(jc)
|
|
1348
|
+
|
|
1349
|
+
def over(self, window: "WindowSpec") -> "Column":
|
|
1350
|
+
"""
|
|
1351
|
+
Define a windowing column.
|
|
1352
|
+
|
|
1353
|
+
.. versionadded:: 1.4.0
|
|
1354
|
+
|
|
1355
|
+
.. versionchanged:: 3.4.0
|
|
1356
|
+
Supports Spark Connect.
|
|
1357
|
+
|
|
1358
|
+
Parameters
|
|
1359
|
+
----------
|
|
1360
|
+
window : :class:`WindowSpec`
|
|
1361
|
+
|
|
1362
|
+
Returns
|
|
1363
|
+
-------
|
|
1364
|
+
:class:`Column`
|
|
1365
|
+
|
|
1366
|
+
Examples
|
|
1367
|
+
--------
|
|
1368
|
+
>>> from pyspark.sql import Window
|
|
1369
|
+
>>> window = (
|
|
1370
|
+
... Window.partitionBy("name")
|
|
1371
|
+
... .orderBy("age")
|
|
1372
|
+
... .rowsBetween(Window.unboundedPreceding, Window.currentRow)
|
|
1373
|
+
... )
|
|
1374
|
+
>>> from pyspark.sql.functions import rank, min, desc
|
|
1375
|
+
>>> df = spark.createDataFrame(
|
|
1376
|
+
... [(2, "Alice"), (5, "Bob")], ["age", "name"])
|
|
1377
|
+
>>> df.withColumn(
|
|
1378
|
+
... "rank", rank().over(window)
|
|
1379
|
+
... ).withColumn(
|
|
1380
|
+
... "min", min('age').over(window)
|
|
1381
|
+
... ).sort(desc("age")).show()
|
|
1382
|
+
+---+-----+----+---+
|
|
1383
|
+
|age| name|rank|min|
|
|
1384
|
+
+---+-----+----+---+
|
|
1385
|
+
| 5| Bob| 1| 5|
|
|
1386
|
+
| 2|Alice| 1| 2|
|
|
1387
|
+
+---+-----+----+---+
|
|
1388
|
+
"""
|
|
1389
|
+
from pyspark.sql.window import WindowSpec
|
|
1390
|
+
|
|
1391
|
+
if not isinstance(window, WindowSpec):
|
|
1392
|
+
raise PySparkTypeError(
|
|
1393
|
+
error_class="NOT_WINDOWSPEC",
|
|
1394
|
+
message_parameters={"arg_name": "window", "arg_type": type(window).__name__},
|
|
1395
|
+
)
|
|
1396
|
+
jc = self._jc.over(window._jspec)
|
|
1397
|
+
return Column(jc)
|
|
1398
|
+
|
|
1399
|
+
def __nonzero__(self) -> None:
|
|
1400
|
+
raise PySparkValueError(
|
|
1401
|
+
error_class="CANNOT_CONVERT_COLUMN_INTO_BOOL",
|
|
1402
|
+
message_parameters={},
|
|
1403
|
+
)
|
|
1404
|
+
|
|
1405
|
+
__bool__ = __nonzero__
|
|
1406
|
+
|
|
1407
|
+
def __repr__(self) -> str:
|
|
1408
|
+
return "Column<'%s'>" % self._jc.toString()
|
|
1409
|
+
|
|
1410
|
+
|
|
1411
|
+
def _test() -> None:
|
|
1412
|
+
import doctest
|
|
1413
|
+
from pyspark.sql import SparkSession
|
|
1414
|
+
import pyspark.sql.column
|
|
1415
|
+
|
|
1416
|
+
globs = pyspark.sql.column.__dict__.copy()
|
|
1417
|
+
spark = SparkSession.builder.master("local[4]").appName("sql.column tests").getOrCreate()
|
|
1418
|
+
globs["spark"] = spark
|
|
1419
|
+
|
|
1420
|
+
(failure_count, test_count) = doctest.testmod(
|
|
1421
|
+
pyspark.sql.column,
|
|
1422
|
+
globs=globs,
|
|
1423
|
+
optionflags=doctest.ELLIPSIS | doctest.NORMALIZE_WHITESPACE | doctest.REPORT_NDIFF,
|
|
1424
|
+
)
|
|
1425
|
+
spark.stop()
|
|
1426
|
+
if failure_count:
|
|
1427
|
+
sys.exit(-1)
|
|
1428
|
+
|
|
1429
|
+
|
|
1430
|
+
if __name__ == "__main__":
|
|
1431
|
+
_test()
|