Skip to content

Commit

Permalink
Refine naming
Browse files Browse the repository at this point in the history
  • Loading branch information
zanmato1984 committed May 8, 2024
1 parent f0d8a5e commit 2d2b939
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion cpp/src/arrow/acero/hash_join_node.cc
Original file line number Diff line number Diff line change
Expand Up @@ -655,7 +655,7 @@ struct BloomFilterPushdownContext {
} eval_;

static constexpr auto kTempStackUsage =
Hashing32::kTempStackUsage +
Hashing32::kHashBatchTempStackUsage +
(sizeof(uint32_t) + /*extra=*/1) * arrow::util::MiniBatch::kMiniBatchLength;

struct ThreadLocalData {
Expand Down
2 changes: 1 addition & 1 deletion cpp/src/arrow/acero/hash_join_node_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3235,7 +3235,7 @@ TEST(HashJoin, ManyJoins) {
std::move(left_batches.batches))};

HashJoinNodeOptions join_opts(JoinType::LEFT_OUTER, /*left_keys=*/{"l_key"},
/*right_keys*/ {"r_key"});
/*right_keys=*/{"r_key"});

for (int i = 0; i < num_joins; ++i) {
ASSERT_OK_AND_ASSIGN(auto right_batches,
Expand Down
4 changes: 2 additions & 2 deletions cpp/src/arrow/compute/key_hash_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ class ARROW_EXPORT Hashing32 {

// Clarify the max temp stack usage for HashBatch so the caller could reserve enough
// size in advance.
static constexpr auto kTempStackUsage =
static constexpr auto kHashBatchTempStackUsage =
(sizeof(uint32_t) + sizeof(uint16_t) + sizeof(uint32_t) + /*extra=*/1) *
util::MiniBatch::kMiniBatchLength;

Expand Down Expand Up @@ -169,7 +169,7 @@ class ARROW_EXPORT Hashing64 {

// Clarify the max temp stack usage for HashBatch so the caller could reserve enough
// size in advance.
static constexpr auto kTempStackUsage =
static constexpr auto kHashBatchTempStackUsage =
(sizeof(uint16_t) + sizeof(uint64_t) + /*extra=*/1) *
util::MiniBatch::kMiniBatchLength;

Expand Down
6 changes: 3 additions & 3 deletions cpp/src/arrow/compute/key_hash_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ TEST(VectorHash, FixedLengthTailByteSafety) {
}

// Make sure that Hashing32/64::HashBatch uses no more stack space than declared in
// Hashing32/64::kTempStackUsage.
// Hashing32/64::kHashBatchTempStackUsage.
TEST(VectorHash, HashBatchTempStackUsage) {
for (auto num_rows :
{0, 1, MiniBatch::kMiniBatchLength, MiniBatch::kMiniBatchLength * 64}) {
Expand All @@ -337,7 +337,7 @@ TEST(VectorHash, HashBatchTempStackUsage) {
{
std::vector<uint32_t> hashes(num_rows);
TempVectorStack stack;
ASSERT_OK(stack.Init(pool, Hashing32::kTempStackUsage));
ASSERT_OK(stack.Init(pool, Hashing32::kHashBatchTempStackUsage));
for (size_t i = 0; i < hardware_flags_for_testing.size(); ++i) {
SCOPED_TRACE("hashing32 for hardware flags = " +
std::to_string(hardware_flags_for_testing[i]));
Expand All @@ -350,7 +350,7 @@ TEST(VectorHash, HashBatchTempStackUsage) {
{
std::vector<uint64_t> hashes(num_rows);
TempVectorStack stack;
ASSERT_OK(stack.Init(pool, Hashing64::kTempStackUsage));
ASSERT_OK(stack.Init(pool, Hashing64::kHashBatchTempStackUsage));
for (size_t i = 0; i < hardware_flags_for_testing.size(); ++i) {
SCOPED_TRACE("hashing64 for hardware flags = " +
std::to_string(hardware_flags_for_testing[i]));
Expand Down
2 changes: 1 addition & 1 deletion cpp/src/arrow/compute/row/compare_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class ARROW_EXPORT KeyCompare {
public:
// Clarify the max temp stack usage for CompareColumnsToRows so the caller could reserve
// enough size in advance.
constexpr static int64_t TempStackUsage(int64_t num_rows) {
constexpr static int64_t CompareColumnsToRowsTempStackUsage(int64_t num_rows) {
return (sizeof(uint8_t) + sizeof(uint8_t) + sizeof(uint8_t)) * num_rows +
/*extra=*/util::MiniBatch::kMiniBatchLength;
}
Expand Down
6 changes: 3 additions & 3 deletions cpp/src/arrow/compute/row/compare_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ TEST(KeyCompare, CompareColumnsToRowsCuriousFSB) {

MemoryPool* pool = default_memory_pool();
TempVectorStack stack;
ASSERT_OK(stack.Init(pool, KeyCompare::TempStackUsage(num_rows)));
ASSERT_OK(stack.Init(pool, KeyCompare::CompareColumnsToRowsTempStackUsage(num_rows)));

auto column_right = ArrayFromJSON(fixed_size_binary(fsb_length), R"([
"000000000",
Expand Down Expand Up @@ -110,15 +110,15 @@ TEST(KeyCompare, CompareColumnsToRowsCuriousFSB) {
}

// Make sure that KeyCompare::CompareColumnsToRows uses no more stack space than declared
// in KeyCompare::TempStackUsage().
// in KeyCompare::CompareColumnsToRowsTempStackUsage().
TEST(KeyCompare, CompareColumnsToRowsTempStackUsage) {
for (auto num_rows :
{0, 1, MiniBatch::kMiniBatchLength, MiniBatch::kMiniBatchLength * 64}) {
SCOPED_TRACE("num_rows = " + std::to_string(num_rows));

MemoryPool* pool = default_memory_pool();
TempVectorStack stack;
ASSERT_OK(stack.Init(pool, KeyCompare::TempStackUsage(num_rows)));
ASSERT_OK(stack.Init(pool, KeyCompare::CompareColumnsToRowsTempStackUsage(num_rows)));

RandomArrayGenerator gen(42);

Expand Down

0 comments on commit 2d2b939

Please sign in to comment.