Github user chenghao-intel commented on a diff in the pull request:

    https://github.com/apache/spark/pull/2570#discussion_r19386522
  
    --- Diff: 
sql/hive/src/main/scala/org/apache/spark/sql/hive/execution/CreateTableAsSelect.scala
 ---
    @@ -30,33 +32,46 @@ import org.apache.spark.sql.hive.MetastoreRelation
      * Create table and insert the query result into it.
      * @param database the database name of the new relation
      * @param tableName the table name of the new relation
    - * @param insertIntoRelation function of creating the `InsertIntoHiveTable`
    - *        by specifying the `MetaStoreRelation`, the data will be inserted 
into that table.
    - * TODO Add more table creating properties,  e.g. SerDe, StorageHandler, 
in-memory cache etc.
    + * @param query the query whose result will be insert into the new relation
    + * @param allowExisting allow continue working if it's already exists, 
otherwise
    + *                      raise exception
    + * @param extra the extra information for this Operator, it should be the
    + *              ASTNode object for extracting the CreateTableDesc.
    +
      */
     @Experimental
     case class CreateTableAsSelect(
         database: String,
         tableName: String,
    -    query: SparkPlan,
    -    insertIntoRelation: MetastoreRelation => InsertIntoHiveTable)
    -  extends LeafNode with Command {
    +    query: LogicalPlan,
    +    allowExisting: Boolean,
    +    extra: ASTNode) extends LeafNode with Command {
    --- End diff --
    
    Yes, that's a good question.
    Actually I was considering to resolving that in `HiveQl`, or `Analyzer` (in 
package hive), but it requires the "hiveconf" as input, which probably need 
some of the code refactor in the existed code. So I marked this operator as 
`Experimental`, and keep it for future updating.
    
    ```
    val sa = new SemanticAnalyzer(sc.hiveconf)
    sa.analyze(extra, new Context(sc.hiveconf))
    ```



---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to