Skip to content

Commit d8df119

Browse files
committed
ARROW-253: restrict ints to 8, 16, 32, or 64 bits in V1
1 parent 34e7f48 commit d8df119

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

cpp/src/arrow/ipc/metadata-internal.cc

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -55,12 +55,12 @@ const std::shared_ptr<DataType> DOUBLE = std::make_shared<DoubleType>();
5555

5656
static Status IntFromFlatbuffer(
5757
const flatbuf::Int* int_data, std::shared_ptr<DataType>* out) {
58-
if (int_data->bitWidth() % 8 != 0) {
59-
return Status::NotImplemented("Integers not in cstdint are not implemented");
60-
}
6158
if (int_data->bitWidth() > 64) {
6259
return Status::NotImplemented("Integers with more than 64 bits not implemented");
6360
}
61+
if (int_data->bitWidth() < 8) {
62+
return Status::NotImplemented("Integers with less than 8 bits not implemented");
63+
}
6464

6565
switch (int_data->bitWidth()) {
6666
case 8:
@@ -76,8 +76,7 @@ static Status IntFromFlatbuffer(
7676
*out = int_data->is_signed() ? INT64 : UINT64;
7777
break;
7878
default:
79-
*out = nullptr;
80-
break;
79+
return Status::NotImplemented("Integers not in cstdint are not implemented");
8180
}
8281
return Status::OK();
8382
}

format/Message.fbs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ table Bit {
2424
}
2525

2626
table Int {
27-
bitWidth: int; // 1 to 64
27+
bitWidth: int; // restricted to 8, 16, 32, and 64 in v1
2828
is_signed: bool;
2929
}
3030

0 commit comments

Comments
 (0)