-
Notifications
You must be signed in to change notification settings - Fork 453
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_8475][VL] Fix C-style casts to C++-style #8474
base: main
Are you sure you want to change the base?
Conversation
Thanks for opening a pull request! Could you open an issue for this pull request on Github Issues? https://github.com/apache/incubator-gluten/issues Then could you also rename commit message and pull request title in the following format?
See also: |
cpp/core/memory/MemoryAllocator.cc
Outdated
@@ -161,7 +161,7 @@ bool StdMemoryAllocator::reallocateAligned(void* p, uint64_t alignment, int64_t | |||
return false; | |||
} | |||
if (newSize <= size) { | |||
auto aligned = ROUND_TO_LINE(newSize, alignment); | |||
auto aligned = ROUND_TO_LINE(static_cast<uint64_t> newSize, alignment); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this a typo?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Dont Use Cast@cpp/core/memory/MemoryAllocator.cc:164
looks like newSize
is int64_t
and alignment
is uint64_t
so i'm assuming there is some sort of casting that goes on when calling this function. With that I figured they should both go in with the same type. With the above line showing if (newSize <= 0) {return false;}
im assuming newSize will be positive if it gets to here so I just casted it to be uint64_t
like the alignment
variable
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sorry I did forget the parenthesis around newSize, updating!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see, thanks.
It seems GitHub CI service is encountering issues so the CI is not triggering BTW.
@jkhaliqi Would you fix the code style? Thanks! https://github.com/apache/incubator-gluten/actions/runs/12682962050/job/35349998150?pr=8474 |
@@ -440,7 +440,7 @@ std::shared_ptr<ColumnarBatch> VeloxSortShuffleReaderDeserializer::deserializeTo | |||
auto buffer = cur->second; | |||
const auto* rawBuffer = buffer->as<char>(); | |||
while (rowOffset_ < cur->first && readRows < batchSize_) { | |||
auto rowSize = *(RowSizeType*)(rawBuffer + byteOffset_) - sizeof(RowSizeType); | |||
auto rowSize = *(static_cast<RowSizeType*>(rawBuffer + byteOffset_)) - sizeof(RowSizeType); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a reason that you don't use this one liner for other occurrences?
In other cases you are splitting it into two lines (first the ptr and then the dereference, for example, previous file line 186ff.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No reason updating all to be one liner, thank you!
makeConstantExpr(INTEGER(), static_cast<int32_t>(678)), | ||
makeConstantExpr(BIGINT(), static_cast<int64_t>(910)), | ||
makeConstantExpr(REAL(), static_cast<float>(1.23)), | ||
makeConstantExpr(BOOLEAN(), 1), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's wrong with these but not the last double cast?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missed the last one, updated, thank you!
89fb899
to
0dd6f9d
Compare
What changes were proposed in this pull request?
False positives for Do not Cast
cpp/velox/compute/WholeStageResultIterator.cc:461
cpp/velox/compute/WholeStageResultIterator.cc:463](http://wholestageresultiterator.cc:463/)
cpp/velox/shuffle/VeloxSortShuffleWriter.cc:219
cpp/velox/tests/FunctionTest.cc:157
cpp/velox/shuffle/VeloxShuffleReader.cc:437
cpp/velox/shuffle/VeloxSortShuffleWriter.cc:347
cpp/velox/substrait/SubstraitToVeloxPlan.cc:1049
cpp/velox/substrait/SubstraitToVeloxPlan.cc:1040
cpp/velox/substrait/SubstraitToVeloxPlan.cc:1102
cpp/velox/substrait/SubstraitToVeloxPlan.cc:1095
(Please fill in changes proposed in this fix)
(Fixes: #8475)