wForget opened a new issue, #13823:
URL: https://github.com/apache/gluten/issues/13823
### Backend
VL (Velox)
### Bug description
With AQE enabled, the following two-row query fails on Velox. The first
branch produces a `MAP<STRING, BIGINT>` with non-nullable values. To match the
second branch, Spark inserts an implicit cast to `MAP<STRING, STRING>`. The
`REBALANCE(1)` hint places a shuffle above the union.
```sql
SELECT /*+ REBALANCE(1) */ *
FROM (
SELECT map('k', id) AS m FROM range(0, 1, 1, 1)
UNION ALL
SELECT map('k', '0')
) u;
```
**Expected behavior.** The query returns two rows, each containing
`{"k":"0"}`, as it does with Gluten disabled.
**Actual behavior.** The query fails on the driver with `Invalid call to
nullable on unresolved object` while AQE creates the shuffle query stage.
**Cause.** During plan canonicalization, Spark copies `ColumnarUnionExec`
with a child whose output contains an unresolved attribute. The union
constructor calls `w.setOutputSchemaForPlan(output)`. Evaluating `output` reads
the attribute’s `nullable` property and throws. Velox does not require the
merged output schema. A local regression test passes when the constructor
checks `needOutputSchemaForPlan()` before evaluating `output`.
This issue was written with assistance from OpenAI Codex.
### Gluten version
main branch
### Spark version
None
### Spark configurations
_No response_
### System information
_No response_
### Relevant logs
```bash
org.apache.spark.sql.catalyst.analysis.UnresolvedException: Invalid call to
nullable on unresolved object
at
org.apache.spark.sql.catalyst.analysis.UnresolvedAttribute.nullable(unresolved.scala:265)
at
org.apache.gluten.execution.ColumnarUnionExec.$anonfun$output$5(BasicPhysicalOperatorTransformer.scala:259)
...
at
org.apache.gluten.execution.ColumnarUnionExec.output(BasicPhysicalOperatorTransformer.scala:256)
at
org.apache.gluten.execution.ColumnarUnionExec.$anonfun$new$2(BasicPhysicalOperatorTransformer.scala:245)
...
at
org.apache.gluten.execution.ColumnarUnionExec.<init>(BasicPhysicalOperatorTransformer.scala:242)
at
org.apache.gluten.execution.ColumnarUnionExec.copy(BasicPhysicalOperatorTransformer.scala:239)
at
org.apache.gluten.execution.ColumnarUnionExec.withNewChildrenInternal(BasicPhysicalOperatorTransformer.scala:273)
...
at
org.apache.spark.sql.catalyst.plans.QueryPlan.doCanonicalize(QueryPlan.scala:603)
...
at
org.apache.spark.sql.execution.adaptive.AdaptiveSparkPlanExec.createQueryStages(AdaptiveSparkPlanExec.scala:546)
```
--
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]