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

    https://github.com/apache/spark/pull/15346#discussion_r81887963
  
    --- Diff: 
sql/core/src/test/scala/org/apache/spark/sql/execution/SparkSqlParserSuite.scala
 ---
    @@ -67,9 +86,331 @@ class SparkSqlParserSuite extends PlanTest {
           DescribeFunctionCommand(FunctionIdentifier("bar", database = None), 
isExtended = true))
         assertEqual("describe function foo.bar",
           DescribeFunctionCommand(
    -        FunctionIdentifier("bar", database = Option("foo")), isExtended = 
false))
    +        FunctionIdentifier("bar", database = Some("foo")), isExtended = 
false))
         assertEqual("describe function extended f.bar",
    -      DescribeFunctionCommand(FunctionIdentifier("bar", database = 
Option("f")), isExtended = true))
    +      DescribeFunctionCommand(FunctionIdentifier("bar", database = 
Some("f")), isExtended = true))
    +  }
    +
    +  private def createTableUsing(
    +      table: String,
    +      database: Option[String] = None,
    +      tableType: CatalogTableType = CatalogTableType.MANAGED,
    +      storage: CatalogStorageFormat = CatalogStorageFormat.empty,
    +      schema: StructType = new StructType,
    +      provider: Option[String] = Some("parquet"),
    +      partitionColumnNames: Seq[String] = Seq.empty,
    +      bucketSpec: Option[BucketSpec] = None,
    +      mode: SaveMode = SaveMode.ErrorIfExists,
    +      query: Option[LogicalPlan] = None): CreateTable = {
    +    CreateTable(
    +      CatalogTable(
    +        identifier = TableIdentifier(table, database),
    +        tableType = tableType,
    +        storage = storage,
    +        schema = schema,
    +        provider = provider,
    +        partitionColumnNames = partitionColumnNames,
    +        bucketSpec = bucketSpec
    +      ), mode, query
    +    )
    +  }
    +
    +  private def createTempViewUsing(
    +      table: String,
    +      database: Option[String] = None,
    +      schema: Option[StructType] = None,
    +      replace: Boolean = true,
    +      provider: String = "parquet",
    +      options: Map[String, String] = Map.empty): LogicalPlan = {
    +    CreateTempViewUsing(TableIdentifier(table, database), schema, replace, 
provider, options)
    +  }
    +
    +  private def createTable(
    +      table: String,
    +      database: Option[String] = None,
    +      tableType: CatalogTableType = CatalogTableType.MANAGED,
    +      storage: CatalogStorageFormat = CatalogStorageFormat.empty.copy(
    +        inputFormat = HiveSerDe.sourceToSerDe("textfile").get.inputFormat,
    +        outputFormat = 
HiveSerDe.sourceToSerDe("textfile").get.outputFormat),
    +      schema: StructType = new StructType,
    +      provider: Option[String] = Some("hive"),
    +      partitionColumnNames: Seq[String] = Seq.empty,
    +      comment: Option[String] = None,
    +      mode: SaveMode = SaveMode.ErrorIfExists,
    +      query: Option[LogicalPlan] = None): CreateTable = {
    +    CreateTable(
    +      CatalogTable(
    +        identifier = TableIdentifier(table, database),
    +        tableType = tableType,
    +        storage = storage,
    +        schema = schema,
    +        provider = provider,
    +        partitionColumnNames = partitionColumnNames,
    +        comment = comment
    +      ), mode, query
    +    )
    +  }
    +
    +  test("create table using - createTableHeader") {
    --- End diff --
    
    Most of these unit tests are not related to this change, lets move these 
into a separate PR. Just put a couple of cases (at least one positive and one 
negative case) in here testing your change.


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

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to