Skip to content

Conversation

@HyukjinKwon
Copy link
Member

@HyukjinKwon HyukjinKwon commented Dec 30, 2025

Rationale for this change

Replaces boost::algorithm::join with Arrow's internal arrow::internal::JoinStrings to remove the boost dependency. Both functions have equivalent behavior: they join a vector of strings with a delimiter.

What changes are included in this PR?

Replaced boost::algorithm::join(*create_params, ",") with arrow::internal::JoinStrings(*create_params, ",") (line 112) at cpp/src/arrow/flight/sql/odbc/odbc_impl/flight_sql_statement_get_type_info.cc.

From boost/algorithm/string/join.hpp:

template< typename SequenceSequenceT, typename Range1T>
inline typename range_value<SequenceSequenceT>::type 
join(const SequenceSequenceT& Input, const Range1T& Separator)
{
    // Define working types
    typedef typename range_value<SequenceSequenceT>::type ResultT;
    typedef typename range_const_iterator<SequenceSequenceT>::type InputIteratorT;

    // Parse input
    InputIteratorT itBegin=::boost::begin(Input);
    InputIteratorT itEnd=::boost::end(Input);

    // Construct container to hold the result
    ResultT Result;
    
    // Append first element
    if(itBegin!=itEnd)
    {
        detail::insert(Result, ::boost::end(Result), *itBegin);
        ++itBegin;
    }

    for(;itBegin!=itEnd; ++itBegin)
    {
        // Add separator
        detail::insert(Result, ::boost::end(Result), ::boost::as_literal(Separator));
        // Add element
        detail::insert(Result, ::boost::end(Result), *itBegin);
    }

    return Result;
}

From cpp/src/arrow/util/string.cc:126-148:

template <typename StringLike>
static std::string JoinStringLikes(const std::vector<StringLike>& strings,
                                   std::string_view delimiter) {
  if (strings.size() == 0) {
    return "";
  }
  std::string out = std::string(strings.front());
  for (size_t i = 1; i < strings.size(); ++i) {
    out.append(delimiter.begin(), delimiter.end());
    out.append(strings[i].begin(), strings[i].end());
  }
  return out;
}

std::string JoinStrings(const std::vector<std::string>& strings,
                        std::string_view delimiter) {
  return JoinStringLikes(strings, delimiter);
}

Are these changes tested?

Yes. Existing test cases should verify the change.

Are there any user-facing changes?

No.

@HyukjinKwon HyukjinKwon changed the title [C++][FlightSQL] Replace boost::algorithm with alternatives [GH-48093][C++][FlightSQL] Replace boost::algorithm with alternatives Dec 30, 2025
@github-actions github-actions bot added the awaiting review Awaiting review label Dec 30, 2025
@github-actions
Copy link

Thanks for opening a pull request!

If this is not a minor PR. Could you open an issue for this pull request on GitHub? https://github.com/apache/arrow/issues/new/choose

Opening GitHub issues ahead of time contributes to the Openness of the Apache Arrow project.

Then could you also rename the pull request title in the following format?

GH-${GITHUB_ISSUE_ID}: [${COMPONENT}] ${SUMMARY}

or

MINOR: [${COMPONENT}] ${SUMMARY}

See also:

@HyukjinKwon HyukjinKwon changed the title [GH-48093][C++][FlightSQL] Replace boost::algorithm with alternatives GH-48093: [C++][FlightSQL] Replace boost::algorithm with alternatives Dec 30, 2025
@github-actions
Copy link

⚠️ GitHub issue #48093 has been automatically assigned in GitHub to PR creator.

@HyukjinKwon HyukjinKwon changed the title GH-48093: [C++][FlightSQL] Replace boost::algorithm with alternatives GH-48093: [C++][FlightRPC] Replace boost::algorithm with alternatives Dec 30, 2025
@github-actions
Copy link

⚠️ GitHub issue #48093 has been automatically assigned in GitHub to PR creator.

Copy link
Member

@lidavidm lidavidm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@github-actions github-actions bot added awaiting merge Awaiting merge and removed awaiting review Awaiting review labels Dec 30, 2025
@HyukjinKwon
Copy link
Member Author

R test failure should not be related to this .. I created an issue and started working on it to make it less flaky #48690

@lidavidm
Copy link
Member

I'm going to leave the ticket open since I see there are other uses of boost::algorithm in the ODBC code

@lidavidm lidavidm merged commit 37c40fb into apache:main Dec 30, 2025
47 of 49 checks passed
@lidavidm lidavidm removed the awaiting merge Awaiting merge label Dec 30, 2025
@conbench-apache-arrow
Copy link

After merging your PR, Conbench analyzed the 3 benchmarking runs that have been run so far on merge-commit 37c40fb.

There weren't enough matching historic benchmark results to make a call on whether there were regressions.

The full Conbench report has more details.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants