ANY_VALUE memory regression in Comet 1.2.0
Maintainer thường phản hồi trong vòng 2 ngày
Đánh giá
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức phù hợp với người mới
- 68/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Lĩnh vực
- backend, performance
Hướng nghiên cứu
Start with the aggregate dependency configuration and native tests for TrivialFirstValueAccumulator::merge_batch; the issue identifies the DataFusion 55.2.0 behavior and upstream fix #26743. Check which released DataFusion version contains that fix and how Comet pins it, then run the focused native regression tests. Done means the dependency includes the fix and the tests pass; validate the rebuilt JAR with the supplied Spark reproducer if possible.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Comet 1.2.0 fails ANY_VALUE(array<string>) with an oversized memory reservation.
Spark lowers this to first, which uses DataFusion 55.2.0's
TrivialFirstValueAccumulator::merge_batch. That method retains the input's
backing buffers and counts them repeatedly across groups.
This is fixed by apache/datafusion#26743.
Could we update to a dependency containing it when released?
Reproducer
With Spark 4.1.3, Java 21, and the Comet JAR installed in $SPARK_HOME/jars,
save this as inline_repro.py:
from pyspark.sql import SparkSession
spark = (
SparkSession.builder.config("spark.ui.enabled", "false")
.config("spark.sql.adaptive.enabled", "false")
.config("spark.sql.shuffle.partitions", "2")
.config("spark.plugins", "org.apache.spark.CometPlugin")
.config(
"spark.shuffle.manager",
"org.apache.spark.sql.comet.execution.shuffle.CometShuffleManager",
)
.config("spark.comet.enabled", "true")
.config("spark.comet.exec.enabled", "true")
.config("spark.comet.shuffle.enabled", "true")
.config("spark.comet.nativeLoadRequired", "true")
.config("spark.comet.exec.aggregate.enabled", "true")
.config("spark.memory.offHeap.enabled", "true")
.config("spark.memory.offHeap.size", "128m")
.getOrCreate()
)
try:
path = "/tmp/comet-any-value-input"
spark.range(256, numPartitions=4).selectExpr(
"CAST(id AS STRING) AS user_id",
"transform(sequence(0, 199), x -> concat(lpad(CAST(id AS STRING), 8, '0'), ':', lpad(CAST(x AS STRING), 4, '0'))) AS values",
).write.mode("overwrite").parquet(path)
spark.read.parquet(path).createOrReplaceTempView("input")
result = spark.sql(
"SELECT user_id, ANY_VALUE(values) AS values FROM input GROUP BY user_id"
)
result.explain()
rows = result.collect()
expected = {str(i): [f"{i:08d}:{j:04d}" for j in range(200)] for i in range(256)}
assert len(rows) == 256
assert {row.user_id: row["values"] for row in rows} == expected
finally:
spark.stop()
"$SPARK_HOME/bin/spark-submit" --master 'local[1]' --driver-memory 1g \
inline_repro.py
The script sets a 128 MiB native pool and two shuffle partitions. It fails in
OrderedFinalAggregateStream, requesting 80,775,440 bytes against a
67,108,864-byte share. The strings contain just 650 KiB of data.
The same script succeeds with Comet 1.1.0, or with
spark.comet.exec.aggregate.enabled set to false on 1.2.0. It checks every
output array.
Fix verification
Focused native tests use DataFusion 55.2.0 and Arrow 59.3.0. For the same
selected array, update_batch reports 3,832 bytes while merge_batch reports
1,311,296 bytes. Adding the upstream fix makes both report 3,832 bytes:
self.first = ScalarValue::try_from_array(first, 0)?;
+self.first.compact();
self.is_set = true;
Both native regression tests fail before this change and pass afterward,
with unchanged output values. A rebuilt Comet JAR has not yet been tested.
- Ngôn ngữ chính
- Scala
- Star
- 1.3k
- Fork
- 414
- Merge trung bình
- 3 ngày 5 giờ
- Pull request đã merge (30 ngày)
- 210
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của apache/datafusion-comet
-
requires-triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
apache/datafusion-comet#7583 ·
Maintainer thường phản hồi trong vòng 2 ngày
-
bug priority:medium
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 73/100
apache/datafusion-comet#7559 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 2 ngày
-
area:writer bug priority:low
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
apache/datafusion-comet#7558 ·
Maintainer thường phản hồi trong vòng 2 ngày
-
enhancement
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
apache/datafusion-comet#7557 ·
Maintainer thường phản hồi trong vòng 2 ngày
-
`rand` and `randn` with an integer seed fall back to Spark without a fallback reasonCó thể đã có người làm @galaxytemple đã nhận 3 ngày trước. Đang mởrequires-triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
apache/datafusion-comet#7479 · 1 bình luận · 1 người được giao ·
Maintainer thường phản hồi trong vòng 2 ngày
Tất cả issue của apache/datafusion-comet
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
chipsalliance/rocket-chip#3845 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 86/100
Maintainer thường phản hồi trong vòng 13 ngày
-
gesticulate: the `FastInfoset` suffix is written `fast-infoset`, not the registered `fastinfoset`Đang mởbug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
propensive/soundness#2437 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
ergoplatform/ergo#2918 ·
Maintainer thường phản hồi trong vòng 3 ngày