Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

[BUG] DELETE with DV enabled doesn't work for column mapping enabled tables #1886

Closed
3 tasks
allisonport-db opened this issue Jul 6, 2023 · 0 comments
Closed
3 tasks
Labels
bug Something isn't working

Comments

@allisonport-db
Copy link
Collaborator

Bug

Describe the problem

Steps to reproduce

val tablePath = "/tmp/test-dv-cm"
spark.conf.set("spark.databricks.delta.properties.defaults.columnMapping.mode", "name")
val data = (0 until 50).map(x => (x%10, x, s"foo${x % 5}"))
data.toDF("part", "col1", "col2").write.format("delta").partitionBy("part").save(tablePath)
spark.sql(s"alter table delta.`$tablePath` set tblproperties('delta.enableDeletionVectors' = 'true')")
spark.sql(s"DELETE FROM delta.`$tablePath` WHERE col1 = 2")

Observed results

org.apache.spark.sql.delta.DeltaAnalysisException: Can't resolve column __delta_internal_row_index in root
 |-- part: integer (nullable = true)
 |-- col1: integer (nullable = true)
 |-- col2: string (nullable = true)

  at org.apache.spark.sql.delta.DeltaErrorsBase.cannotResolveColumn(DeltaErrors.scala:1804)
  at org.apache.spark.sql.delta.DeltaErrorsBase.cannotResolveColumn$(DeltaErrors.scala:1803)
  at org.apache.spark.sql.delta.DeltaErrors$.cannotResolveColumn(DeltaErrors.scala:2794)
  at org.apache.spark.sql.delta.DeltaErrorsBase.columnNotFound(DeltaErrors.scala:172)
  at org.apache.spark.sql.delta.DeltaErrorsBase.columnNotFound$(DeltaErrors.scala:170)
  at org.apache.spark.sql.delta.DeltaErrors$.columnNotFound(DeltaErrors.scala:2794)
  at org.apache.spark.sql.delta.DeltaColumnMappingBase.$anonfun$createPhysicalSchema$3(DeltaColumnMapping.scala:464)
  at scala.Option.getOrElse(Option.scala:189)
  at org.apache.spark.sql.delta.DeltaColumnMappingBase.$anonfun$createPhysicalSchema$1(DeltaColumnMapping.scala:461)
  at org.apache.spark.sql.delta.schema.SchemaMergingUtils$.$anonfun$transformColumns$1(SchemaMergingUtils.scala:317)
...

Expected results

Row to be deleted.

Further details

Environment information

  • Delta Lake version: 2.4.0
  • Spark version: 3.4.0
  • Scala version: 2.12

Willingness to contribute

The Delta Lake Community encourages bug fix contributions. Would you or another member of your organization be willing to contribute a fix for this bug to the Delta Lake code base?

  • Yes. I can contribute a fix for this bug independently.
  • Yes. I would be willing to contribute a fix for this bug with guidance from the Delta Lake community.
  • No. I cannot contribute a bug fix at this time.
@allisonport-db allisonport-db added the bug Something isn't working label Jul 6, 2023
vkorukanti added a commit that referenced this issue Oct 13, 2023
## Description
Remove the golden table `dv-with-columnmapping` from the `kernel` module and add it the `golden-tables` module (generated using `GoldenTables.scala`. This was done originally because of #1886 which was fixed in the current master.

## How was this patch tested?
Ran the `DeletionVectorSuite` and it passes.
vkorukanti added a commit to allisonport-db/delta that referenced this issue Oct 13, 2023
(Cherry-pick of c793297 to branch-3.0)

Remove the golden table `dv-with-columnmapping` from the `kernel` module and add it the `golden-tables` module (generated using `GoldenTables.scala`. This was done originally because of delta-io#1886 which was fixed in the current master.

Ran the `DeletionVectorSuite` and it passes.
xupefei pushed a commit to xupefei/delta that referenced this issue Oct 31, 2023
## Description
Remove the golden table `dv-with-columnmapping` from the `kernel` module and add it the `golden-tables` module (generated using `GoldenTables.scala`. This was done originally because of delta-io#1886 which was fixed in the current master.

## How was this patch tested?
Ran the `DeletionVectorSuite` and it passes.
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant