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

fix: Fallback to Spark when shuffling on struct with duplicate field name #776

Merged
merged 1 commit into from
Aug 5, 2024
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 @@ -2936,7 +2936,9 @@ object QueryPlanSerde extends Logging with ShimQueryPlanSerde with CometExprShim
_: DateType | _: BooleanType =>
true
case StructType(fields) =>
fields.forall(f => supportedDataType(f.dataType))
fields.forall(f => supportedDataType(f.dataType)) &&
// Java Arrow stream reader cannot work on duplicate field name
fields.map(f => f.name).distinct.length == fields.length
case ArrayType(ArrayType(_, _), _) => false // TODO: nested array is not supported
case ArrayType(MapType(_, _, _), _) => false // TODO: map array element is not supported
case ArrayType(elementType, _) =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,16 @@ abstract class CometColumnarShuffleSuite extends CometTestBase with AdaptiveSpar

setupTestData()

test("Fallback to Spark when shuffling on struct with duplicate field name") {
val df = sql("""
| SELECT max(struct(a, record.*, b)) as r FROM
| (select a as a, b as b, struct(a,b) as record from testData2) tmp
| GROUP BY a
""".stripMargin).select($"r.*")

checkSparkAnswer(df)
}

test("Unsupported types for SinglePartition should fallback to Spark") {
checkSparkAnswer(spark.sql("""
|SELECT
Expand Down
Loading