-
Notifications
You must be signed in to change notification settings - Fork 81
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Moved TableIdentifierComparator next to location key
- Loading branch information
1 parent
22aee1d
commit c440d6c
Showing
3 changed files
with
48 additions
and
53 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 44 additions & 0 deletions
44
...nsions/iceberg/src/main/java/io/deephaven/iceberg/location/TableIdentifierComparator.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
// | ||
// Copyright (c) 2016-2024 Deephaven Data Labs and Patent Pending | ||
// | ||
package io.deephaven.iceberg.location; | ||
|
||
import org.apache.iceberg.catalog.Namespace; | ||
import org.apache.iceberg.catalog.TableIdentifier; | ||
import org.jetbrains.annotations.NotNull; | ||
|
||
import java.util.Arrays; | ||
import java.util.Comparator; | ||
|
||
enum TableIdentifierComparator implements Comparator<TableIdentifier> { | ||
INSTANCE; | ||
|
||
/** | ||
* Compare two {@link TableIdentifier} instances. | ||
* <p> | ||
* Note that this method assumes: | ||
* <ul> | ||
* <li>There are just two fields {@link TableIdentifier#namespace()} and {@link TableIdentifier#name()} in | ||
* {@link TableIdentifier} class, and both are not null for the objects being compared.</li> | ||
* <li>There is just a single field {@link Namespace#levels()} in the {@link Namespace} class.</li> | ||
* </ul> | ||
* <p> | ||
* {@inheritDoc} | ||
* | ||
* @param ti1 the first object to be compared. | ||
* @param ti2 the second object to be compared. | ||
* @return a negative integer, zero, or a positive integer as the first argument is less than, equal to, or greater | ||
* than the second, respectively. | ||
*/ | ||
@Override | ||
public int compare(@NotNull final TableIdentifier ti1, @NotNull final TableIdentifier ti2) { | ||
if (ti1 == ti2) { | ||
return 0; | ||
} | ||
final int comparisonResult; | ||
if ((comparisonResult = Arrays.compare(ti1.namespace().levels(), ti2.namespace().levels())) != 0) { | ||
return comparisonResult; | ||
} | ||
return ti1.name().compareTo(ti2.name()); | ||
} | ||
} |
49 changes: 0 additions & 49 deletions
49
extensions/iceberg/src/main/java/io/deephaven/iceberg/util/IcebergUtils.java
This file was deleted.
Oops, something went wrong.