Github user mateiz commented on a diff in the pull request:

    https://github.com/apache/spark/pull/354#discussion_r11555907
  
    --- Diff: sql/core/src/main/scala/org/apache/spark/sql/SchemaRDDLike.scala 
---
    @@ -62,4 +65,43 @@ trait SchemaRDDLike {
       def registerAsTable(tableName: String): Unit = {
         sqlContext.registerRDDAsTable(baseSchemaRDD, tableName)
       }
    +
    +  /**
    +   * :: Experimental ::
    +   *
    +   * Adds the rows from this RDD to the specified table, optionally 
overwriting the existing data.
    +   *
    +   * @group schema
    +   */
    +  @Experimental
    +  def insertInto(tableName: String, overwrite: Boolean): Unit =
    +    sqlContext.executePlan(
    +      InsertIntoTable(UnresolvedRelation(None, tableName), Map.empty, 
logicalPlan, overwrite)).toRdd
    +
    +  /**
    +   * :: Experimental ::
    +   *
    +   * Appends the rows from this RDD to the specified table.
    +   *
    +   * @group schema
    +   */
    +  @Experimental
    +  def insertInto(tableName: String): Unit = insertInto(tableName, false)
    +
    +  /**
    +   * :: Experimental ::
    +   *
    +   * Creates a table from the the contents of this SchemaRDD.  This will 
fail if the table already
    +   * exists.
    +   *
    +   * Note that this currently only works with SchemaRDDs that are created 
from a HiveContext as
    +   * there is no notion of a persisted catalog in a standard SQL context.  
Instead you can write
    +   * an RDD out to a parquet file, and then register that file as a table. 
 This "table" can then
    +   * be the target of an `insertInto`.
    +   *
    +   * @param tableName
    +   */
    +  @Experimental
    +  def createTableAs(tableName: String): Unit =
    --- End diff --
    
    Maybe this should be called saveAsTable, to be similar to the Parquet 
files. Actually in saveAsParquetFile you could also add an optional parameter 
to register the file as a table, and then you'd have no need for 
createParquetFile.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to