milesgranger commented on code in PR #14106:
URL: https://github.com/apache/arrow/pull/14106#discussion_r983135184
##########
cpp/src/arrow/compute/kernels/scalar_cast_extension.cc:
##########
@@ -42,14 +42,17 @@ Status CastToExtension(KernelContext* ctx, const ExecSpan&
batch, ExecResult* ou
std::shared_ptr<CastFunction> GetCastToExtension(std::string name) {
auto func = std::make_shared<CastFunction>(std::move(name), Type::EXTENSION);
- for (auto types : {IntTypes(), FloatingPointTypes(), StringTypes(),
BinaryTypes()}) {
+ for (auto types : {PrimitiveTypes(), IntervalTypes(), TemporalTypes()}) {
for (auto in_ty : types) {
DCHECK_OK(
func->AddKernel(in_ty->id(), {in_ty}, kOutputTargetType,
CastToExtension));
}
}
- DCHECK_OK(func->AddKernel(Type::DICTIONARY, {InputType(Type::DICTIONARY)},
- kOutputTargetType, CastToExtension));
+ for (auto in_ty : {Type::DICTIONARY, Type::LIST, Type::LARGE_LIST,
+ Type::FIXED_SIZE_LIST, Type::EXTENSION}) {
Review Comment:
Okay. Given what we discussed earlier;
~https://github.com/apache/arrow/pull/14106/commits/02013e8623d5cb5c0eabebc0668477fd3f06b950
makes it such that casting between extension types where storage types don't
match will fail, while giving a tip on how to more explicitly accomplish the
same objective.~
Edit:
https://github.com/apache/arrow/pull/14106/commits/da66bf423e97e40d9c7c5316427a9f000061c36f
adjusts that so only if array input type matches target storage type, will it
work.
--
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]