kou commented on code in PR #39362:
URL: https://github.com/apache/arrow/pull/39362#discussion_r1443871156
##########
cpp/src/arrow/compute/kernels/scalar_cast_dictionary.cc:
##########
@@ -77,17 +85,24 @@ Status CastToDictionary(KernelContext* ctx, const ExecSpan&
batch, ExecResult* o
return Status::OK();
}
-std::vector<std::shared_ptr<CastFunction>> GetDictionaryCasts() {
- auto func = std::make_shared<CastFunction>("cast_dictionary",
Type::DICTIONARY);
-
- AddCommonCasts(Type::DICTIONARY, kOutputTargetType, func.get());
- ScalarKernel kernel({InputType(Type::DICTIONARY)}, kOutputTargetType,
CastToDictionary);
+template <typename SrcType>
+void AddDictionaryCast(CastFunction* func) {
+ ScalarKernel kernel;
+ kernel.exec = CastToDictionary;
+ kernel.signature =
+ KernelSignature::Make({InputType(SrcType::type_id)}, kOutputTargetType);
Review Comment:
Oh. I didn't notice it.
The constructor is a shortcut of these existing codes:
https://github.com/apache/arrow/blob/1c1fa746f8d1266f9210d9c0e1bbab074c5dd4e0/cpp/src/arrow/compute/kernel.h#L496-L498
So I think the constructor is recommended.
> Would it be advisable to open a new issue for these changes if they are
recommended?
Yes, please. We can discuss there what API is recommended.
--
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]