llama90 commented on code in PR #39362:
URL: https://github.com/apache/arrow/pull/39362#discussion_r1443869238
##########
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:
I have made changes and identified the following code snippets. Is it
recommended to use the `ScalarKernel()` constructor?
https://github.com/apache/arrow/blob/1c1fa746f8d1266f9210d9c0e1bbab074c5dd4e0/cpp/src/arrow/compute/kernels/scalar_cast_nested.cc#L148-L151
https://github.com/apache/arrow/blob/1c1fa746f8d1266f9210d9c0e1bbab074c5dd4e0/cpp/src/arrow/compute/kernels/scalar_cast_temporal.cc#L495-L497
...
Would it be advisable to open a new issue for these changes if they are
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]