Skip to content
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

Only one partition and compaction to parquet scan #109

Merged
merged 3 commits into from
Dec 19, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,8 @@ object MetaVersion {
range_value = range_value,
version = info.getVersion,
read_files = info.getSnapshot.asScala.toArray,
expression = info.getExpression
expression = info.getExpression,
commit_op = info.getCommitOp
)
}

Expand All @@ -155,7 +156,8 @@ object MetaVersion {
range_value = range_value,
version = info.getVersion,
read_files = info.getSnapshot.asScala.toArray,
expression = info.getExpression
expression = info.getExpression,
commit_op = info.getCommitOp
)
partitionVersionBuffer.toArray

Expand All @@ -170,6 +172,8 @@ object MetaVersion {
table_id = res.getTableId,
range_value = res.getPartitionDesc,
version = res.getVersion,
expression = res.getExpression,
commit_op = res.getCommitOp
)
}
partitionVersionBuffer.toArray
Expand Down Expand Up @@ -201,7 +205,8 @@ object MetaVersion {
range_value = res.getPartitionDesc,
version = res.getVersion,
read_files = res.getSnapshot.asScala.toArray,
expression = res.getExpression
expression = res.getExpression,
commit_op = res.getCommitOp
)
}
partitionVersionBuffer.toArray
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,12 @@ case class LakeSoulScanBuilder(sparkSession: SparkSession,
parquetScan(partitionFilters, dataFilters)
}
else if (onlyOnePartition) {
OnePartitionMergeBucketScan(sparkSession, hadoopConf, fileIndex, dataSchema, mergeReadDataSchema(),
readPartitionSchema(), pushedParquetFilters, options, tableInfo, partitionFilters, dataFilters)
if (fileIndex.snapshotManagement.snapshot.getPartitionInfoArray.forall(p => p.commit_op.equals("CompactionCommit"))) {
parquetScan(partitionFilters, dataFilters)
} else {
OnePartitionMergeBucketScan(sparkSession, hadoopConf, fileIndex, dataSchema, mergeReadDataSchema(),
readPartitionSchema(), pushedParquetFilters, options, tableInfo, partitionFilters, dataFilters)
}
}
else {
if (sparkSession.sessionState.conf
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ case class PartitionInfo(table_id: String,
range_value: String,
version: Int = -1,
read_files: Array[UUID] = Array.empty[UUID],
expression:String=""
expression: String = "",
commit_op: String = ""
) {
override def toString: String = {
s"partition info: {\ntable_name: $table_id,\nrange_value: $range_value}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ class ParquetScanSuite extends QueryTest
})
}

test("It should use OnePartitionMergeBucketScan when reading one compacted partition") {
test("It should use ParquetScan when reading one compacted partition") {
withTempDir(dir => {
val tablePath = dir.getCanonicalPath
Seq((20201101, 1, 1), (20201101, 2, 2), (20201101, 3, 3))
Expand All @@ -119,7 +119,7 @@ class ParquetScanSuite extends QueryTest
val plan = table.toDF.queryExecution.toString()

logInfo(plan)
assert(plan.contains("OnePartitionMergeBucketScan"))
assert(plan.contains("ParquetScan"))

})
}
Expand Down