You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spark.apache.org by do...@apache.org on 2020/11/29 20:24:29 UTC

[spark] branch branch-3.0 updated: [SPARK-33585][SQL][DOCS] Fix the comment for `SQLContext.tables()` and mention the `database` column

This is an automated email from the ASF dual-hosted git repository.

dongjoon pushed a commit to branch branch-3.0
in repository https://gitbox.apache.org/repos/asf/spark.git


The following commit(s) were added to refs/heads/branch-3.0 by this push:
     new f67f80b  [SPARK-33585][SQL][DOCS] Fix the comment for `SQLContext.tables()` and mention the `database` column
f67f80b is described below

commit f67f80b6665176c7fd66300d389bdc6047d273c3
Author: Max Gekk <ma...@gmail.com>
AuthorDate: Sun Nov 29 12:18:07 2020 -0800

    [SPARK-33585][SQL][DOCS] Fix the comment for `SQLContext.tables()` and mention the `database` column
    
    ### What changes were proposed in this pull request?
    Change the comments for `SQLContext.tables()` to "The returned DataFrame has three columns, database, tableName and isTemporary".
    
    ### Why are the changes needed?
    Currently, the comment mentions only 2 columns but `tables()` returns 3 columns actually:
    ```scala
    scala> spark.range(10).createOrReplaceTempView("view1")
    scala> val tables = spark.sqlContext.tables()
    tables: org.apache.spark.sql.DataFrame = [database: string, tableName: string ... 1 more field]
    
    scala> tables.printSchema
    root
     |-- database: string (nullable = false)
     |-- tableName: string (nullable = false)
     |-- isTemporary: boolean (nullable = false)
    
    scala> tables.show
    +--------+---------+-----------+
    |database|tableName|isTemporary|
    +--------+---------+-----------+
    | default|       t1|      false|
    | default|       t2|      false|
    | default|      ymd|      false|
    |        |    view1|       true|
    +--------+---------+-----------+
    ```
    
    ### Does this PR introduce _any_ user-facing change?
    No
    
    ### How was this patch tested?
    By running `./dev/scalastyle`
    
    Closes #30526 from MaxGekk/sqlcontext-tables-doc.
    
    Authored-by: Max Gekk <ma...@gmail.com>
    Signed-off-by: Dongjoon Hyun <do...@apache.org>
    (cherry picked from commit a088a801ed8c17171545c196a3f26ce415de0cd1)
    Signed-off-by: Dongjoon Hyun <do...@apache.org>
---
 sql/core/src/main/scala/org/apache/spark/sql/SQLContext.scala | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/sql/core/src/main/scala/org/apache/spark/sql/SQLContext.scala b/sql/core/src/main/scala/org/apache/spark/sql/SQLContext.scala
index 7cf0b6b..dd23796 100644
--- a/sql/core/src/main/scala/org/apache/spark/sql/SQLContext.scala
+++ b/sql/core/src/main/scala/org/apache/spark/sql/SQLContext.scala
@@ -661,7 +661,7 @@ class SQLContext private[sql](val sparkSession: SparkSession)
 
   /**
    * Returns a `DataFrame` containing names of existing tables in the current database.
-   * The returned DataFrame has two columns, tableName and isTemporary (a Boolean
+   * The returned DataFrame has three columns, database, tableName and isTemporary (a Boolean
    * indicating if a table is a temporary one or not).
    *
    * @group ddl_ops
@@ -673,7 +673,7 @@ class SQLContext private[sql](val sparkSession: SparkSession)
 
   /**
    * Returns a `DataFrame` containing names of existing tables in the given database.
-   * The returned DataFrame has two columns, tableName and isTemporary (a Boolean
+   * The returned DataFrame has three columns, database, tableName and isTemporary (a Boolean
    * indicating if a table is a temporary one or not).
    *
    * @group ddl_ops


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@spark.apache.org
For additional commands, e-mail: commits-help@spark.apache.org