Skip to content

Commit 8163d02

Browse files
ZhangHuiGuipitrou
andauthored
apacheGH-40431: [C++] Move key_hash/key_map/light_array related files to internal for prevent using by users (apache#40484)
### Rationale for this change These files expose implementation details and APIs that are not meant for third-party use. This PR explicitly marks them internal, which also avoids having them installed. ### Are these changes tested? By existing builds and tests. ### Are there any user-facing changes? No, except hiding some header files that were not supposed to be included externally. * GitHub Issue: apache#40431 Lead-authored-by: ZhangHuiGui <[email protected]> Co-authored-by: Antoine Pitrou <[email protected]> Signed-off-by: Antoine Pitrou <[email protected]>
1 parent 5ddef63 commit 8163d02

24 files changed

+44
-39
lines changed

cpp/src/arrow/CMakeLists.txt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -689,9 +689,9 @@ set(ARROW_COMPUTE_SRCS
689689
compute/function.cc
690690
compute/function_internal.cc
691691
compute/kernel.cc
692-
compute/key_hash.cc
693-
compute/key_map.cc
694-
compute/light_array.cc
692+
compute/key_hash_internal.cc
693+
compute/key_map_internal.cc
694+
compute/light_array_internal.cc
695695
compute/ordering.cc
696696
compute/registry.cc
697697
compute/kernels/codegen_internal.cc
@@ -717,8 +717,8 @@ set(ARROW_COMPUTE_SRCS
717717
compute/row/row_internal.cc
718718
compute/util.cc)
719719

720-
append_runtime_avx2_src(ARROW_COMPUTE_SRCS compute/key_hash_avx2.cc)
721-
append_runtime_avx2_bmi2_src(ARROW_COMPUTE_SRCS compute/key_map_avx2.cc)
720+
append_runtime_avx2_src(ARROW_COMPUTE_SRCS compute/key_hash_internal_avx2.cc)
721+
append_runtime_avx2_bmi2_src(ARROW_COMPUTE_SRCS compute/key_map_internal_avx2.cc)
722722
append_runtime_avx2_src(ARROW_COMPUTE_SRCS compute/row/compare_internal_avx2.cc)
723723
append_runtime_avx2_src(ARROW_COMPUTE_SRCS compute/row/encode_internal_avx2.cc)
724724
append_runtime_avx2_bmi2_src(ARROW_COMPUTE_SRCS compute/util_avx2.cc)

cpp/src/arrow/acero/asof_join_node.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,8 @@
4545
#include "arrow/compute/function_internal.h"
4646
#endif
4747
#include "arrow/acero/time_series_util.h"
48-
#include "arrow/compute/key_hash.h"
49-
#include "arrow/compute/light_array.h"
48+
#include "arrow/compute/key_hash_internal.h"
49+
#include "arrow/compute/light_array_internal.h"
5050
#include "arrow/record_batch.h"
5151
#include "arrow/result.h"
5252
#include "arrow/status.h"

cpp/src/arrow/acero/bloom_filter_test.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
#include "arrow/acero/task_util.h"
2828
#include "arrow/acero/test_util_internal.h"
2929
#include "arrow/acero/util.h"
30-
#include "arrow/compute/key_hash.h"
30+
#include "arrow/compute/key_hash_internal.h"
3131
#include "arrow/util/bitmap_ops.h"
3232
#include "arrow/util/config.h"
3333
#include "arrow/util/cpu_info.h"

cpp/src/arrow/acero/hash_join_node.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
#include "arrow/acero/options.h"
2828
#include "arrow/acero/schema_util.h"
2929
#include "arrow/acero/util.h"
30-
#include "arrow/compute/key_hash.h"
30+
#include "arrow/compute/key_hash_internal.h"
3131
#include "arrow/util/checked_cast.h"
3232
#include "arrow/util/future.h"
3333
#include "arrow/util/thread_pool.h"

cpp/src/arrow/acero/hash_join_node.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717

1818
#pragma once
1919

20+
#include <cassert>
2021
#include <vector>
2122

2223
#include "arrow/acero/options.h"
@@ -88,7 +89,7 @@ class ARROW_ACERO_EXPORT HashJoinSchema {
8889
const Expression& filter);
8990

9091
bool PayloadIsEmpty(int side) {
91-
ARROW_DCHECK(side == 0 || side == 1);
92+
assert(side == 0 || side == 1);
9293
return proj_maps[side].num_cols(HashJoinProjection::PAYLOAD) == 0;
9394
}
9495

cpp/src/arrow/acero/schema_util.h

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,13 @@
1717

1818
#pragma once
1919

20+
#include <cassert>
2021
#include <cstdint>
2122
#include <memory>
2223
#include <string>
2324
#include <vector>
2425

25-
#include "arrow/compute/light_array.h" // for KeyColumnMetadata
26-
#include "arrow/type.h" // for DataType, FieldRef, Field and Schema
26+
#include "arrow/type.h" // for DataType, FieldRef, Field and Schema
2727

2828
namespace arrow {
2929

@@ -47,8 +47,8 @@ struct SchemaProjectionMap {
4747
const int* source_to_base;
4848
const int* base_to_target;
4949
inline int get(int i) const {
50-
ARROW_DCHECK(i >= 0 && i < num_cols);
51-
ARROW_DCHECK(source_to_base[i] != kMissingField);
50+
assert(i >= 0 && i < num_cols);
51+
assert(source_to_base[i] != kMissingField);
5252
return base_to_target[source_to_base[i]];
5353
}
5454
};
@@ -66,7 +66,7 @@ class SchemaProjectionMaps {
6666
Status Init(ProjectionIdEnum full_schema_handle, const Schema& schema,
6767
const std::vector<ProjectionIdEnum>& projection_handles,
6868
const std::vector<const std::vector<FieldRef>*>& projections) {
69-
ARROW_DCHECK(projection_handles.size() == projections.size());
69+
assert(projection_handles.size() == projections.size());
7070
ARROW_RETURN_NOT_OK(RegisterSchema(full_schema_handle, schema));
7171
for (size_t i = 0; i < projections.size(); ++i) {
7272
ARROW_RETURN_NOT_OK(
@@ -174,7 +174,7 @@ class SchemaProjectionMaps {
174174
}
175175
}
176176
// We should never get here
177-
ARROW_DCHECK(false);
177+
assert(false);
178178
return -1;
179179
}
180180

@@ -207,7 +207,7 @@ class SchemaProjectionMaps {
207207
break;
208208
}
209209
}
210-
ARROW_DCHECK(field_id != SchemaProjectionMap::kMissingField);
210+
assert(field_id != SchemaProjectionMap::kMissingField);
211211
mapping[i] = field_id;
212212
inverse_mapping[field_id] = i;
213213
}

cpp/src/arrow/acero/swiss_join.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
#include "arrow/acero/util.h"
2626
#include "arrow/array/util.h" // MakeArrayFromScalar
2727
#include "arrow/compute/kernels/row_encoder_internal.h"
28-
#include "arrow/compute/key_hash.h"
28+
#include "arrow/compute/key_hash_internal.h"
2929
#include "arrow/compute/row/compare_internal.h"
3030
#include "arrow/compute/row/encode_internal.h"
3131
#include "arrow/util/bit_util.h"

cpp/src/arrow/acero/swiss_join_internal.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@
2323
#include "arrow/acero/schema_util.h"
2424
#include "arrow/acero/task_util.h"
2525
#include "arrow/compute/kernels/row_encoder_internal.h"
26-
#include "arrow/compute/key_map.h"
27-
#include "arrow/compute/light_array.h"
26+
#include "arrow/compute/key_map_internal.h"
27+
#include "arrow/compute/light_array_internal.h"
2828
#include "arrow/compute/row/encode_internal.h"
2929

3030
namespace arrow {

cpp/src/arrow/compute/key_hash.cc renamed to cpp/src/arrow/compute/key_hash_internal.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,14 @@
1515
// specific language governing permissions and limitations
1616
// under the License.
1717

18-
#include "arrow/compute/key_hash.h"
18+
#include "arrow/compute/key_hash_internal.h"
1919

2020
#include <memory.h>
2121

2222
#include <algorithm>
2323
#include <cstdint>
2424

25-
#include "arrow/compute/light_array.h"
25+
#include "arrow/compute/light_array_internal.h"
2626
#include "arrow/util/bit_util.h"
2727
#include "arrow/util/ubsan.h"
2828

cpp/src/arrow/compute/key_hash.h renamed to cpp/src/arrow/compute/key_hash_internal.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323

2424
#include <cstdint>
2525

26-
#include "arrow/compute/light_array.h"
26+
#include "arrow/compute/light_array_internal.h"
2727
#include "arrow/compute/util.h"
2828

2929
namespace arrow {

0 commit comments

Comments
 (0)