LCOV - code coverage report
Current view: top level - sql/server - rel_rewriter.h (source / functions) Hit Total Coverage
Test: coverage.info Lines: 7 7 100.0 %
Date: 2021-10-13 02:24:04 Functions: 1 1 100.0 %

          Line data    Source code
       1             : /*
       2             :  * This Source Code Form is subject to the terms of the Mozilla Public
       3             :  * License, v. 2.0.  If a copy of the MPL was not distributed with this
       4             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       5             :  *
       6             :  * Copyright 1997 - July 2008 CWI, August 2008 - 2021 MonetDB B.V.
       7             :  */
       8             : 
       9             : #ifndef _REL_REWRITER_H_
      10             : #define _REL_REWRITER_H_
      11             : 
      12             : #include "sql_relation.h"
      13             : #include "sql_mvc.h"
      14             : #include "rel_rel.h"
      15             : 
      16             : #define is_ifthenelse_func(sf) (strcmp((sf)->func->base.name, "ifthenelse") == 0)
      17             : #define is_isnull_func(sf) (strcmp((sf)->func->base.name, "isnull") == 0)
      18             : #define is_not_func(sf) (strcmp((sf)->func->base.name, "not") == 0)
      19             : #define is_caselike_func(sf) (strcmp((sf)->func->base.name, "case") == 0 || \
      20             :                           strcmp((sf)->func->base.name, "casewhen") == 0 || \
      21             :                           strcmp((sf)->func->base.name, "coalesce") == 0 || \
      22             :                           strcmp((sf)->func->base.name, "nullif") == 0)
      23             : #define is_case_func(sf) (strcmp((sf)->func->base.name, "case") == 0)
      24             : 
      25             : extern sql_exp *rewrite_simplify_exp(visitor *v, sql_rel *rel, sql_exp *e, int depth);
      26             : extern sql_rel *rewrite_simplify(visitor *v, sql_rel *rel);
      27             : 
      28             : static inline sql_rel *
      29    18390094 : try_remove_empty_select(visitor *v, sql_rel *rel)
      30             : {
      31    18390094 :         if (is_select(rel->op) && !(rel_is_ref(rel)) && list_empty(rel->exps)) {
      32       62267 :                 sql_rel *l = rel->l;
      33       62267 :                 rel->l = NULL;
      34       62267 :                 rel_destroy(rel);
      35       62267 :                 v->changes++;
      36             :                 rel = l;
      37             :         }
      38    18390094 :         return rel;
      39             : }
      40             : 
      41             : extern sql_rel *rewrite_reset_used(visitor *v, sql_rel *rel);
      42             : 
      43             : #endif /*_REL_REWRITER_H_*/

Generated by: LCOV version 1.14