@@ -173,32 +173,27 @@ Result<compute::Expression> FromProto(const substrait::Expression& expr,
173173 " only value arguments are currently supported for functions" );
174174 }
175175 }
176-
177- if (decoded_function.name .to_string () == " alias" ) {
178- if (scalar_fn.arguments_size () != 1 ) {
179- return arrow::Status::Invalid (" Alias should have exact 1 arg, but got " +
180- std::to_string (scalar_fn.arguments_size ()));
181- }
176+
177+ return compute::call (decoded_function.name .to_string (), std::move (arguments));
178+ }
182179
183- const auto & argument = scalar_fn.arguments (0 );
184- switch (argument.arg_type_case ()) {
185- case substrait::FunctionArgument::kValue : {
186- return FromProto (argument.value (), ext_set);
187- }
188- default :
189- return Status::NotImplemented (
190- " only value arguments are currently supported for functions" );
191- }
192- }
193- if (decoded_function.name .to_string () == " is_in" ) {
194- const auto & in_list =
195- std::static_pointer_cast<ListScalar>(arguments[1 ].literal ()->scalar ());
196- auto value = in_list->value ;
197- return compute::call (
198- " is_in" , std::vector<arrow::compute::Expression>{std::move (arguments[0 ])},
199- arrow::compute::SetLookupOptions (*value));
180+ case substrait::Expression::kSingularOrList : {
181+ const auto & singular_or_list = expr.singular_or_list ();
182+ auto options = singular_or_list.options ();
183+ if (options.size () == 0 ) {
184+ return Status::NotImplemented (" At least one option is needed." );
200185 }
201- return compute::call (decoded_function.name .to_string (), std::move (arguments));
186+ compute::Expression list;
187+ // Only the first option is considered currently.
188+ ARROW_ASSIGN_OR_RAISE (list, FromProto (options[0 ], ext_set));
189+ const auto & in_list =
190+ std::static_pointer_cast<ListScalar>(list.literal ()->scalar ());
191+ auto listValue = in_list->value ;
192+ compute::Expression argument;
193+ ARROW_ASSIGN_OR_RAISE (argument, FromProto (singular_or_list.value (), ext_set));
194+ return compute::call (
195+ " is_in" , std::vector<arrow::compute::Expression>{std::move (argument)},
196+ arrow::compute::SetLookupOptions (*listValue));
202197 }
203198
204199 default :
0 commit comments