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

feat: refactor to make sure c row is released for UnsafeRowOpt #1943

Merged
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 @@ -156,7 +156,6 @@ object RowProjectPlan {
}

// TODO: Add index column if needed
outputHybridseRow.delete()
outputInternalRow
})

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,6 @@ object WindowAggPlan {
// Combine row and internal row in the tuple for repartition
val rowRdd = repartitionDf.rdd
val internalRowRdd = repartitionDf.queryExecution.toRdd
val zippedRdd = rowRdd.zip(internalRowRdd)

val inputSchema = repartitionDf.schema

Expand Down Expand Up @@ -138,6 +137,7 @@ object WindowAggPlan {
}

val outputInternalRowRdd = if (isWindowWithUnion) {
val zippedRdd = rowRdd.zip(internalRowRdd)
zippedRdd.mapPartitionsWithIndex {
case (partitionIndex, iter) =>
val computer = WindowAggPlanUtil.createComputer(partitionIndex, hadoopConf, sparkFeConfig, windowAggConfig)
Expand All @@ -146,6 +146,7 @@ object WindowAggPlan {
}
} else {
if (isWindowSkewOptimization) {
val zippedRdd = rowRdd.zip(internalRowRdd)
zippedRdd.mapPartitionsWithIndex {
case (partitionIndex, iter) =>
val computer = WindowAggPlanUtil.createComputer(partitionIndex, hadoopConf, sparkFeConfig,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,9 @@ object UnsafeRowUtil {
// Copy and remove header for output row
CoreAPI.CopyRowToUnsafeRowBytes(hybridseRow, unsafeRowWriter.getBuffer, hybridseRowWithoutHeaderSize)

// Release memory of C row
hybridseRow.delete()

// Convert to InternalRow
val unsafeRow = unsafeRowWriter.getRow
unsafeRow.asInstanceOf[InternalRow]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,8 +176,6 @@ class WindowComputer(config: WindowAggConfig, jit: HybridSeJitWrapper, keepIndex
}

// TODO: Add index column if needed
outputHybridseRow.delete()

outputInternalRowWithAppend
}

Expand Down