Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[GLUTEN-6900] Use clang-format-18 #6907

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/code_style.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: Run clang-format style check for C/C++
uses: jidicula/clang-format-action@v4.11.0
uses: jidicula/clang-format-action@v4.13.0
with:
clang-format-version: '15'
clang-format-version: '18'
check-path: ${{ matrix.path['check'] }}
fallback-style: 'Google' # optional

Expand Down
2 changes: 1 addition & 1 deletion cpp/core/jni/JniCommon.h
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ class SafeNativeArray {

private:
SafeNativeArray(JNIEnv* env, JavaArrayType javaArray, JniNativeArrayType nativeArray)
: env_(env), javaArray_(javaArray), nativeArray_(nativeArray){};
: env_(env), javaArray_(javaArray), nativeArray_(nativeArray) {};

JNIEnv* env_;
JavaArrayType javaArray_;
Expand Down
2 changes: 1 addition & 1 deletion cpp/core/utils/ObjectStore.h
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ class ObjectStore {

void release0(ResourceHandle handle);

ObjectStore(StoreHandle storeId) : storeId_(storeId){};
ObjectStore(StoreHandle storeId) : storeId_(storeId) {};
StoreHandle storeId_;
ResourceMap<std::shared_ptr<void>> store_;
std::set<ResourceHandle> aliveObjects_;
Expand Down
2 changes: 1 addition & 1 deletion cpp/core/utils/macros.h
Original file line number Diff line number Diff line change
Expand Up @@ -105,4 +105,4 @@
#define TIME_NANO_TO_STRING(time) \
(time > 1e7 ? time / 1e6 : ((time > 1e4) ? time / 1e3 : time)) << (time > 1e7 ? "ms" : (time > 1e4 ? "us" : "ns"))

#define ROUND_TO_LINE(n, round) (((n) + (round)-1) & ~((round)-1))
#define ROUND_TO_LINE(n, round) (((n) + (round) - 1) & ~((round) - 1))
4 changes: 2 additions & 2 deletions cpp/core/utils/qpl/qpl_codec.cc
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class HardwareCodecDeflateQpl {
/// RET_ERROR stands for hardware codec fail,need fallback to software codec.
static constexpr int64_t RET_ERROR = -1;

explicit HardwareCodecDeflateQpl(qpl_compression_levels compressionLevel) : compressionLevel_(compressionLevel){};
explicit HardwareCodecDeflateQpl(qpl_compression_levels compressionLevel) : compressionLevel_(compressionLevel) {};

int64_t doCompressData(const uint8_t* source, uint32_t source_size, uint8_t* dest, uint32_t dest_size) const {
uint32_t job_id;
Expand Down Expand Up @@ -99,7 +99,7 @@ class HardwareCodecDeflateQpl {

class SoftwareCodecDeflateQpl final {
public:
explicit SoftwareCodecDeflateQpl(qpl_compression_levels compressionLevel) : compressionLevel_(compressionLevel){};
explicit SoftwareCodecDeflateQpl(qpl_compression_levels compressionLevel) : compressionLevel_(compressionLevel) {};

~SoftwareCodecDeflateQpl() {
if (swJob) {
Expand Down
2 changes: 1 addition & 1 deletion cpp/velox/operators/plannodes/RowVectorStream.h
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ class ValueStreamNode final : public facebook::velox::core::PlanNode {
}

private:
void addDetails(std::stringstream& stream) const override{};
void addDetails(std::stringstream& stream) const override {};

const facebook::velox::RowTypePtr outputType_;
std::unique_ptr<RowVectorStream> valueStream_;
Expand Down
6 changes: 1 addition & 5 deletions cpp/velox/tests/VeloxShuffleWriterTest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -165,11 +165,7 @@ TEST_P(HashPartitioningShuffleWriter, hashPart1Vector) {
makeFlatVector<int32_t>(
4, [](vector_size_t row) { return row % 2; }, nullEvery(5), DATE()),
makeFlatVector<Timestamp>(
4,
[](vector_size_t row) {
return Timestamp{row % 2, 0};
},
nullEvery(5)),
4, [](vector_size_t row) { return Timestamp{row % 2, 0}; }, nullEvery(5)),
});

auto rowType = facebook::velox::asRowType(vector->type());
Expand Down
30 changes: 21 additions & 9 deletions dev/formatcppcode.sh
Original file line number Diff line number Diff line change
@@ -1,13 +1,25 @@
cd `dirname $0`

# Check if clang-format-15 is installed
if ! command -v clang-format-15 &> /dev/null
then
echo "clang-format-15 could not be found"
echo "Installing clang-format-15..."
sudo apt update
sudo apt install clang-format-15
CLANG_FORMAT_CMD=""
if [ "$(uname)" == "Darwin" ]; then
CLANG_FORMAT_CMD="clang-format"
if ! command -v $CLANG_FORMAT_CMD &> /dev/null
then
echo "$CLANG_FORMAT_CMD could not be found"
echo "Installing $CLANG_FORMAT_CMD..."
sudo brew install $CLANG_FORMAT_CMD
fi
else
CLANG_FORMAT_CMD="clang-format-18"
if ! command -v $CLANG_FORMAT_CMD &> /dev/null
then
echo "$CLANG_FORMAT_CMD could not be found"
echo "Installing $CLANG_FORMAT_CMD..."
sudo apt update
sudo apt install $CLANG_FORMAT_CMD
fi
fi
Copy link
Contributor

Choose a reason for hiding this comment

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

Let's remove the install commands here. It's only for darwin and ubuntu.


find ../cpp/core -regex '.*\.\(cc\|hpp\|cu\|c\|h\)' -exec clang-format-15 -style=file -i {} \;
find ../cpp/velox -regex '.*\.\(cc\|hpp\|cu\|c\|h\)' -exec clang-format-15 -style=file -i {} \;
echo "OS: $(uname), CLANG_FORMAT_CMD: ${CLANG_FORMAT_CMD}"
find ../cpp/core -type f \( -name "*.cc" -o -name "*.hpp" -o -name "*.cu" -o -name "*.c" -o -name "*.h" \) | xargs ${CLANG_FORMAT_CMD} -style=file -i
find ../cpp/velox -type f \( -name "*.cc" -o -name "*.hpp" -o -name "*.cu" -o -name "*.c" -o -name "*.h" \) | xargs ${CLANG_FORMAT_CMD} -style=file -i
Loading