-
Notifications
You must be signed in to change notification settings - Fork 28.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[SPARK-39800][SQL][WIP] DataSourceV2: View Support #44197
Conversation
Had to create a new pull request since #39796 was closed |
Current status:
Follow up in future pull requests:
|
@@ -0,0 +1,104 @@ | |||
/* |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: the file is named VIewSubstitution
. Should be ViewSubstitution
if (catalog.viewExists(ident)) { | ||
catalog.dropView(ident) | ||
} | ||
catalog.createView( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this should be using the new createOrReplace()
API that was introduced by #43677:
catalog.createOrReplaceView(
ident,
sql,
currentCatalog,
currentNamespace,
viewSchema,
queryColumnNames,
columnAliases,
columnComments,
newProperties.asJava)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually
catalog.replaceView(viewInfo, true)
ident: Identifier, | ||
ifExists: Boolean) extends LeafV2CommandExec { | ||
|
||
override protected def run(): Seq[InternalRow] = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this can be simplified to
override def run(): Seq[InternalRow] = {
if (catalog.viewExists(ident)) {
catalog.dropView(ident)
} else if (!ifExists) {
throw QueryCompilationErrors.noSuchViewError(ident)
}
Seq.empty
}
catalogManager.currentCatalog.name, | ||
catalogManager.currentNamespace, | ||
c.comment, | ||
c.schema, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
c.schema, | |
c.viewSchema, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
otherwise this will be passing the wrong schema here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for catching this!
Looking to leverage the newly added |
Almost done converting to v2 command framework. Seeing great reduction in changes. |
Failed unit tests
|
Only 2 unit tests failed but they succeeded on my laptop
Maybe they are flaky? |
Done:
TODO:
Future pull requests:
|
We're closing this PR because it hasn't been updated in a while. This isn't a judgement on the merit of the PR in any way. It's just a way of keeping the PR queue manageable. |
What changes were proposed in this pull request?
This PR adds support to load, create, alter, and drop views in DataSource V2 catalogs.
Why are the changes needed?
Support views stored in DataSourceV2 catalogs. Details in SPIP.
Does this PR introduce any user-facing change?
How was this patch tested?