Skip to content

[FLINK-39195][Table SQL/API] ObjectPath should implement Comparable#27728

Open
Myracle wants to merge 1 commit intoapache:masterfrom
Myracle:FLINK-39195-ObjectPath-comparable
Open

[FLINK-39195][Table SQL/API] ObjectPath should implement Comparable#27728
Myracle wants to merge 1 commit intoapache:masterfrom
Myracle:FLINK-39195-ObjectPath-comparable

Conversation

@Myracle
Copy link
Contributor

@Myracle Myracle commented Mar 3, 2026

What is the purpose of the change

This pull request makes ObjectPath implement the Comparable<ObjectPath> interface, enabling natural ordering of ObjectPath instances. This allows users to sort catalog object paths (e.g., in TreeMap, TreeSet, or Collections.sort()) by database name first, then by object name, which is useful when displaying or processing catalog objects in a deterministic order.

Brief change log

  • Made ObjectPath implement Comparable<ObjectPath>, with comparison based on databaseName first and then objectName
  • Added ObjectPathTest with comprehensive test cases covering comparison, sorting, transitivity, and consistency with equals

Verifying this change

This change added tests and can be verified as follows:

  • Added ObjectPathTest with 8 test cases covering:
    • Comparison with different database names
    • Comparison with same database but different object names
    • Comparison with equal paths
    • Comparison with self
    • Consistency between compareTo and equals
    • Sorting behavior with Collections.sort()
    • Transitivity of the comparison
    • Database name takes precedence over object name in ordering

Does this pull request potentially affect one of the following parts:

  • Dependencies (does it add or upgrade a dependency): no
  • The public API, i.e., is any changed class annotated with @Public(Evolving): yes (ObjectPath is annotated with @PublicEvolving)
  • The serializers: no
  • The runtime per-record code paths (performance sensitive): no
  • Anything that affects deployment or recovery: JobManager (and its components), Checkpointing, Kubernetes/Yarn, ZooKeeper: no
  • The S3 file system connector: no

Documentation

  • Does this pull request introduce a new feature? no
  • If yes, how is the feature documented? not applicable

@Myracle Myracle force-pushed the FLINK-39195-ObjectPath-comparable branch from 2e1efbd to b6024ce Compare March 3, 2026 07:25
@flinkbot
Copy link
Collaborator

flinkbot commented Mar 3, 2026

CI report:

Bot commands The @flinkbot bot supports the following commands:
  • @flinkbot run azure re-run the last Azure build

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