| 325 | } |
| 326 | |
| 327 | bool ScalarExpr::ShouldCodegen(const FragmentState* state) const { |
| 328 | // Use the interpreted path and call the builtin without codegen if any of the |
| 329 | // followings is true: |
| 330 | // 1. The expression does not have an associated RuntimeState, e.g. is a partition |
| 331 | // key expression in a descriptor table. |
| 332 | // 2. codegen is disabled by query option. |
| 333 | // 3. there is an optimization hint to disable codegen and the expr can be interpreted. |
| 334 | // 4. Optimizer decided to disable codegen. Example: const expressions in VALUES() |
| 335 | // which are evaluated only once. |
| 336 | return state != nullptr && !state->CodegenDisabledByQueryOption() |
| 337 | && !((state->CodegenHasDisableHint() || is_codegen_disabled_) && IsInterpretable()); |
| 338 | } |
| 339 | |
| 340 | int ScalarExpr::GetSlotIds(vector<SlotId>* slot_ids) const { |
| 341 | int n = 0; |