File tree Expand file tree Collapse file tree
core/src/main/java/org/opensearch/sql/expression/function Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -86,15 +86,11 @@ public class CoercionUtils {
8686 }
8787
8888 private static @ Nullable RexNode cast (RexBuilder builder , ExprType targetType , RexNode arg ) {
89- // Implement the logic to check if fromType can be cast to toType
90- // This could involve checking if the types are compatible, or if a cast is possible
91- // For example, you might check if fromType is a subtype of toType, or if a conversion exists
9289 ExprType argType = OpenSearchTypeFactory .convertRelDataTypeToExprType (arg .getType ());
9390 if (!argType .shouldCast (targetType )) {
9491 return arg ;
9592 }
9693
97- // If the arg is string
9894 if (WideningTypeRule .distance (argType , targetType ) != WideningTypeRule .IMPOSSIBLE_WIDENING ) {
9995 return builder .makeCast (OpenSearchTypeFactory .convertExprTypeToRelDataType (targetType ), arg );
10096 }
Original file line number Diff line number Diff line change @@ -262,6 +262,10 @@ public boolean checkOperandTypes(List<RelDataType> types) {
262262 // with strings in isComparable
263263 RelDataType type_l = types .get (i );
264264 RelDataType type_r = types .get (i + 1 );
265+ // Rule out IP types from built-in comparable functions
266+ if (type_l instanceof ExprIPType || type_r instanceof ExprIPType ) {
267+ return false ;
268+ }
265269 if (!isComparable (type_l , type_r )) {
266270 return false ;
267271 }
You can’t perform that action at this time.
0 commit comments