khalidmammadov opened a new pull request, #40916:
URL: https://github.com/apache/spark/pull/40916

   ### What changes were proposed in this pull request?
   This feature parity improvement and to add **level** param to df.printSchema 
for Python API (PySpark & Connect)
   
   ## Connect API
   
   Examples:
   ```
   root@f53642e9adb0:/home/spark# bin/pyspark --remote "local[*]"
   Python 3.9.5 (default, Nov 23 2021, 15:27:38) 
   [GCC 9.3.0] on linux
   Type "help", "copyright", "credits" or "license" for more information.
   Setting default log level to "WARN".
   To adjust logging level use sc.setLogLevel(newLevel). For SparkR, use 
setLogLevel(newLevel).
   23/04/23 13:31:58 WARN NativeCodeLoader: Unable to load native-hadoop 
library for your platform... using builtin-java classes where applicable
   Welcome to
         ____              __
        / __/__  ___ _____/ /__
       _\ \/ _ \/ _ `/ __/  '_/
      /__ / .__/\_,_/_/ /_/\_\   version 3.5.0.dev0
         /_/
   
   Using Python version 3.9.5 (default, Nov 23 2021 15:27:38)
   Client connected to the Spark Connect server at localhost
   SparkSession available as 'spark'.
   >>> df = spark.createDataFrame([(1, (2,2))], ["a", "b"])
   >>> df.printSchema(1)
   root
    |-- a: long (nullable = true)
    |-- b: struct (nullable = true)
   
   >>> df.printSchema(2)
   root
    |-- a: long (nullable = true)
    |-- b: struct (nullable = true)
    |    |-- _1: long (nullable = true)
    |    |-- _2: long (nullable = true)
   
   >>> df.printSchema(3)
   root
    |-- a: long (nullable = true)
    |-- b: struct (nullable = true)
    |    |-- _1: long (nullable = true)
    |    |-- _2: long (nullable = true)
    
   >>> df.printSchema()
   root
    |-- a: long (nullable = true)
    |-- b: struct (nullable = true)
    |    |-- _1: long (nullable = true)
    |    |-- _2: long (nullable = true)
   
   root@f53642e9adb0:/home/spark# bin/pyspark                    
   Python 3.9.5 (default, Nov 23 2021, 15:27:38) 
   [GCC 9.3.0] on linux
   Type "help", "copyright", "credits" or "license" for more information.
   Setting default log level to "WARN".
   To adjust logging level use sc.setLogLevel(newLevel). For SparkR, use 
setLogLevel(newLevel).
   23/04/23 13:36:42 WARN NativeCodeLoader: Unable to load native-hadoop 
library for your platform... using builtin-java classes where applicable
   Welcome to
         ____              __
        / __/__  ___ _____/ /__
       _\ \/ _ \/ _ `/ __/  '_/
      /__ / .__/\_,_/_/ /_/\_\   version 3.5.0-SNAPSHOT
         /_/
   
   Using Python version 3.9.5 (default, Nov 23 2021 15:27:38)
   Spark context Web UI available at http://localhost:4040
   Spark context available as 'sc' (master = local[*], app id = 
local-1682257002957).
   SparkSession available as 'spark'.
   >>> df = spark.createDataFrame([(1, (2,2))], ["a", "b"])
   >>> df.printSchema(1)
   root
    |-- a: long (nullable = true)
    |-- b: struct (nullable = true)
   
   >>> df.printSchema(2)
   root
    |-- a: long (nullable = true)
    |-- b: struct (nullable = true)
    |    |-- _1: long (nullable = true)
    |    |-- _2: long (nullable = true)
   
   >>> df.printSchema(3)
   root
    |-- a: long (nullable = true)
    |-- b: struct (nullable = true)
    |    |-- _1: long (nullable = true)
    |    |-- _2: long (nullable = true)
   
   >>> df.printSchema(0)
   root
    |-- a: long (nullable = true)
    |-- b: struct (nullable = true)
    |    |-- _1: long (nullable = true)
    |    |-- _2: long (nullable = true)
   
   ```
   
   
   ### Why are the changes needed?
   Feature parity
   
   
   ### Does this PR introduce _any_ user-facing change?
   Yes
   
   ### How was this patch tested?
   Existing and new test cases
   


-- 
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]

Reply via email to