Repository navigation
Conversation
|
|
| #include "arrow/util/bit_util.h" | ||
| #include "arrow/util/macros.h" | ||
| #include "arrow/util/span.h" | ||
| #include <span> |
There was a problem hiding this comment.
Can you move the span include to be with the other stdlib headers, rather than down here with the arrow headers?
| static_assert(std::is_same_v<decltype(span(vec)), span<int>>); | ||
| static_assert(std::is_same_v<decltype(span(const_arr)), span<const int>>); | ||
| static_assert(std::is_same_v<decltype(span(const_vec)), span<const int>>); | ||
| static_assert(std::is_same_v<decltype(span(arr)), std::span<int>>); |
There was a problem hiding this comment.
| static_assert(std::is_same_v<decltype(span(arr)), std::span<int>>); | |
| static_assert(std::is_same_v<decltype(std::span(arr)), std::span<int>>); |
Should these have the namespace too?
| using testing::PrintToString; | ||
|
|
||
| namespace arrow::util { | ||
| namespace arrow_util_span_test { |
There was a problem hiding this comment.
Is this still required for other members?
There was a problem hiding this comment.
No, i think this test file is no longer needed, so i will remove it.
| // specific language governing permissions and limitations | ||
| // under the License. | ||
|
|
||
| #include "arrow/array/util.h" |
There was a problem hiding this comment.
Our style conventions currently favor putting the .h inclusion corresponding to a .cc file at the top of said .cc file, so you could leave this as-is.
(no strong feelings from me, though)
| #include <cstring> | ||
| #include <limits> | ||
| #include <memory> | ||
| #include <span> |
There was a problem hiding this comment.
If you didn't have to do any code-level changes in this file, then probably <span> does not need to be included at all?
There was a problem hiding this comment.
Done. this file no longer includes <span> since it isn’t used.
|
|
||
| using arrow::internal::VisitSetBitRunsVoid; | ||
| using arrow::util::span; | ||
| using std::span; |
There was a problem hiding this comment.
Can we remove this and spell std::span in full everywhere?
| using ::arrow::internal::checked_cast; | ||
| using ::arrow::internal::FirstTimeBitmapWriter; | ||
| using ::arrow::util::span; | ||
| using std::span; |
| namespace arrow::compute::internal { | ||
|
|
||
| using ::arrow::util::span; | ||
| using std::span; |
| namespace arrow::compute::internal { | ||
|
|
||
| using ::arrow::util::span; | ||
| using std::span; |
There was a problem hiding this comment.
Same in all other similar places too :)
| #include <span> | ||
| #include <utility> |
There was a problem hiding this comment.
Can we move those up again? The GTest inclusion should be separate from standard library inclusions.
There was a problem hiding this comment.
Thanks, updated. The GTest include is now separated from the stdlib headers in the affected test files.
| #if defined(ARROW_USE_OPENSSL) | ||
| # include <openssl/crypto.h> | ||
| # include <openssl/opensslv.h> | ||
| #endif | ||
|
|
||
| #include "arrow/util/windows_compatibility.h" | ||
| #if defined(_WIN32) | ||
| # include <windows.h> | ||
| #endif | ||
|
|
There was a problem hiding this comment.
Why did you remove all these? Most probably they're required.
There was a problem hiding this comment.
This was an accidental removal on my part, and I’ll restore the required items.
| #include <string> | ||
|
|
||
| #include "arrow/util/span.h" | ||
| #include <span> |
There was a problem hiding this comment.
If there's no other change in this header, then <span> is probably not required?
There was a problem hiding this comment.
<span> is required here because SecureString::as_span() returns std::span, so the header needs the include.
| #include <openssl/aes.h> | ||
| #include <openssl/err.h> | ||
| #include <openssl/evp.h> | ||
| #include <openssl/rand.h> |
There was a problem hiding this comment.
Just like with GTest, can we keep OpenSSL inclusions separate from standard library inclusions?
| #include <vector> | ||
|
|
||
| #include "arrow/util/span.h" | ||
| #include <span> |
There was a problem hiding this comment.
Please move this up with stdlib inclusions.
| #include <utility> | ||
| #include <vector> | ||
|
|
||
| #include "parquet/metadata.h" |
There was a problem hiding this comment.
Let's keep this at the top of file as it was.
| #include <vector> | ||
|
|
||
| #include "arrow/util/span.h" | ||
| #include <span> |
| #include <utility> | ||
| #include <vector> | ||
|
|
||
| #include "parquet/windows_compatibility.h" |
There was a problem hiding this comment.
Let's keep this in its former place.
|
Thanks for doing this @chakkk309! Can you make sure you address all the review comments I posted? Also, please watch for CI results and try to address any failures if they look related :-) |
|
@chakkk309 Sorry, I missed the updates here. Is this waiting for another review? Feel free to ping us when you're waiting for feedback! |
Thanks! Yes, it's currently waiting for review :) |
|
@chakkk309 Ok, could you clean up unrelated changes? I see you moved some includes, removed some newlines, etc. |
|
Closing this as I believe it is obsolete; please feel free to reopen if not!
|
Rationale for this change
Replace custom
arrow::util::spanimplementation with C++20std::spanas suggested in issue #48588. This modernizes the codebase and removes ~130 lines of custom code.What changes are included in this PR?
src/arrow/util/span.h(custom span implementation)arrow::util::span<T>usage withstd::span<T>(95 occurrences)#include "arrow/util/span.h"to#include <span>(41 files)Are these changes tested?
Yes - created comprehensive tests verifying std::span compatibility with all original arrow::util::span functionality including construction, subspan, element access, and byte conversion.
Are there any user-facing changes?
No user-facing changes.