MCPcopy Create free account
hub / github.com/apache/arrow / HandleInconsistentTypes

Function HandleInconsistentTypes

cpp/src/arrow/compute/expression.cc:1035–1054  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1033}
1034
1035Result<Expression> HandleInconsistentTypes(Expression::Call call,
1036 compute::ExecContext* exec_context) {
1037 // ARROW-18334: due to reordering of arguments, the call may have
1038 // inconsistent argument types. For example, the call's kernel may
1039 // correspond to `timestamp + duration` but the arguments happen to
1040 // be `duration, timestamp`. The addition itself is still commutative,
1041 // but the mismatch in declared argument types is potentially problematic
1042 // if we ever start using the Expression::Call::kernel field more than
1043 // we do currently. Check and rebind if necessary.
1044 //
1045 // The more correct fix for this problem is to ensure that all kernels of
1046 // functions which are commutative be commutative as well, which would
1047 // obviate rebinding like this. In the context of ARROW-18334, this
1048 // would require rewriting KernelSignature so that a single kernel can
1049 // handle both `timestamp + duration` and `duration + timestamp`.
1050 if (call.kernel->signature->MatchesInputs(GetTypes(call.arguments))) {
1051 return Expression(std::move(call));
1052 }
1053 return BindNonRecursive(std::move(call), /*insert_implicit_casts=*/false, exec_context);
1054}
1055
1056} // namespace
1057

Callers 1

CanonicalizeFunction · 0.85

Calls 4

BindNonRecursiveFunction · 0.85
MatchesInputsMethod · 0.80
GetTypesFunction · 0.70
ExpressionClass · 0.70

Tested by

no test coverage detected