Skip to content

Commit b043010

Browse files
committed
Also return expected dtype
1 parent 2bd58b6 commit b043010

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

src/uproot/const.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -138,8 +138,8 @@
138138
0x0B: "float16",
139139
0x0C: "float32",
140140
0x0D: "float64",
141-
0x0E: "uint32", # Index32
142-
0x0F: "uint64", # Index64
141+
0x0E: "int32", # Index32
142+
0x0F: "int64", # Index64
143143
0x10: "switch", # Switch: (uint64, uint32)
144144
0x11: "int16", # SplitInt16: split + zigzag encoding
145145
0x12: "uint16", # SplitUInt16: split encoding
@@ -150,8 +150,8 @@
150150
0x17: "float16", # SplitReal16: split encoding
151151
0x18: "float32", # SplitReal32: split encoding
152152
0x19: "float64", # SplitReal64: split encoding
153-
0x1A: "uint32", # SplitIndex32: split + delta encoding
154-
0x1B: "uint64", # SplitIndex64: split + delta encoding
153+
0x1A: "int32", # SplitIndex32: split + delta encoding
154+
0x1B: "int64", # SplitIndex64: split + delta encoding
155155
0x1C: "real32trunc", # Real32Trunc: float32 with truncated mantissa
156156
0x1D: "real32quant", # Real32Quant: float32 with quantized integer representation
157157
}

src/uproot/models/RNTuple.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -650,7 +650,7 @@ def read_page(
650650
]
651651
self.deserialize_page_decompressed_buffer(destination, field_metadata)
652652

653-
def _expected_array_length_and_starts(
653+
def _expected_array_length_starts_dtype(
654654
self, col_idx, cluster_start, cluster_stop, missing_element_padding=0
655655
):
656656
"""
@@ -660,7 +660,7 @@ def _expected_array_length_and_starts(
660660
cluster_stop (int): The first cluster to exclude (i.e. one greater than the last cluster to include).
661661
missing_element_padding (int): Number of padding elements to add at the start of the array.
662662
663-
Returns the expected length of the array over the given cluster range, including padding, and also the start indices of each cluster.
663+
Returns the expected length of the array over the given cluster range (including padding), the start indices of each cluster, and the dtype of the array.
664664
"""
665665
field_metadata = self.get_field_metadata(col_idx)
666666
if field_metadata.dtype_byte in uproot.const.rntuple_index_types:
@@ -690,7 +690,7 @@ def _expected_array_length_and_starts(
690690
starts.append(total_length)
691691
total_length += cluster_length
692692

693-
return total_length, starts
693+
return total_length, starts, field_metadata.dtype_result
694694

695695
def read_cluster_range(
696696
self,
@@ -711,7 +711,7 @@ def read_cluster_range(
711711
Returns a numpy array with the data from the column.
712712
"""
713713
field_metadata = self.get_field_metadata(col_idx)
714-
total_length, starts = self._expected_array_length_and_starts(
714+
total_length, starts, _ = self._expected_array_length_starts_dtype(
715715
col_idx, cluster_start, cluster_stop, missing_element_padding
716716
)
717717
res = numpy.empty(total_length, field_metadata.dtype_result)
@@ -964,7 +964,7 @@ def gpu_deserialize_decompressed_content(
964964
n_padding = self.column_records[key_nr].first_element_index
965965
n_padding -= cluster_starts[start_cluster_idx]
966966
n_padding = max(n_padding, 0)
967-
total_length, starts = self._expected_array_length_and_starts(
967+
total_length, starts, _ = self._expected_array_length_starts_dtype(
968968
ncol, start_cluster_idx, stop_cluster_idx, n_padding
969969
)
970970
field_metadata = self.get_field_metadata(ncol)

0 commit comments

Comments
 (0)