-
Notifications
You must be signed in to change notification settings - Fork 29.2k
[SPARK-56680][SQL] DSv2 INSERT and Insert-Only MERGE Metrics #55586
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
base: master
Are you sure you want to change the base?
Changes from all commits
a277d23
525d743
035b822
89f4fd8
aa2bc73
a6def90
4d67ab5
a83ab6a
1f3d225
be534d2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| /* | ||
| * Licensed to the Apache Software Foundation (ASF) under one or more | ||
| * contributor license agreements. See the NOTICE file distributed with | ||
| * this work for additional information regarding copyright ownership. | ||
| * The ASF licenses this file to You under the Apache License, Version 2.0 | ||
| * (the "License"); you may not use this file except in compliance with | ||
| * the License. You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| */ | ||
|
|
||
| package org.apache.spark.sql.connector.write; | ||
|
|
||
| import org.apache.spark.annotation.Evolving; | ||
|
|
||
| /** | ||
| * Provides an informational summary of the INSERT operation producing write. | ||
| * | ||
| * @since 4.2.0 | ||
| */ | ||
| @Evolving | ||
| public interface InsertSummary extends WriteSummary { | ||
|
|
||
| /** | ||
| * Returns the number of output rows, or -1 if not found. | ||
| */ | ||
| long numOutputRows(); | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -157,7 +157,11 @@ case class AppendData( | |
| isByName: Boolean, | ||
| withSchemaEvolution: Boolean, | ||
| write: Option[Write] = None, | ||
| analyzedQuery: Option[LogicalPlan] = None) extends V2WriteCommand with TransactionalWrite { | ||
| analyzedQuery: Option[LogicalPlan] = None, | ||
| rowLevelCommand: Option[RowLevelOperation.Command] = None) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. How do you feel about adding a new node like I vibecoded it locally and it is fairly easy.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't feel strongly here. More like 60/40 to have a new node, to be honest. |
||
| extends V2WriteCommand | ||
| with TransactionalWrite { | ||
|
|
||
| override val writePrivileges: Set[TableWritePrivilege] = Set(TableWritePrivilege.INSERT) | ||
| override def withNewQuery(newQuery: LogicalPlan): AppendData = copy(query = newQuery) | ||
| override def withNewTable(newTable: NamedRelation): AppendData = copy(table = newTable) | ||
|
|
@@ -184,13 +188,15 @@ object AppendData { | |
| table: NamedRelation, | ||
| query: LogicalPlan, | ||
| writeOptions: Map[String, String] = Map.empty, | ||
| withSchemaEvolution: Boolean = false): AppendData = { | ||
| withSchemaEvolution: Boolean = false, | ||
| rowLevelCommand: Option[RowLevelOperation.Command] = None): AppendData = { | ||
| new AppendData( | ||
| table, | ||
| query, | ||
| writeOptions, | ||
| isByName = false, | ||
| withSchemaEvolution) | ||
| withSchemaEvolution, | ||
| rowLevelCommand = rowLevelCommand) | ||
| } | ||
| } | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| /* | ||
| * Licensed to the Apache Software Foundation (ASF) under one or more | ||
| * contributor license agreements. See the NOTICE file distributed with | ||
| * this work for additional information regarding copyright ownership. | ||
| * The ASF licenses this file to You under the Apache License, Version 2.0 | ||
| * (the "License"); you may not use this file except in compliance with | ||
| * the License. You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| */ | ||
|
|
||
| package org.apache.spark.sql.connector.write | ||
|
|
||
| /** | ||
| * Implementation of [[InsertSummary]] that provides INSERT operation summary. | ||
| */ | ||
| private[sql] case class InsertSummaryImpl(numOutputRows: Long) extends InsertSummary { | ||
| } |
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.
Would calling this
numInsertedRowsbe more consistent with the rest of summaries?