-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
[1321] Make update command return the number of updated rows. #1331
Conversation
Signed-off-by: Carlos Peña <cdpm42@gmail.com>
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.
Requested 1 minor change. Otherwise LGTM. Thanks!
@@ -22,18 +22,18 @@ import org.apache.spark.sql.delta.actions.{AddCDCFile, AddFile, FileAction} | |||
import org.apache.spark.sql.delta.commands.cdc.CDCReader.{CDC_TYPE_COLUMN_NAME, CDC_TYPE_NOT_CDC, CDC_TYPE_UPDATE_POSTIMAGE, CDC_TYPE_UPDATE_PREIMAGE} | |||
import org.apache.spark.sql.delta.files.{TahoeBatchFileIndex, TahoeFileIndex} | |||
import org.apache.hadoop.fs.Path | |||
|
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: we have blank lines separating our import groups, so the above group is other
and the below group is org.apache.spark
. So add back the blank line please.
@@ -51,6 +51,10 @@ case class UpdateCommand( | |||
condition: Option[Expression]) | |||
extends LeafRunnableCommand with DeltaCommand { | |||
|
|||
override val output: Seq[Attribute] = { | |||
Seq(AttributeReference("num_updated_rows", LongType)()) |
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 should've clarified this in the issue, my bad.
Can you make this num_affected_rows
please? To be consistent with the DELETE command output.
Signed-off-by: Carlos Peña <cdpm42@gmail.com>
Thanks @scottsand-db! |
## Description This PR makes the `UPDATE` command return the number of updated rows. The update command returns the following output: ![image](https://user-images.githubusercontent.com/6467558/184264601-89506bf7-d816-4992-996a-2ade4c9e38a8.png) Modified existing tests. Closes delta-io#1331 Signed-off-by: Scott Sandre <scott.sandre@databricks.com> GitOrigin-RevId: a00cdd1a8a4e10dae5afece4ec5414d9bc9fde89 GitOrigin-RevId: 160dce9de1a1e34a29d47c6e21c9117f151b9a30 GitOrigin-RevId: 71f954cfcaf4d3a14e0a0693525a577bd0898d3f (cherry picked from commit b71ad65)
Description
Resolves #1321.
How was this patch tested?
Modified existing tests.
Does this PR introduce any user-facing changes?
Yes. The update command returns the following output: