raulcd commented on code in PR #14044:
URL: https://github.com/apache/arrow/pull/14044#discussion_r963016827
##########
cpp/src/arrow/compute/cast.cc:
##########
@@ -94,7 +94,9 @@ class CastMetaFunction : public MetaFunction {
const FunctionOptions* options,
ExecContext* ctx) const override {
ARROW_ASSIGN_OR_RAISE(auto cast_options, ValidateOptions(options));
- if (args[0].type()->Equals(*cast_options->to_type)) {
+ // args[0].type() could be a nullptr so check for that before
+ // we do anything with it.
+ if (args[0].type() && args[0].type()->Equals(*cast_options->to_type)) {
Review Comment:
Should we ensure the argument is always an Array? Something like:
```
switch (args[0].kind()) {
case Datum::ARRAY:
// Implementation
break;
default:
return Status::NotImplemented("Cast arguments should be array-like");
```
--
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]