jinchengchenghh commented on code in PR #9560:
URL: https://github.com/apache/incubator-gluten/pull/9560#discussion_r2081263469
##########
cpp/velox/substrait/SubstraitToVeloxPlanValidator.cc:
##########
@@ -133,10 +133,22 @@ bool SubstraitToVeloxPlanValidator::validateRound(
// Velox has different result with Spark on negative scale.
auto typeCase = arguments[1].value().literal().literal_type_case();
switch (typeCase) {
- case ::substrait::Expression_Literal::LiteralTypeCase::kI32:
- return (arguments[1].value().literal().i32() >= 0);
- case ::substrait::Expression_Literal::LiteralTypeCase::kI64:
- return (arguments[1].value().literal().i64() >= 0);
+ case ::substrait::Expression_Literal::LiteralTypeCase::kI32: {
+ int32_t value = arguments[1].value().literal().i32();
+ if (value < 0) {
+ LOG_VALIDATION_MSG("Round scale validation failed: value " +
std::to_string(value) + " is negative.");
Review Comment:
Round scale validation failed: value -> Round scale validation failed: scale
##########
cpp/velox/substrait/SubstraitToVeloxPlanValidator.cc:
##########
@@ -133,10 +133,22 @@ bool SubstraitToVeloxPlanValidator::validateRound(
// Velox has different result with Spark on negative scale.
auto typeCase = arguments[1].value().literal().literal_type_case();
switch (typeCase) {
- case ::substrait::Expression_Literal::LiteralTypeCase::kI32:
- return (arguments[1].value().literal().i32() >= 0);
- case ::substrait::Expression_Literal::LiteralTypeCase::kI64:
- return (arguments[1].value().literal().i64() >= 0);
+ case ::substrait::Expression_Literal::LiteralTypeCase::kI32: {
+ int32_t value = arguments[1].value().literal().i32();
+ if (value < 0) {
+ LOG_VALIDATION_MSG("Round scale validation failed: value " +
std::to_string(value) + " is negative.");
+ return false;
+ }
+ return true;
+ }
+ case ::substrait::Expression_Literal::LiteralTypeCase::kI64: {
+ int64_t value = arguments[1].value().literal().i64();
+ if (value < 0) {
+ LOG_VALIDATION_MSG("Round scale validation failed: value " +
std::to_string(value) + " is negative.");
Review Comment:
ditto, value leads to misunderstanding, round(value, scale)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]