Skip to content

Conversation

@imback82
Copy link
Contributor

What changes were proposed in this pull request?

This PR adds CREATE NAMESPACE support for V2 catalogs.

Why are the changes needed?

Currently, you cannot explicitly create namespaces for v2 catalogs.

Does this PR introduce any user-facing change?

The user can now perform the following:

CREATE NAMESPACE mycatalog.ns

to create a namespace ns inside mycatalog V2 catalog.

How was this patch tested?

Added unit tests.

@imback82
Copy link
Contributor Author

cc: @cloud-fan / @rdblue

testShowNamespaces("SHOW NAMESPACES IN testcat", Seq("ns1"))
testShowNamespaces("SHOW NAMESPACES IN testcat.ns1", Seq("ns1.ns2"))

// TODO: Add tests for validating namespace metadata when DESCRIBE NAMESPACE is available.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will create a JIRA for this and follow up.

@SparkQA
Copy link

SparkQA commented Oct 18, 2019

Test build #112284 has finished for PR 26166 at commit 08728d3.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

ifNotExists: Boolean,
comment: Option[String],
locationSpec: Option[String],
properties: Map[String, String]) extends ParsedStatement
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@cloud-fan, what is the behavior of IF NOT EXISTS with DBPROPERTIES? If the namespace exists, are properties updated?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same as table/database, if table/database doesn't exist, the command is a noop.

@SparkQA
Copy link

SparkQA commented Oct 20, 2019

Test build #112341 has finished for PR 26166 at commit c1e6687.

  • This patch passes all tests.
  • This patch does not merge cleanly.
  • This patch adds no public classes.

@SparkQA
Copy link

SparkQA commented Oct 20, 2019

Test build #112344 has finished for PR 26166 at commit 0fce441.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds the following public classes (experimental):
  • abstract class ExtractIntervalPart(
  • case class ExtractIntervalMillenniums(child: Expression)
  • case class ExtractIntervalCenturies(child: Expression)
  • case class ExtractIntervalDecades(child: Expression)
  • case class ExtractIntervalYears(child: Expression)
  • case class ExtractIntervalQuarters(child: Expression)
  • case class ExtractIntervalMonths(child: Expression)
  • case class ExtractIntervalDays(child: Expression)
  • case class ExtractIntervalHours(child: Expression)
  • case class ExtractIntervalMinutes(child: Expression)
  • case class ExtractIntervalSeconds(child: Expression)
  • case class ExtractIntervalMilliseconds(child: Expression)
  • case class ExtractIntervalMicroseconds(child: Expression)
  • case class ExtractIntervalEpoch(child: Expression)
  • case class RepairTableStatement(tableName: Seq[String]) extends ParsedStatement

@SparkQA
Copy link

SparkQA commented Oct 20, 2019

Test build #112345 has finished for PR 26166 at commit 6f80ff4.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@SparkQA
Copy link

SparkQA commented Oct 21, 2019

Test build #112360 has finished for PR 26166 at commit 970338c.

  • This patch fails due to an unknown error code, -9.
  • This patch merges cleanly.
  • This patch adds no public classes.

@cloud-fan
Copy link
Contributor

retest this please

@SparkQA
Copy link

SparkQA commented Oct 21, 2019

Test build #112371 has finished for PR 26166 at commit 970338c.

  • This patch fails SparkR unit tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@cloud-fan
Copy link
Contributor

retest this please

@SparkQA
Copy link

SparkQA commented Oct 21, 2019

Test build #112388 has finished for PR 26166 at commit 970338c.

  • This patch fails SparkR unit tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@imback82
Copy link
Contributor Author

Can we retest this?

@cloud-fan
Copy link
Contributor

retest this please

@cloud-fan
Copy link
Contributor

@imback82 anyone can trigger retest by typing "retest this please"

@SparkQA
Copy link

SparkQA commented Oct 22, 2019

Test build #112456 has finished for PR 26166 at commit 970338c.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

((COMMENT comment=STRING) |
locationSpec |
(WITH DBPROPERTIES tablePropertyList))* #createDatabase
(WITH DBPROPERTIES tablePropertyList))* #createNamespace
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah I missed this. Shall we use PROPERTIES instead of DBPROPERTIES? We can write DBPROPERTIES | PROPERTIES for backward compatibility

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for catching this. updated.

* The logical plan of the CREATE NAMESPACE command that works for v2 catalogs.
*/
case class CreateNamespace(
catalog: SupportsNamespaces,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: 4 space identation

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed.

test("create namespace") {
val sql =
"""
|CREATE DATABASE IF NOT EXISTS database_name
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we use a.b.c instead of database_name?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated.

@cloud-fan
Copy link
Contributor

LGTM except several minor comments

@SparkQA
Copy link

SparkQA commented Oct 22, 2019

Test build #112465 has finished for PR 26166 at commit db5b1c9.

  • This patch fails PySpark unit tests.
  • This patch merges cleanly.
  • This patch adds the following public classes (experimental):
  • skeleton_class = type_constructor(name, bases, type_kwargs)
  • enum_class = metacls.__new__(metacls, name, bases, classdict)
  • case class BitAndAgg(child: Expression) extends DeclarativeAggregate with ExpectsInputTypes
  • case class BitOrAgg(child: Expression) extends DeclarativeAggregate with ExpectsInputTypes
  • abstract class AbstractSqlParser(conf: SQLConf) extends ParserInterface with Logging
  • class CatalystSqlParser(conf: SQLConf) extends AbstractSqlParser(conf)
  • case class TruncateTableStatement(
  • class SparkSqlParser(conf: SQLConf) extends AbstractSqlParser(conf)

@SparkQA
Copy link

SparkQA commented Oct 23, 2019

Test build #112486 has finished for PR 26166 at commit 132cd7f.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@SparkQA
Copy link

SparkQA commented Oct 23, 2019

Test build #112487 has finished for PR 26166 at commit 3fd447d.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@SparkQA
Copy link

SparkQA commented Oct 23, 2019

Test build #112494 has finished for PR 26166 at commit f7fa8ed.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds the following public classes (experimental):
  • case class ShowPartitionsStatement(tableName: Seq[String],

@cloud-fan
Copy link
Contributor

thanks, merging to master!

@cloud-fan cloud-fan closed this in c128ac5 Oct 23, 2019
@imback82 imback82 deleted the create_namespace branch October 24, 2019 14:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants