You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@iceberg.apache.org by "kamijin-fanta (via GitHub)" <gi...@apache.org> on 2023/08/09 09:21:41 UTC
[GitHub] [iceberg] kamijin-fanta opened a new issue, #8269: DataTableScan may not include Unpartitioned data in the results
kamijin-fanta opened a new issue, #8269:
URL: https://github.com/apache/iceberg/issues/8269
### Apache Iceberg version
1.3.1 (latest release)
### Query engine
None
### Please describe the bug 🐞
## Overview
- Data written by UnpartitionedWriter may not be included in the table scan results.
- Files are not included in the PlanFiles results when a partitioned field is specified as a filter condition.
- This problem was discovered when querying with Trino. https://github.com/trinodb/trino/issues/18580
## Steps to Reproduce
Code: https://github.com/kamijin-fanta/iceberg-sandbox/blob/master/src/main/kotlin/Main.kt
### 1. define table and write data
I used the Java client UnpartitionedWriter to write rows to the table.
```kotlin
val schema = Schema(
Types.NestedField.of(1, false, "ts1", TimestampType.withZone()),
Types.NestedField.of(2, false, "ts2", TimestampType.withZone()),
Types.NestedField.of(3, false, "text", StringType()),
)
val partitionSpec = PartitionSpec.builderFor(schema).year("ts1").build()
// some codes
val writer = UnpartitionedWriter(
table.spec(),
FileFormat.PARQUET,
appenderFactory,
fileFactory,
table.io(),
Long.MAX_VALUE
)
```
### 2. scan a table with DataTableScan
Perform a scan on the table. A non-partitioned ts2 query will terminate successfully.
```kotlin
val filterTs2Files = table.newScan()
.useSnapshot(table.currentSnapshot().snapshotId())
.filter(Expressions.greaterThan("ts2", 1690848000000000L)) // ts1 > 2023-08-01 00:00:00.000 UTC
.planFiles()
.toList()
println("found files filtered by ts2: %d".format(filterTs2Files.size))
filterTs2Files.forEach{ println(it) }
/*
Outputs:
found files filtered by ts2: 1
BaseFileScanTask{file=s3://warehouse/default/test1/data/00000-0-d1f1bc76-155f-4637-b041-615fcd61fcb7-00001.parquet, partition_data=PartitionData{ts1_year=null}, residual=ref(name="ts2") > 1690848000000000}
*/
````
However, if specify a condition for a field in ts1 that is partitioned, the returned empty list.
```kotlin
val filterTs1Files = table.newScan()
.useSnapshot(table.currentSnapshot().snapshotId())
.filter(Expressions.greaterThan("ts1", 1690848000000000L)) // ts1 > 2023-08-01 00:00:00.000 UTC
.planFiles()
.toList()
println("found files filtered by ts1: %d".format(filterTs1Files.size))
filterTs1Files.forEach{ println(it) }
/*
Outputs:
found files filtered by ts1: 0
*/
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org
[GitHub] [iceberg] RussellSpitzer commented on issue #8269: DataTableScan may not include Unpartitioned data in the results
Posted by "RussellSpitzer (via GitHub)" <gi...@apache.org>.
RussellSpitzer commented on issue #8269:
URL: https://github.com/apache/iceberg/issues/8269#issuecomment-1671318932
Why would an unpartitioned writer write to a partitioned table?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org
[GitHub] [iceberg] RussellSpitzer commented on issue #8269: DataTableScan may not include Unpartitioned data in the results
Posted by "RussellSpitzer (via GitHub)" <gi...@apache.org>.
RussellSpitzer commented on issue #8269:
URL: https://github.com/apache/iceberg/issues/8269#issuecomment-1671376847
https://github.com/apache/iceberg/blob/fa1bf12ec94d71bd9e16241b8466c70a628e22a1/flink/v1.17/flink/src/main/java/org/apache/iceberg/flink/sink/RowDataTaskWriterFactory.java#L122-L125
That's fine you just need to use an unpartitioned spec when writing with the unpartitioned writer
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org
[GitHub] [iceberg] kamijin-fanta commented on issue #8269: DataTableScan may not include Unpartitioned data in the results
Posted by "kamijin-fanta (via GitHub)" <gi...@apache.org>.
kamijin-fanta commented on issue #8269:
URL: https://github.com/apache/iceberg/issues/8269#issuecomment-1671373054
@RussellSpitzer I am trying to reduce the number of open files and lower memory usage and latency on writes. The impact on query performance is negligible with periodic optimization. Is it supported to use UnpartitionedWriter for partitioned tables?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org
[GitHub] [iceberg] kamijin-fanta commented on issue #8269: DataTableScan may not include Unpartitioned data in the results
Posted by "kamijin-fanta (via GitHub)" <gi...@apache.org>.
kamijin-fanta commented on issue #8269:
URL: https://github.com/apache/iceberg/issues/8269#issuecomment-1671405177
Isn't this a bug? If it is normal spec behavior, this Issue will be closed.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org
[GitHub] [iceberg] RussellSpitzer commented on issue #8269: DataTableScan may not include Unpartitioned data in the results
Posted by "RussellSpitzer (via GitHub)" <gi...@apache.org>.
RussellSpitzer commented on issue #8269:
URL: https://github.com/apache/iceberg/issues/8269#issuecomment-1671414514
Added more details, I would say the bug could be that we should throw an error if you use unpartitioned writer with a partitioned spec. I believe previously this was allowed because V1 Iceberg tables don't ever remove spec fields, they just get changed to void transforms and for a while our code had some very specific wonky logic around that sometimes. You basically could have unpartitioned spec <Void> and unpartitioned spec <void, Void> and so on. I think this may be an artifact of that. Now we have a safe "isUnpartitioned" function so we could just put that as a perquisite in the Unpartitioned writer.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org
Re: [I] DataTableScan may not include Unpartitioned data in the results [iceberg]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on issue #8269:
URL: https://github.com/apache/iceberg/issues/8269#issuecomment-2347444034
This issue has been automatically marked as stale because it has been open for 180 days with no activity. It will be closed in next 14 days if no further activity occurs. To permanently prevent this issue from being considered stale, add the label 'not-stale', but commenting on the issue is preferred when possible.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org
[GitHub] [iceberg] kamijin-fanta commented on issue #8269: DataTableScan may not include Unpartitioned data in the results
Posted by "kamijin-fanta (via GitHub)" <gi...@apache.org>.
kamijin-fanta commented on issue #8269:
URL: https://github.com/apache/iceberg/issues/8269#issuecomment-1672372558
Thank you. I understand the specification. Yes, it would be intuitive if an error occurs when using UnpartitionedWriter on a partitioned table.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org