Skip to content

Commit

Permalink
[SPARK-37031][SQL][TESTS][FOLLOWUP] Add a missing test to DescribeNam…
Browse files Browse the repository at this point in the history
…espaceSuite

### What changes were proposed in this pull request?

This PR proposes to add a missing test on "keeping the legacy output schema" to `DescribeNamespaceSuite`. (#31705 didn't seem to add it).

### Why are the changes needed?

To increase the test coverage.

### Does this PR introduce _any_ user-facing change?

No

### How was this patch tested?

Added a new test.

Closes #34399 from imback82/SPARK-37031-followup.

Authored-by: Terry Kim <yuminkim@gmail.com>
Signed-off-by: Wenchen Fan <wenchen@databricks.com>
  • Loading branch information
imback82 authored and cloud-fan committed Oct 27, 2021
1 parent 4aec9d7 commit 7954a91
Showing 1 changed file with 18 additions and 0 deletions.
Expand Up @@ -19,6 +19,7 @@ package org.apache.spark.sql.execution.command.v1

import org.apache.spark.sql.Row
import org.apache.spark.sql.execution.command
import org.apache.spark.sql.internal.SQLConf

/**
* This base suite contains unified tests for the `DESCRIBE NAMESPACE` command that checks V1
Expand Down Expand Up @@ -50,6 +51,23 @@ trait DescribeNamespaceSuiteBase extends command.DescribeNamespaceSuiteBase {
assert(result(3) === Row("Properties", ""))
}
}

test("Keep the legacy output schema") {
Seq(true, false).foreach { keepLegacySchema =>
withSQLConf(SQLConf.LEGACY_KEEP_COMMAND_OUTPUT_SCHEMA.key -> keepLegacySchema.toString) {
val ns = "db1"
withNamespace(ns) {
sql(s"CREATE NAMESPACE $ns")
val schema = sql(s"DESCRIBE NAMESPACE $ns").schema.fieldNames.toSeq
if (keepLegacySchema) {
assert(schema === Seq("database_description_item", "database_description_value"))
} else {
assert(schema === Seq("info_name", "info_value"))
}
}
}
}
}
}

/**
Expand Down

0 comments on commit 7954a91

Please sign in to comment.