forked from nbauernfeind/deephaven-core
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Address sorting for Parquet metadata and persistent data indexes (dee…
…phaven#5423) * Sort Parquet persistent index tables before writing them * Correct Parquet metadata (TableInfo) for sort columns; address missing documentation and incorrect serialization * Populate TableInfo.sortingColumns() for primary tables and index tables
- Loading branch information
Showing
7 changed files
with
182 additions
and
24 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
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
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
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
61 changes: 61 additions & 0 deletions
61
...sions/parquet/table/src/main/java/io/deephaven/parquet/table/metadata/SortColumnInfo.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,61 @@ | ||
// | ||
// Copyright (c) 2016-2024 Deephaven Data Labs and Patent Pending | ||
// | ||
package io.deephaven.parquet.table.metadata; | ||
|
||
import com.fasterxml.jackson.annotation.JsonInclude; | ||
import com.fasterxml.jackson.databind.annotation.JsonDeserialize; | ||
import com.fasterxml.jackson.databind.annotation.JsonSerialize; | ||
import io.deephaven.annotations.SimpleStyle; | ||
import io.deephaven.api.ColumnName; | ||
import io.deephaven.api.SortColumn; | ||
import org.immutables.value.Value.Check; | ||
import org.immutables.value.Value.Immutable; | ||
import org.immutables.value.Value.Parameter; | ||
import org.jetbrains.annotations.NotNull; | ||
|
||
import java.util.List; | ||
import java.util.stream.Collectors; | ||
|
||
@Immutable | ||
@SimpleStyle | ||
@JsonSerialize(as = ImmutableSortColumnInfo.class) | ||
@JsonDeserialize(as = ImmutableSortColumnInfo.class) | ||
@JsonInclude(JsonInclude.Include.NON_EMPTY) | ||
public abstract class SortColumnInfo { | ||
|
||
public enum SortDirection { | ||
Ascending, Descending | ||
} | ||
|
||
@Parameter | ||
public abstract String columnName(); | ||
|
||
@Parameter | ||
public abstract SortDirection sortDirection(); | ||
|
||
@Check | ||
final void checkColumnName() { | ||
ColumnName.of(columnName()); | ||
} | ||
|
||
public final SortColumn sortColumn() { | ||
return sortDirection() == SortDirection.Ascending | ||
? SortColumn.asc(ColumnName.of(columnName())) | ||
: SortColumn.desc(ColumnName.of(columnName())); | ||
} | ||
|
||
public static List<SortColumn> sortColumns(@NotNull final List<SortColumnInfo> sortColumnInfos) { | ||
return sortColumnInfos.stream().map(SortColumnInfo::sortColumn).collect(Collectors.toList()); | ||
} | ||
|
||
public static SortColumnInfo of(@NotNull final SortColumn sortColumn) { | ||
return of(sortColumn.column().name(), sortColumn.order() == SortColumn.Order.ASCENDING | ||
? SortDirection.Ascending | ||
: SortDirection.Descending); | ||
} | ||
|
||
public static SortColumnInfo of(@NotNull final String columnName, @NotNull final SortDirection sortDirection) { | ||
return ImmutableSortColumnInfo.of(columnName, sortDirection); | ||
} | ||
} |
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
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