ArnavBalyan commented on code in PR #8743:
URL: https://github.com/apache/incubator-gluten/pull/8743#discussion_r1979008816
##########
cpp/velox/substrait/SubstraitToVeloxPlanValidator.cc:
##########
@@ -240,59 +240,69 @@ bool
SubstraitToVeloxPlanValidator::validateScalarFunction(
return true;
}
-bool SubstraitToVeloxPlanValidator::validateCast(
- const ::substrait::Expression::Cast& castExpr,
- const RowTypePtr& inputType) {
- if (!validateExpression(castExpr.input(), inputType)) {
+bool SubstraitToVeloxPlanValidator::isAllowedCast(const TypePtr& fromType,
const TypePtr& toType) {
+ // Currently cast is not allowed for various categories, code has a bunch of
rules
+ // which define the cast categories and if we should offload to velox.
Currently
+ // the following categories are denied.
+ //
+ // 1. from/to isIntervalYearMonth is not allowed.
+ // 2. Date to most categories except few supported types is not allowed.
+ // 3. Timestamp to most categories except few supported types is not allowed.
+ // 4. Certain complex types are not allowed.
+
+ TypeKind fromKind = fromType->kind();
+ TypeKind toKind = toType->kind();
+
+ static const std::unordered_set<TypeKind> complexTypeList = {
+ TypeKind::ARRAY, TypeKind::MAP, TypeKind::ROW, TypeKind::VARBINARY};
+
+ // Don't support isIntervalYearMonth.
+ if (fromType->isIntervalYearMonth() || toType->isIntervalYearMonth()) {
+ LOG_VALIDATION_MSG("Casting involving INTERVAL_YEAR_MONTH is not
supported.");
return false;
}
- const auto& toType = SubstraitParser::parseType(castExpr.type());
- core::TypedExprPtr input = exprConverter_->toVeloxExpr(castExpr.input(),
inputType);
+ // Limited support for DATE to X.
+ if (fromType->isDate() && toKind != TypeKind::TIMESTAMP && toKind !=
TypeKind::VARCHAR) {
Review Comment:
Yes agreed, currently we don't have as many cast conditions, I am adding
some more casts, I'll explore this once the new casts are added
--
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]