hemanthboyina opened a new pull request, #58666:
URL: https://github.com/apache/spark/pull/58666
**What changes were proposed in this pull request?**
DataSourceV2Relation.transformV2Stats matched connector-reported column
statistics to output attributes via
`attribute.name.equals(key.describe())`. This PR matches on the
NamedReference's raw field name (key.fieldNames)
compared through SQLConf.get.resolver, restricted to single-part
references, and no longer compares against describe().
**Why are the changes needed?**
NamedReference.describe() returns a quoted display string
(QuotingUtils.quoteIfNeeded). For a top-level column
whose name
is not a plain identifier (e.g. col-1, 1col, or names with dots/spaces),
describe() yields col-1, which
never equals the attribute name col-1, so the column statistic
is silently dropped. The comparison is also case-sensitive
regardless of `spark.sql.caseSensitive`, so a stat keyed ID is dropped for
an attribute `id` under the default case-insensitive resolution . The lost
stats degrade cost-based optimizer estimates with no error surfaced.
**Does this PR introduce _any_ user-facing change?**
No public API change
**How was this patch tested?**
Added unit tests to DataSourceV2RelationSuite: one for a column name needing
quoting (col-1), and one asserting
case-sensitivity is honored (ID→id
matches under case-insensitive resolution
**Was this patch authored or co-authored using generative AI tooling?**
No
--
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]