Skip to content

fix: classify unsupported format patterns as Unsupported in CometFromUnixTime#4660

Open
marvelshan wants to merge 3 commits into
apache:mainfrom
marvelshan:fix/from-unixtime-unsupported-format
Open

fix: classify unsupported format patterns as Unsupported in CometFromUnixTime#4660
marvelshan wants to merge 3 commits into
apache:mainfrom
marvelshan:fix/from-unixtime-unsupported-format

Conversation

@marvelshan

Copy link
Copy Markdown
Contributor

Which issue does this PR close?

Closes #4575

Rationale for this change

CometFromUnixTime incorrectly reports non-default datetime format patterns as Incompatible instead of Unsupported. This is misleading because:

What changes are included in this PR?

  • Split getIncompatibleReasons() to only contain the timestamp range difference (which is a true incompatibility — native can execute but results may differ at boundaries)
  • Added getUnsupportedReasons() to document format pattern limitations (native cannot execute these at all)
  • Updated getSupportLevel(expr) to dynamically return Unsupported for non-default format patterns and Incompatible for the default pattern, matching the actual behavior in convert()

How are these changes tested?

Existing tests cover the fallback behavior. The convert() method already returns None for non-default formats, and getSupportLevel() now aligns with that behavior. The GenerateDocs output will correctly classify format limitations under "Unsupported" rather than "Incompatible".

@marvelshan marvelshan force-pushed the fix/from-unixtime-unsupported-format branch from 0aa73b7 to 32f11be Compare June 16, 2026 07:04
val timeZone = exprToProtoInternal(Literal(expr.timeZoneId.orNull), inputs, binding)

if (expr.format != Literal(TimestampFormatter.defaultPattern)) {
if (expr.format != Literal(TimestampFormatter.defaultPattern())) {

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 : might be an unwanted change ?

if (expr.format != Literal(TimestampFormatter.defaultPattern())) {
Unsupported(Some("Only the default datetime pattern `yyyy-MM-dd HH:mm:ss` is supported"))
} else {
Incompatible(None)

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.

We might wnat to add some SQL tests to verify the fallback and make sure the plan is annotated

…UnixTime

CometFromUnixTime previously reported all limitations as Incompatible,
but non-default format patterns cannot be executed natively at all and
should be Unsupported. The DataFusion timestamp range difference is
the genuine Incompatible case.

- Split getIncompatibleReasons to only contain the timestamp range issue
- Add getUnsupportedReasons for the format pattern limitation
- Make getSupportLevel return Unsupported for non-default patterns,
  Incompatible for the default pattern
…patterns

Verify that non-default format patterns fall back to Spark with the
expected reason, and that the default pattern runs natively when
allowIncompatible=true.
@marvelshan marvelshan force-pushed the fix/from-unixtime-unsupported-format branch from 32f11be to 737eb77 Compare June 17, 2026 02:16
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.

CometFromUnixTime reports unsupported format patterns as Incompatible instead of Unsupported

2 participants