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

    https://github.com/apache/spark/pull/11987#discussion_r57642753
  
    --- Diff: 
sql/core/src/test/scala/org/apache/spark/sql/execution/command/DDLCommandSuite.scala
 ---
    @@ -389,21 +415,61 @@ class DDLCommandSuite extends PlanTest {
         comparePlans(parsed2, expected2)
       }
     
    +  // ALTER TABLE view_name ADD [IF NOT EXISTS] PARTITION spec1[, PARTITION 
spec2, ...]
       test("alter table: add partition") {
    -    val sql =
    +    val sql1 =
           """
            |ALTER TABLE table_name ADD IF NOT EXISTS PARTITION
            |(dt='2008-08-08', country='us') LOCATION 'location1' PARTITION
            |(dt='2009-09-09', country='uk')
           """.stripMargin
    -    val parsed = parser.parsePlan(sql)
    -    val expected = AlterTableAddPartition(
    +    val sql2 = "ALTER TABLE table_name ADD PARTITION (dt='2008-08-08') 
LOCATION 'loc'"
    +
    +    val parsed1 = parser.parsePlan(sql1)
    +    val parsed2 = parser.parsePlan(sql2)
    +
    +    val expected1 = AlterTableAlterViewAddPartition(
           TableIdentifier("table_name", None),
           Seq(
             (Map("dt" -> "2008-08-08", "country" -> "us"), Some("location1")),
             (Map("dt" -> "2009-09-09", "country" -> "uk"), None)),
    -      ifNotExists = true)(sql)
    -    comparePlans(parsed, expected)
    +      ifNotExists = true)(sql1)
    +    val expected2 = AlterTableAlterViewAddPartition(
    +      TableIdentifier("table_name", None),
    +      Seq((Map("dt" -> "2008-08-08"), Some("loc"))),
    +      ifNotExists = false)(sql2)
    +
    +    comparePlans(parsed1, expected1)
    +    comparePlans(parsed2, expected2)
    +  }
    +
    +  // ALTER VIEW view_name ADD [IF NOT EXISTS] PARTITION spec1[, PARTITION 
spec2, ...]
    +  // Location clause is not allowed.
    +  test("alter view: add partition") {
    +    val sql1 =
    +      """
    +        |ALTER VIEW view_name ADD IF NOT EXISTS PARTITION
    +        |(dt='2008-08-08', country='us') PARTITION
    --- End diff --
    
    HiveQl allows us to use any constant on the right hand side of a partition 
value. Could you add a test for any other than a string?


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