-
Notifications
You must be signed in to change notification settings - Fork 78
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed the parquet uint32 reading failure (#5495)
- Loading branch information
1 parent
1316717
commit 02b11bf
Showing
6 changed files
with
132 additions
and
16 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
56 changes: 56 additions & 0 deletions
56
.../src/main/java/io/deephaven/parquet/table/pagestore/topage/ToLongPageFromUnsignedInt.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,56 @@ | ||
// | ||
// Copyright (c) 2016-2024 Deephaven Data Labs and Patent Pending | ||
// | ||
package io.deephaven.parquet.table.pagestore.topage; | ||
|
||
import io.deephaven.chunk.ChunkType; | ||
import io.deephaven.chunk.attributes.Any; | ||
import org.jetbrains.annotations.NotNull; | ||
|
||
import static io.deephaven.util.QueryConstants.NULL_INT; | ||
import static io.deephaven.util.QueryConstants.NULL_INT_BOXED; | ||
import static io.deephaven.util.QueryConstants.NULL_LONG; | ||
|
||
public class ToLongPageFromUnsignedInt<ATTR extends Any> implements ToPage<ATTR, long[]> { | ||
|
||
private static final ToLongPageFromUnsignedInt INSTANCE = new ToLongPageFromUnsignedInt<>(); | ||
|
||
public static <ATTR extends Any> ToLongPageFromUnsignedInt<ATTR> create(final Class<?> nativeType) { | ||
if (nativeType == null || long.class.equals(nativeType)) { | ||
// noinspection unchecked | ||
return INSTANCE; | ||
} | ||
throw new IllegalArgumentException("The native type for a Long column is " + nativeType.getCanonicalName()); | ||
} | ||
|
||
private ToLongPageFromUnsignedInt() {} | ||
|
||
@Override | ||
@NotNull | ||
public final Class<Long> getNativeType() { | ||
return long.class; | ||
} | ||
|
||
@Override | ||
@NotNull | ||
public final ChunkType getChunkType() { | ||
return ChunkType.Long; | ||
} | ||
|
||
@Override | ||
@NotNull | ||
public final Object nullValue() { | ||
return NULL_INT_BOXED; | ||
} | ||
|
||
@Override | ||
public final long[] convertResult(final Object result) { | ||
final int[] from = (int[]) result; | ||
final long[] to = new long[from.length]; | ||
for (int i = 0; i < from.length; ++i) { | ||
final int fromValue = from[i]; | ||
to[i] = fromValue == NULL_INT ? NULL_LONG : Integer.toUnsignedLong(fromValue); | ||
} | ||
return to; | ||
} | ||
} |
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
3 changes: 3 additions & 0 deletions
3
extensions/parquet/table/src/test/resources/ReferenceUintParquetData.parquet
Git LFS file not shown
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