spark-instrumented-optimizer/python/pyspark/worker.pyi
zero323 31a16fbb40 [SPARK-32714][PYTHON] Initial pyspark-stubs port
### What changes were proposed in this pull request?

This PR proposes migration of [`pyspark-stubs`](https://github.com/zero323/pyspark-stubs) into Spark codebase.

### Why are the changes needed?

### Does this PR introduce _any_ user-facing change?

Yes. This PR adds type annotations directly to Spark source.

This can impact interaction with development tools for users, which haven't used `pyspark-stubs`.

### How was this patch tested?

- [x] MyPy tests of the PySpark source
    ```
    mypy --no-incremental --config python/mypy.ini python/pyspark
    ```
- [x] MyPy tests of Spark examples
    ```
   MYPYPATH=python/ mypy --no-incremental --config python/mypy.ini examples/src/main/python/ml examples/src/main/python/sql examples/src/main/python/sql/streaming
    ```
- [x] Existing Flake8 linter

- [x] Existing unit tests

Tested against:

- `mypy==0.790+dev.e959952d9001e9713d329a2f9b196705b028f894`
- `mypy==0.782`

Closes #29591 from zero323/SPARK-32681.

Authored-by: zero323 <mszymkiewicz@gmail.com>
Signed-off-by: HyukjinKwon <gurwls223@apache.org>
2020-09-24 14:15:36 +09:00

74 lines
3.1 KiB
Python

#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
from pyspark import shuffle as shuffle
from pyspark.broadcast import Broadcast as Broadcast
from pyspark.files import SparkFiles as SparkFiles
from pyspark.java_gateway import local_connect_and_auth as local_connect_and_auth
from pyspark.rdd import PythonEvalType as PythonEvalType
from pyspark.resource import ResourceInformation as ResourceInformation
from pyspark.serializers import (
BatchedSerializer as BatchedSerializer,
PickleSerializer as PickleSerializer,
SpecialLengths as SpecialLengths,
UTF8Deserializer as UTF8Deserializer,
read_bool as read_bool,
read_int as read_int,
read_long as read_long,
write_int as write_int,
write_long as write_long,
write_with_length as write_with_length,
)
from pyspark.sql.pandas.serializers import (
ArrowStreamPandasUDFSerializer as ArrowStreamPandasUDFSerializer,
CogroupUDFSerializer as CogroupUDFSerializer,
)
from pyspark.sql.pandas.types import to_arrow_type as to_arrow_type
from pyspark.sql.types import StructType as StructType
from pyspark.taskcontext import (
BarrierTaskContext as BarrierTaskContext,
TaskContext as TaskContext,
)
from pyspark.util import fail_on_stopiteration as fail_on_stopiteration
from typing import Any
has_resource_module: bool
pickleSer: Any
utf8_deserializer: Any
def report_times(outfile: Any, boot: Any, init: Any, finish: Any) -> None: ...
def add_path(path: Any) -> None: ...
def read_command(serializer: Any, file: Any): ...
def chain(f: Any, g: Any): ...
def wrap_udf(f: Any, return_type: Any): ...
def wrap_scalar_pandas_udf(f: Any, return_type: Any): ...
def wrap_pandas_iter_udf(f: Any, return_type: Any): ...
def wrap_cogrouped_map_pandas_udf(f: Any, return_type: Any, argspec: Any): ...
def wrap_grouped_map_pandas_udf(f: Any, return_type: Any, argspec: Any): ...
def wrap_grouped_agg_pandas_udf(f: Any, return_type: Any): ...
def wrap_window_agg_pandas_udf(
f: Any, return_type: Any, runner_conf: Any, udf_index: Any
): ...
def wrap_unbounded_window_agg_pandas_udf(f: Any, return_type: Any): ...
def wrap_bounded_window_agg_pandas_udf(f: Any, return_type: Any): ...
def read_single_udf(
pickleSer: Any, infile: Any, eval_type: Any, runner_conf: Any, udf_index: Any
): ...
def read_udfs(pickleSer: Any, infile: Any, eval_type: Any): ...
def main(infile: Any, outfile: Any) -> None: ...