Skip to content

Commit fc7469b

Browse files
authored
Fix the namespaces (#15)
1 parent fd2775b commit fc7469b

File tree

9 files changed

+91
-87
lines changed

9 files changed

+91
-87
lines changed

include/sparrow_extensions/bool8_array.hpp

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,8 @@
1616

1717
#include "sparrow/primitive_array.hpp"
1818
#include "sparrow/utils/extension.hpp"
19-
#include "sparrow_extensions/config/config.hpp"
2019

21-
namespace sparrow
20+
namespace sparrow_extensions
2221
{
2322
/**
2423
* @brief Bool8 array using 8-bit storage for boolean values.
@@ -36,22 +35,22 @@ namespace sparrow
3635
* - Extension metadata: empty string
3736
*
3837
*/
39-
using bool8_array = primitive_array<int8_t, simple_extension<"arrow.bool8">, bool>;
38+
using bool8_array = sparrow::primitive_array<int8_t, sparrow::simple_extension<"arrow.bool8">, bool>;
4039
}
4140

4241
#if defined(__cpp_lib_format)
4342
# include <format>
4443

4544
// Formatter specialization for bool8_array
4645
template <>
47-
struct std::formatter<sparrow::bool8_array>
46+
struct std::formatter<sparrow_extensions::bool8_array>
4847
{
4948
constexpr auto parse(std::format_parse_context& ctx)
5049
{
5150
return ctx.begin();
5251
}
5352

54-
auto format(const sparrow::bool8_array& ar, std::format_context& ctx) const
53+
auto format(const sparrow_extensions::bool8_array& ar, std::format_context& ctx) const
5554
{
5655
std::format_to(ctx.out(), "Bool8 array [{}]: [", ar.size());
5756
for (std::size_t i = 0; i < ar.size(); ++i)
@@ -74,7 +73,7 @@ struct std::formatter<sparrow::bool8_array>
7473
}
7574
};
7675

77-
namespace sparrow
76+
namespace sparrow_extensions
7877
{
7978
inline std::ostream& operator<<(std::ostream& os, const bool8_array& value)
8079
{

include/sparrow_extensions/json_array.hpp

Lines changed: 35 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,11 @@
1717
#include "sparrow/utils/extension.hpp"
1818
#include "sparrow/variable_size_binary_array.hpp"
1919
#include "sparrow/variable_size_binary_view_array.hpp"
20-
#include "sparrow_extensions/config/config.hpp"
2120

22-
namespace sparrow
21+
namespace sparrow_extensions
2322
{
2423

25-
using json_extension = simple_extension<"arrow.json">;
24+
using json_extension = sparrow::simple_extension<"arrow.json">;
2625
/**
2726
* @brief JSON array with 32-bit offsets.
2827
*
@@ -41,9 +40,9 @@ namespace sparrow
4140
* @see big_json_array for larger datasets requiring 64-bit offsets
4241
* @see json_view_array for view-based storage
4342
*/
44-
using json_array = variable_size_binary_array_impl<
45-
arrow_traits<std::string>::value_type,
46-
arrow_traits<std::string>::const_reference,
43+
using json_array = sparrow::variable_size_binary_array_impl<
44+
sparrow::arrow_traits<std::string>::value_type,
45+
sparrow::arrow_traits<std::string>::const_reference,
4746
std::int32_t,
4847
json_extension>;
4948

@@ -64,9 +63,9 @@ namespace sparrow
6463
* @see json_array for smaller datasets with 32-bit offsets
6564
* @see json_view_array for view-based storage
6665
*/
67-
using big_json_array = variable_size_binary_array_impl<
68-
arrow_traits<std::string>::value_type,
69-
arrow_traits<std::string>::const_reference,
66+
using big_json_array = sparrow::variable_size_binary_array_impl<
67+
sparrow::arrow_traits<std::string>::value_type,
68+
sparrow::arrow_traits<std::string>::const_reference,
7069
std::int64_t,
7170
json_extension>;
7271

@@ -88,38 +87,38 @@ namespace sparrow
8887
* @see json_array for offset-based storage with 32-bit offsets
8988
* @see big_json_array for offset-based storage with 64-bit offsets
9089
*/
91-
using json_view_array = variable_size_binary_view_array_impl<
92-
arrow_traits<std::string>::value_type,
93-
arrow_traits<std::string>::const_reference,
90+
using json_view_array = sparrow::variable_size_binary_view_array_impl<
91+
sparrow::arrow_traits<std::string>::value_type,
92+
sparrow::arrow_traits<std::string>::const_reference,
9493
json_extension>;
94+
}
9595

96-
namespace detail
96+
namespace sparrow::detail
97+
{
98+
template <>
99+
struct get_data_type_from_array<sparrow_extensions::json_array>
97100
{
98-
template <>
99-
struct get_data_type_from_array<sparrow::json_array>
101+
[[nodiscard]] static constexpr sparrow::data_type get()
100102
{
101-
[[nodiscard]] static constexpr sparrow::data_type get()
102-
{
103-
return sparrow::data_type::STRING;
104-
}
105-
};
103+
return sparrow::data_type::STRING;
104+
}
105+
};
106106

107-
template <>
108-
struct get_data_type_from_array<sparrow::big_json_array>
107+
template <>
108+
struct get_data_type_from_array<sparrow_extensions::big_json_array>
109+
{
110+
[[nodiscard]] static constexpr sparrow::data_type get()
109111
{
110-
[[nodiscard]] static constexpr sparrow::data_type get()
111-
{
112-
return sparrow::data_type::LARGE_STRING;
113-
}
114-
};
112+
return sparrow::data_type::LARGE_STRING;
113+
}
114+
};
115115

116-
template <>
117-
struct get_data_type_from_array<sparrow::json_view_array>
116+
template <>
117+
struct get_data_type_from_array<sparrow_extensions::json_view_array>
118+
{
119+
[[nodiscard]] static constexpr sparrow::data_type get()
118120
{
119-
[[nodiscard]] static constexpr sparrow::data_type get()
120-
{
121-
return sparrow::data_type::STRING_VIEW;
122-
}
123-
};
124-
}
125-
}
121+
return sparrow::data_type::STRING_VIEW;
122+
}
123+
};
124+
}

include/sparrow_extensions/uuid_array.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919

2020
#include "sparrow/fixed_width_binary_array.hpp"
2121
#include "sparrow/utils/contracts.hpp"
22-
#include "sparrow_extensions/config/config.hpp"
2322

2423
namespace sparrow_extensions
2524
{
@@ -97,4 +96,5 @@ namespace sparrow::detail
9796
return sparrow::data_type::FIXED_WIDTH_BINARY;
9897
}
9998
};
100-
} // namespace sparrow::detail
99+
}
100+

src/bool8_array.cpp

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,23 +16,25 @@
1616

1717
#include "sparrow/layout/array_registry.hpp"
1818

19-
namespace sparrow::detail
19+
#include "sparrow_extensions/config/config.hpp"
20+
21+
namespace sparrow_extensions::detail
2022
{
2123
SPARROW_EXTENSIONS_API const bool bool8_array_registered = []()
2224
{
23-
auto& registry = array_registry::instance();
25+
auto& registry = sparrow::array_registry::instance();
2426

2527
registry.register_extension(
26-
data_type::INT8,
28+
sparrow::data_type::INT8,
2729
"arrow.bool8",
28-
[](arrow_proxy proxy)
30+
[](sparrow::arrow_proxy proxy)
2931
{
30-
return cloning_ptr<array_wrapper>{
31-
new array_wrapper_impl<bool8_array>(bool8_array(std::move(proxy)))
32+
return sparrow::cloning_ptr<sparrow::array_wrapper>{
33+
new sparrow::array_wrapper_impl<bool8_array>(bool8_array(std::move(proxy)))
3234
};
3335
}
3436
);
3537

3638
return true;
3739
}();
38-
} // namespace sparrow::detail
40+
}

src/json_array.cpp

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -14,52 +14,54 @@
1414

1515
#include "sparrow_extensions/json_array.hpp"
1616

17-
#include "sparrow/layout/array_registry.hpp"
17+
#include <sparrow/layout/array_registry.hpp>
1818

19-
namespace sparrow::detail
19+
#include "sparrow_extensions/config/config.hpp"
20+
21+
namespace sparrow_extensions::detail
2022
{
2123
SPARROW_EXTENSIONS_API const bool json_arrays_registered = []()
2224
{
23-
auto& registry = array_registry::instance();
25+
auto& registry = sparrow::array_registry::instance();
2426

2527
constexpr std::string_view extension_name = "arrow.json";
2628

2729
// Register json_array (STRING base type)
2830
registry.register_extension(
29-
data_type::STRING,
31+
sparrow::data_type::STRING,
3032
extension_name,
31-
[](arrow_proxy proxy)
33+
[](sparrow::arrow_proxy proxy)
3234
{
33-
return cloning_ptr<array_wrapper>{
34-
new array_wrapper_impl<json_array>(json_array(std::move(proxy)))
35+
return sparrow::cloning_ptr<sparrow::array_wrapper>{
36+
new sparrow::array_wrapper_impl<json_array>(json_array(std::move(proxy)))
3537
};
3638
}
3739
);
3840

3941
// Register big_json_array (LARGE_STRING base type)
4042
registry.register_extension(
41-
data_type::LARGE_STRING,
43+
sparrow::data_type::LARGE_STRING,
4244
extension_name,
43-
[](arrow_proxy proxy)
45+
[](sparrow::arrow_proxy proxy)
4446
{
45-
return cloning_ptr<array_wrapper>{
46-
new array_wrapper_impl<big_json_array>(big_json_array(std::move(proxy)))
47+
return sparrow::cloning_ptr<sparrow::array_wrapper>{
48+
new sparrow::array_wrapper_impl<big_json_array>(big_json_array(std::move(proxy)))
4749
};
4850
}
4951
);
5052

5153
// Register json_view_array (STRING_VIEW base type)
5254
registry.register_extension(
53-
data_type::STRING_VIEW,
55+
sparrow::data_type::STRING_VIEW,
5456
extension_name,
55-
[](arrow_proxy proxy)
57+
[](sparrow::arrow_proxy proxy)
5658
{
57-
return cloning_ptr<array_wrapper>{
58-
new array_wrapper_impl<json_view_array>(json_view_array(std::move(proxy)))
59+
return sparrow::cloning_ptr<sparrow::array_wrapper>{
60+
new sparrow::array_wrapper_impl<json_view_array>(json_view_array(std::move(proxy)))
5961
};
6062
}
6163
);
6264

6365
return true;
6466
}();
65-
} // namespace sparrow::detail
67+
}

src/uuid_array.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616

1717
#include "sparrow/layout/array_registry.hpp"
1818

19+
#include "sparrow_extensions/config/config.hpp"
20+
1921
namespace sparrow::detail
2022
{
2123
SPARROW_EXTENSIONS_API const bool uuid_array_registered = []()
@@ -35,4 +37,4 @@ namespace sparrow::detail
3537

3638
return true;
3739
}();
38-
} // namespace sparrow::detail
40+
}

tests/test_bool8_array.cpp

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,17 @@
1313
// limitations under the License.
1414

1515
#include <ranges>
16-
#include <vector>
1716

18-
#include "sparrow/array.hpp"
19-
#include "sparrow/layout/array_access.hpp"
17+
#include <doctest/doctest.h>
18+
19+
#include <sparrow/array.hpp>
2020

21-
#include "doctest/doctest.h"
2221
#include "metadata_sample.hpp"
2322
#include "sparrow_extensions/bool8_array.hpp"
2423

25-
namespace sparrow
24+
using namespace sparrow;
25+
26+
namespace sparrow_extensions
2627
{
2728
TEST_SUITE("bool8_array")
2829
{

tests/test_json_array.cpp

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,17 @@
1515
#include <string>
1616
#include <vector>
1717

18-
#include "sparrow/array.hpp"
19-
#include "sparrow/layout/array_access.hpp"
20-
#include "sparrow/layout/array_registry.hpp"
21-
#include "sparrow/types/data_type.hpp"
22-
#include "sparrow/utils/nullable.hpp"
18+
#include <doctest/doctest.h>
19+
20+
#include <sparrow/array.hpp>
21+
#include <sparrow/types/data_type.hpp>
22+
#include <sparrow/utils/nullable.hpp>
2323

24-
#include "doctest/doctest.h"
2524
#include "sparrow_extensions/json_array.hpp"
2625

27-
namespace sparrow
26+
using namespace sparrow;
27+
28+
namespace sparrow_extensions
2829
{
2930
TEST_SUITE("json_array")
3031
{

tests/test_uuid_array.cpp

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,13 @@
1515
#include <algorithm>
1616
#include <array>
1717
#include <cstddef>
18-
#include <vector>
1918

20-
#include "sparrow/array.hpp"
21-
#include "sparrow/layout/array_access.hpp"
22-
#include "sparrow/layout/array_registry.hpp"
23-
#include "sparrow/types/data_type.hpp"
24-
#include "sparrow/utils/nullable.hpp"
19+
#include <doctest/doctest.h>
20+
21+
#include <sparrow/array.hpp>
22+
#include <sparrow/types/data_type.hpp>
23+
#include <sparrow/utils/nullable.hpp>
2524

26-
#include "doctest/doctest.h"
2725
#include "sparrow_extensions/uuid_array.hpp"
2826

2927
namespace sparrow_extensions

0 commit comments

Comments
 (0)