| 293 | } |
| 294 | |
| 295 | bool Expression::IsScalarExpression() const { |
| 296 | if (auto lit = literal()) { |
| 297 | return lit->is_scalar(); |
| 298 | } |
| 299 | |
| 300 | if (field_ref()) return true; |
| 301 | |
| 302 | auto call = CallNotNull(*this); |
| 303 | |
| 304 | for (const Expression& arg : call->arguments) { |
| 305 | if (!arg.IsScalarExpression()) return false; |
| 306 | } |
| 307 | |
| 308 | if (call->function) { |
| 309 | return call->function->kind() == compute::Function::SCALAR; |
| 310 | } |
| 311 | |
| 312 | // this expression is not bound; make a best guess based on |
| 313 | // the default function registry |
| 314 | if (auto function = compute::GetFunctionRegistry() |
| 315 | ->GetFunction(call->function_name) |
| 316 | .ValueOr(nullptr)) { |
| 317 | return function->kind() == compute::Function::SCALAR; |
| 318 | } |
| 319 | |
| 320 | // unknown function or other error; conservatively return false |
| 321 | return false; |
| 322 | } |
| 323 | |
| 324 | bool Expression::IsNullLiteral() const { |
| 325 | if (auto lit = literal()) { |