Skip to content

refactor: rename withInfo to withFallbackReason for clarity#4508

Merged
andygrove merged 3 commits into
apache:mainfrom
andygrove:rename-fallback-reason
May 30, 2026
Merged

refactor: rename withInfo to withFallbackReason for clarity#4508
andygrove merged 3 commits into
apache:mainfrom
andygrove:rename-fallback-reason

Conversation

@andygrove
Copy link
Copy Markdown
Member

Which issue does this PR close?

Part of #4006. This is a preparatory refactor that does not close the issue on its own; a follow-on PR adds the new informational message channel.

Rationale for this change

Comet uses withInfo to tag plan nodes, but the method and its backing EXTENSION_INFO tag actually mean "this node falls back to Spark": the tag is read by the planning rules as a fallback signal, and a code comment already warns against using it for anything that is not a fallback reason. The name does not match the semantics, which is confusing and blocks adding a genuine informational channel (the goal of #4006). Renaming the fallback path frees the withInfo name for that future use.

What changes are included in this PR?

A pure, behavior-preserving rename across the spark module:

  • withInfo / withInfos -> withFallbackReason / withFallbackReasons
  • hasExplainInfo -> hasFallbackReason
  • private extensionInfo -> fallbackReasons
  • tag CometExplainInfo.EXTENSION_INFO -> CometExplainInfo.FALLBACK_REASONS (the tag string also changes from CometExtensionInfo to CometFallbackReasons)

All call sites, import selectors, version-specific shims, and scaladoc are updated. No behavior changes: the same messages are still logged under COMET_LOG_FALLBACK_REASONS, accumulated and rolled up the same way, and rendered as [COMET: ...] in extended explain output.

How are these changes tested?

Covered by existing tests, which pass unchanged (the withInfo unit test in CometExpressionSuite is renamed to withFallbackReason and continues to assert the same behavior). scalastyle:check passes.

Rename withInfo/withInfos/hasExplainInfo and EXTENSION_INFO to
withFallbackReason/withFallbackReasons/hasFallbackReason and
FALLBACK_REASONS to match their actual semantics (fallback reasons,
not generic info). Also rename the private extensionInfo helper in
ExtendedExplainInfo to fallbackReasons, and update the TreeNodeTag
string from "CometExtensionInfo" to "CometFallbackReasons" so a
future PR can reuse the old string for a distinct tag.
Copy link
Copy Markdown
Contributor

@parthchandra parthchandra left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm. Though you might want to address the one comment.


object CometExplainInfo {
val EXTENSION_INFO = new TreeNodeTag[Set[String]]("CometExtensionInfo")
val FALLBACK_REASONS = new TreeNodeTag[Set[String]]("CometFallbackReasons")
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like CometMetricsListener is still referencing CometExplainInfo.EXTENSION_INFO. CometMetricsListener is not being used (?) but this might break CI

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: rename this?

andygrove added 2 commits May 29, 2026 17:16
# Conflicts:
#	spark/src/main/scala/org/apache/comet/serde/strings.scala
#	spark/src/main/scala/org/apache/comet/serde/structs.scala
Apply rename consistently across the serde layer per review feedback.
@andygrove andygrove merged commit e79183e into apache:main May 30, 2026
68 checks passed
@andygrove andygrove deleted the rename-fallback-reason branch May 30, 2026 02:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants