Skip to content
This repository was archived by the owner on May 10, 2024. It is now read-only.
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions src/parquet/types-test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -96,19 +96,19 @@ TEST(TypePrinter, StatisticsTypes) {
Int96 Int96_max = {{2048, 4096, 8192}};
smin = std::string(reinterpret_cast<char*>(&Int96_min), sizeof(Int96));
smax = std::string(reinterpret_cast<char*>(&Int96_max), sizeof(Int96));
ASSERT_STREQ("1024 2048 4096 ", FormatStatValue(Type::INT96, smin.c_str()).c_str());
ASSERT_STREQ("2048 4096 8192 ", FormatStatValue(Type::INT96, smax.c_str()).c_str());
ASSERT_STREQ("1024 2048 4096", FormatStatValue(Type::INT96, smin.c_str()).c_str());
ASSERT_STREQ("2048 4096 8192", FormatStatValue(Type::INT96, smax.c_str()).c_str());

smin = std::string("abcdef");
smax = std::string("ijklmnop");
ASSERT_STREQ("abcdef ", FormatStatValue(Type::BYTE_ARRAY, smin.c_str()).c_str());
ASSERT_STREQ("ijklmnop ", FormatStatValue(Type::BYTE_ARRAY, smax.c_str()).c_str());
ASSERT_STREQ("abcdef", FormatStatValue(Type::BYTE_ARRAY, smin.c_str()).c_str());
ASSERT_STREQ("ijklmnop", FormatStatValue(Type::BYTE_ARRAY, smax.c_str()).c_str());

smin = std::string("abcdefgh");
smax = std::string("ijklmnop");
ASSERT_STREQ("abcdefgh ",
ASSERT_STREQ("abcdefgh",
FormatStatValue(Type::FIXED_LEN_BYTE_ARRAY, smin.c_str()).c_str());
ASSERT_STREQ("ijklmnop ",
ASSERT_STREQ("ijklmnop",
FormatStatValue(Type::FIXED_LEN_BYTE_ARRAY, smax.c_str()).c_str());
}

Expand Down
9 changes: 4 additions & 5 deletions src/parquet/types.cc
Original file line number Diff line number Diff line change
Expand Up @@ -43,17 +43,16 @@ std::string FormatStatValue(Type::type parquet_type, const char* val) {
result << reinterpret_cast<const float*>(val)[0];
break;
case Type::INT96: {
for (int i = 0; i < 3; i++) {
result << reinterpret_cast<const int32_t*>(val)[i] << " ";
}
auto const i32_val = reinterpret_cast<const int32_t*>(val);
result << i32_val[0] << " " << i32_val[1] << " " << i32_val[2];
break;
}
case Type::BYTE_ARRAY: {
result << val << " ";
result << val;
break;
}
case Type::FIXED_LEN_BYTE_ARRAY: {
result << val << " ";
result << val;
break;
}
default:
Expand Down