ueshin commented on a change in pull request #34185:
URL: https://github.com/apache/spark/pull/34185#discussion_r731188906
##########
File path: python/pyspark/sql/context.py
##########
@@ -17,18 +17,49 @@
import sys
import warnings
-
-from pyspark import since, _NoValue
-from pyspark.sql.session import _monkey_patch_RDD, SparkSession
+from typing import (
+ Optional,
+ Union,
+ Callable,
+ Any,
+ Iterable,
+ List,
+ Tuple,
+ overload,
+ Type,
+ TYPE_CHECKING
+)
+
+from py4j.java_gateway import JavaObject
+
+from pyspark import since, _NoValue # type: ignore[attr-defined]
+from pyspark.sql.session import _monkey_patch_RDD, SparkSession # type:
ignore[attr-defined]
from pyspark.sql.dataframe import DataFrame
from pyspark.sql.readwriter import DataFrameReader
from pyspark.sql.streaming import DataStreamReader
from pyspark.sql.udf import UDFRegistration # noqa: F401
from pyspark.sql.utils import install_exception_handler
+from pyspark.context import SparkContext
+from pyspark.rdd import RDD
+from pyspark.sql.types import StructType
+
+if TYPE_CHECKING:
+ from pyspark.sql._typing import (
+ UserDefinedFunctionLike,
+ RowLike,
+ DateTimeLiteral,
+ LiteralType,
+ DecimalLiteral
+ )
+ from pyspark.sql.types import DataType, AtomicType
+ from pyspark.sql.pandas._typing import DataFrameLike
+ from pyspark.sql.streaming import StreamingQueryManager
+ from pyspark.conf import SparkConf
Review comment:
We can basically put them out of `TYPE_CHECKING` unless:
- cause circular import
- need to refer something available only during type checking, e.g.,
something defined in `*.pyi` files
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]