-
Notifications
You must be signed in to change notification settings - Fork 283
[AutoSparkUT] Fix cached table zero-column scan crash (issue #14098) #14446
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -466,19 +466,25 @@ class ParquetCachedBatchSerializer extends GpuCachedBatchSerializer { | |||||||||||||||||||||||||||||||||||||||||||
| cacheAttributes: Seq[Attribute], | ||||||||||||||||||||||||||||||||||||||||||||
| selectedAttributes: Seq[Attribute], | ||||||||||||||||||||||||||||||||||||||||||||
| conf: SQLConf): RDD[ColumnarBatch] = { | ||||||||||||||||||||||||||||||||||||||||||||
| // optimize | ||||||||||||||||||||||||||||||||||||||||||||
| val newSelectedAttributes = if (selectedAttributes.isEmpty) { | ||||||||||||||||||||||||||||||||||||||||||||
| cacheAttributes | ||||||||||||||||||||||||||||||||||||||||||||
| } else { | ||||||||||||||||||||||||||||||||||||||||||||
| selectedAttributes | ||||||||||||||||||||||||||||||||||||||||||||
| // When no columns are selected (e.g., count-only scan or | ||||||||||||||||||||||||||||||||||||||||||||
| // cross-join side that needs only row count), return | ||||||||||||||||||||||||||||||||||||||||||||
| // row-only batches without decoding parquet data. | ||||||||||||||||||||||||||||||||||||||||||||
| if (selectedAttributes.isEmpty) { | ||||||||||||||||||||||||||||||||||||||||||||
| return input.map { | ||||||||||||||||||||||||||||||||||||||||||||
| case parquetCB: ParquetCachedBatch => | ||||||||||||||||||||||||||||||||||||||||||||
| new ColumnarBatch(Array.empty, parquetCB.numRows) | ||||||||||||||||||||||||||||||||||||||||||||
| case other => | ||||||||||||||||||||||||||||||||||||||||||||
| throw new IllegalStateException( | ||||||||||||||||||||||||||||||||||||||||||||
| s"Expected ParquetCachedBatch but got ${other.getClass}") | ||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+469
to
+479
|
||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||
| val (cachedSchemaWithNames, selectedSchemaWithNames) = | ||||||||||||||||||||||||||||||||||||||||||||
| getSupportedSchemaFromUnsupported(cacheAttributes, newSelectedAttributes) | ||||||||||||||||||||||||||||||||||||||||||||
| getSupportedSchemaFromUnsupported(cacheAttributes, selectedAttributes) | ||||||||||||||||||||||||||||||||||||||||||||
| convertCachedBatchToColumnarInternal( | ||||||||||||||||||||||||||||||||||||||||||||
| input, | ||||||||||||||||||||||||||||||||||||||||||||
| cachedSchemaWithNames, | ||||||||||||||||||||||||||||||||||||||||||||
| selectedSchemaWithNames, | ||||||||||||||||||||||||||||||||||||||||||||
| newSelectedAttributes) | ||||||||||||||||||||||||||||||||||||||||||||
| selectedAttributes) | ||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||
| private def convertCachedBatchToColumnarInternal( | ||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -563,19 +569,23 @@ class ParquetCachedBatchSerializer extends GpuCachedBatchSerializer { | |||||||||||||||||||||||||||||||||||||||||||
| cacheAttributes: Seq[Attribute], | ||||||||||||||||||||||||||||||||||||||||||||
| selectedAttributes: Seq[Attribute], | ||||||||||||||||||||||||||||||||||||||||||||
| conf: SQLConf): RDD[ColumnarBatch] = { | ||||||||||||||||||||||||||||||||||||||||||||
| // optimize | ||||||||||||||||||||||||||||||||||||||||||||
| val newSelectedAttributes = if (selectedAttributes.isEmpty) { | ||||||||||||||||||||||||||||||||||||||||||||
| cacheAttributes | ||||||||||||||||||||||||||||||||||||||||||||
| } else { | ||||||||||||||||||||||||||||||||||||||||||||
| selectedAttributes | ||||||||||||||||||||||||||||||||||||||||||||
| // When no columns are selected, return row-only batches | ||||||||||||||||||||||||||||||||||||||||||||
| if (selectedAttributes.isEmpty) { | ||||||||||||||||||||||||||||||||||||||||||||
| return input.map { | ||||||||||||||||||||||||||||||||||||||||||||
| case parquetCB: ParquetCachedBatch => | ||||||||||||||||||||||||||||||||||||||||||||
| new ColumnarBatch(Array.empty, parquetCB.numRows) | ||||||||||||||||||||||||||||||||||||||||||||
| case other => | ||||||||||||||||||||||||||||||||||||||||||||
| throw new IllegalStateException( | ||||||||||||||||||||||||||||||||||||||||||||
| s"Expected ParquetCachedBatch but got ${other.getClass}") | ||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+573
to
581
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
The non-empty paths in
Suggested change
The same note applies to the analogous block in Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As you noted, this is functionally safe — the empty |
||||||||||||||||||||||||||||||||||||||||||||
| val rapidsConf = new RapidsConf(conf) | ||||||||||||||||||||||||||||||||||||||||||||
| val (cachedSchemaWithNames, selectedSchemaWithNames) = | ||||||||||||||||||||||||||||||||||||||||||||
| getSupportedSchemaFromUnsupported(cacheAttributes, newSelectedAttributes) | ||||||||||||||||||||||||||||||||||||||||||||
| getSupportedSchemaFromUnsupported(cacheAttributes, selectedAttributes) | ||||||||||||||||||||||||||||||||||||||||||||
| if (rapidsConf.isSqlEnabled && rapidsConf.isSqlExecuteOnGPU && | ||||||||||||||||||||||||||||||||||||||||||||
| isSchemaSupportedByCudf(cachedSchemaWithNames)) { | ||||||||||||||||||||||||||||||||||||||||||||
| val batches = convertCachedBatchToColumnarInternal(input, cachedSchemaWithNames, | ||||||||||||||||||||||||||||||||||||||||||||
| selectedSchemaWithNames, newSelectedAttributes) | ||||||||||||||||||||||||||||||||||||||||||||
| selectedSchemaWithNames, selectedAttributes) | ||||||||||||||||||||||||||||||||||||||||||||
| val cbRdd = batches.map(batch => { | ||||||||||||||||||||||||||||||||||||||||||||
| withResource(batch) { gpuBatch => | ||||||||||||||||||||||||||||||||||||||||||||
| val cols = GpuColumnVector.extractColumns(gpuBatch) | ||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -585,7 +595,7 @@ class ParquetCachedBatchSerializer extends GpuCachedBatchSerializer { | |||||||||||||||||||||||||||||||||||||||||||
| cbRdd.mapPartitions(iter => CloseableColumnBatchIterator(iter)) | ||||||||||||||||||||||||||||||||||||||||||||
| } else { | ||||||||||||||||||||||||||||||||||||||||||||
| val origSelectedAttributesWithUnambiguousNames = | ||||||||||||||||||||||||||||||||||||||||||||
| sanitizeColumnNames(newSelectedAttributes, selectedSchemaWithNames) | ||||||||||||||||||||||||||||||||||||||||||||
| sanitizeColumnNames(selectedAttributes, selectedSchemaWithNames) | ||||||||||||||||||||||||||||||||||||||||||||
| val broadcastedConf = SparkSession.active.sparkContext.broadcast(conf.getAllConfs) | ||||||||||||||||||||||||||||||||||||||||||||
| input.mapPartitions { | ||||||||||||||||||||||||||||||||||||||||||||
| cbIter => { | ||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||
Uh oh!
There was an error while loading. Please reload this page.