This is an automated email from the ASF dual-hosted git repository.

philo pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-gluten.git


The following commit(s) were added to refs/heads/main by this push:
     new fc22e24e07 [VL] Minor refactor for cast expression validation (#9084)
fc22e24e07 is described below

commit fc22e24e078f1ddc29a7dfb1731ccccd2f544804
Author: PHILO-HE <ph...@apache.org>
AuthorDate: Fri Mar 21 18:15:06 2025 +0800

    [VL] Minor refactor for cast expression validation (#9084)
---
 cpp/velox/substrait/SubstraitToVeloxPlanValidator.cc | 18 ++++++------------
 1 file changed, 6 insertions(+), 12 deletions(-)

diff --git a/cpp/velox/substrait/SubstraitToVeloxPlanValidator.cc 
b/cpp/velox/substrait/SubstraitToVeloxPlanValidator.cc
index 177cb8fcee..71524472ec 100644
--- a/cpp/velox/substrait/SubstraitToVeloxPlanValidator.cc
+++ b/cpp/velox/substrait/SubstraitToVeloxPlanValidator.cc
@@ -242,32 +242,24 @@ bool SubstraitToVeloxPlanValidator::isAllowedCast(const 
TypePtr& fromType, const
   // 3. Timestamp to most categories except few supported types is not allowed.
   // 4. Certain complex types are not allowed.
 
-  auto toKind = toType->kind();
-
   // Don't support isIntervalYearMonth.
   if (fromType->isIntervalYearMonth() || toType->isIntervalYearMonth()) {
-    LOG_VALIDATION_MSG("Casting involving INTERVAL_YEAR_MONTH is not 
supported.");
     return false;
   }
 
   // Limited support for DATE to X.
   if (fromType->isDate() && !toType->isTimestamp() && !toType->isVarchar()) {
-    LOG_VALIDATION_MSG("Casting from DATE to " + toType->toString() + " is not 
supported.");
     return false;
   }
 
   // Limited support for Timestamp to X.
   if (fromType->isTimestamp() && !(toType->isDate() || toType->isVarchar())) {
-    LOG_VALIDATION_MSG(
-        "Casting from TIMESTAMP to " + toType->toString() + " is not supported 
or has incorrect result.");
     return false;
   }
 
   // Limited support for X to Timestamp.
   if (toType->isTimestamp()) {
     if (fromType->isDecimal()) {
-      // Decimal to Timestamp is not supported.
-      LOG_VALIDATION_MSG("Casting from " + fromType->toString() + " to 
TIMESTAMP is not supported.");
       return false;
     }
     if (fromType->isDate()) {
@@ -280,14 +272,15 @@ bool SubstraitToVeloxPlanValidator::isAllowedCast(const 
TypePtr& fromType, const
         fromType->isDouble() || fromType->isReal()) {
       return true;
     }
-    LOG_VALIDATION_MSG("Casting from " + fromType->toString() + " to TIMESTAMP 
is not supported.");
     return false;
   }
 
   // Limited support for Complex types.
-  if (fromType->isArray() || fromType->isMap() || fromType->isRow() ||
-      (fromType->isVarbinary() && toKind != TypeKind::VARCHAR)) {
-    LOG_VALIDATION_MSG("Casting from " + fromType->toString() + " is not 
currently supported.");
+  if (fromType->isArray() || fromType->isMap() || fromType->isRow()) {
+    return false;
+  }
+
+  if (fromType->isVarbinary() && !toType->isVarchar()) {
     return false;
   }
 
@@ -308,6 +301,7 @@ bool SubstraitToVeloxPlanValidator::validateCast(
     return true;
   }
 
+  LOG_VALIDATION_MSG("Casting from " + input->type()->toString() + " to " + 
toType->toString() + " is not supported.");
   return false;
 }
 


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@gluten.apache.org
For additional commands, e-mail: commits-h...@gluten.apache.org

Reply via email to