forked from apache/arrow
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
apacheGH-35134: [C++] Add
arrow_vendored
namespace around double-co…
…nversion library (apache#35135) ### Rationale for this change See apache#35134 This change avoids potential symbol collisions when linking Arrow within other libraries. This actually seems like the original intention (a private namespace) per the following merge: 767c953 The message in that merge is confusing, because it implies that the merge made the library private, when it actually did the opposite (specifically in 3b89b19). A quote is below: > Also, make its use private, because of Windows DLL exports. ### What changes are included in this PR? * an `update.sh` script to * automatically pull a new version, * apply the namespace change, * apply a custom patch for seemingly Gandiva (15137e2) * this patch will break in future versions of double-conversion, but it is at least documented in the update script * the update script is run for the current version The script is based on: https://github.com/apache/arrow/blob/main/cpp/src/arrow/vendored/fast_float/update.sh ### Are these changes tested? Yes. Built and tests run ### Are there any user-facing changes? Only if users used to depend on using the internal vendored double-conversion libraries for their own code. In such a case, when they upgrade, they would have to specify the `arrow_vendored` namespace. * Closes: apache#35134 Authored-by: Mike Lui <mikelui@meta.com> Signed-off-by: Sutou Kouhei <kou@clear-code.com>
- Loading branch information
Showing
24 changed files
with
151 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
cpp/src/arrow/vendored/double-conversion/patches/double-conversion.cc.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
40a41,44 | ||
> #if defined(_MSC_VER) | ||
> #pragma warning(disable : 4244) | ||
> #endif | ||
> | ||
84c88,106 | ||
< if (length != 1) { | ||
--- | ||
> | ||
> /* If the mantissa of the scientific notation representation is an integer number, | ||
> * the EMIT_TRAILING_DECIMAL_POINT flag will add a '.' character at the end of the | ||
> * representation: | ||
> * - With EMIT_TRAILING_DECIMAL_POINT enabled -> 0.0009 => 9.E-4 | ||
> * - With EMIT_TRAILING_DECIMAL_POINT disabled -> 0.0009 => 9E-4 | ||
> * | ||
> * If the mantissa is an integer and the EMIT_TRAILING_ZERO_AFTER_POINT flag is enabled | ||
> * it will add a '0' character at the end of the mantissa representation. Note that that | ||
> * flag depends on EMIT_TRAILING_DECIMAL_POINT flag be enabled.*/ | ||
> if(length == 1){ | ||
> if ((flags_ & EMIT_TRAILING_DECIMAL_POINT) != 0) { | ||
> result_builder->AddCharacter('.'); | ||
> | ||
> if ((flags_ & EMIT_TRAILING_ZERO_AFTER_POINT) != 0) { | ||
> result_builder->AddCharacter('0'); | ||
> } | ||
> } | ||
> } else { |
12 changes: 12 additions & 0 deletions
12
cpp/src/arrow/vendored/double-conversion/patches/double-conversion.h.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
107a108,118 | ||
> // | ||
> // When converting numbers to scientific notation representation, if the mantissa of | ||
> // the representation is an integer number, the EMIT_TRAILING_DECIMAL_POINT flag will | ||
> // add a '.' character at the end of the representation: | ||
> // - With EMIT_TRAILING_DECIMAL_POINT enabled -> 0.0009 => 9.E-4 | ||
> // - With EMIT_TRAILING_DECIMAL_POINT disabled -> 0.0009 => 9E-4 | ||
> // | ||
> // If the mantissa is an integer and the EMIT_TRAILING_ZERO_AFTER_POINT flag is enabled | ||
> // it will add a '0' character at the end of the mantissa representation. Note that that | ||
> // flag depends on EMIT_TRAILING_DECIMAL_POINT flag be enabled. | ||
> // - With EMIT_TRAILING_ZERO_AFTER_POINT enabled -> 0.0009 => 9.0E-4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
#!/usr/bin/env bash | ||
# | ||
# Licensed to the Apache Software Foundation (ASF) under one | ||
# or more contributor license agreements. See the NOTICE file | ||
# distributed with this work for additional information | ||
# regarding copyright ownership. The ASF licenses this file | ||
# to you under the Apache License, Version 2.0 (the | ||
# "License"); you may not use this file except in compliance | ||
# with the License. You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, | ||
# software distributed under the License is distributed on an | ||
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
# KIND, either express or implied. See the License for the | ||
# specific language governing permissions and limitations | ||
# under the License. | ||
|
||
set -eu | ||
|
||
source_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" | ||
|
||
if [ "$#" -ne 1 ]; then | ||
echo "Usage: $0 VERSION" | ||
echo " e.g.: $0 3.2.1" | ||
exit 1 | ||
fi | ||
|
||
version="$1" | ||
|
||
pushd "${source_dir}" | ||
rm -rf double-conversion | ||
git clone \ | ||
--branch "v${version}" \ | ||
--depth 1 \ | ||
https://github.com//google/double-conversion.git | ||
rm *.cc *.h | ||
for f in double-conversion/double-conversion/*{.h,.cc}; do | ||
mv "${f}" ./ | ||
done | ||
rm -rf double-conversion | ||
sed -i.bak -E -e "s/v[0-9.]+/v${version}/g" *.md | ||
sed -i.bak -E \ | ||
-e '/^namespace double_conversion \{/ i\ | ||
namespace arrow_vendored {' \ | ||
-e '/^} \/\/ namespace double_conversion/ a\ | ||
} // namespace arrow_vendored' \ | ||
*.{h,cc} | ||
rm *.bak | ||
|
||
# Custom changes for Arrow | ||
patch double-conversion.cc patches/double-conversion.cc.patch | ||
patch double-conversion.h patches/double-conversion.h.patch | ||
|
||
popd |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters