kazuyukitanimura commented on code in PR #1561:
URL: https://github.com/apache/datafusion-comet/pull/1561#discussion_r2008040433
##########
spark/src/main/scala/org/apache/comet/CometExecIterator.scala:
##########
@@ -63,9 +64,28 @@ class CometExecIterator(
}.toArray
private val plan = {
val conf = SparkEnv.get.conf
- // Only enable unified memory manager when off-heap mode is enabled.
Otherwise,
- // we'll use the built-in memory pool from DF, and initializes with
`memory_limit`
- // and `memory_fraction` below.
+
+ val offHeapMode = CometSparkSessionExtensions.isOffHeapEnabled(conf)
+ val memoryLimit = if (offHeapMode) {
+ // in unified mode we share off-heap memory with Spark
+ ByteUnit.MiB.toBytes(conf.getSizeAsMb("spark.memory.offHeap.size"))
+ } else {
+ // we'll use the built-in memory pool from DF, and initializes with
`memory_limit`
+ // and `memory_fraction` below.
+ CometSparkSessionExtensions.getCometMemoryOverhead(conf)
+ }
+
+ val configuredPoolType = COMET_EXEC_MEMORY_POOL_TYPE.get()
+ val memoryPoolType =
+ if (offHeapMode && configuredPoolType ==
COMET_EXEC_MEMORY_POOL_TYPE.defaultValue.get) {
+ // this is hacky but the default value for COMET_EXEC_MEMORY_POOL_TYPE
is
+ // for an on-heap memory pool so we override it here to the default for
+ // off-heap
+ COMET_MEMORY_POOL_OFF_HEAP_DEFAULT
+ } else {
+ configuredPoolType
+ }
Review Comment:
What about changing `COMET_EXEC_MEMORY_POOL_TYPE.defaultValue` to something
generic like `default` in order to make it less hacky?
Then later when we match the pool type, we can match both
`greedy_task_shared` and `default` cases...
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]