LCOV - differential code coverage report
Current view: top level - src/include/optimizer - geqo_gene.h (source / functions) Coverage Total Hit UBC CBC
Current: f76c13edadc2b319036e0d238703ed56bb23f934 vs 9e17d25e79d4756be08b4a5521b4b58450217137 Lines: 87.5 % 8 7 1 7
Current Date: 2026-09-20 14:13:17 +0900 Functions: 100.0 % 2 2 2
Baseline: lcov-20260920-baseline Branches: 50.0 % 12 6 6 6
Baseline Date: 2026-09-20 14:13:13 +0900 Line coverage date bins:
Legend: Lines:     hit not hit
Branches: + taken - not taken # not executed
(1,7] days: 87.5 % 8 7 1 7
Function coverage date bins:
(1,7] days: 100.0 % 2 2 2
Branch coverage date bins:
(1,7] days: 50.0 % 12 6 6 6

 Age         Owner                    Branch data    TLA  Line data    Source code
                                  1                 :                : /*-------------------------------------------------------------------------
                                  2                 :                :  *
                                  3                 :                :  * geqo_gene.h
                                  4                 :                :  *    genome representation in optimizer/geqo
                                  5                 :                :  *
                                  6                 :                :  * Portions Copyright (c) 1996-2026, PostgreSQL Global Development Group
                                  7                 :                :  * Portions Copyright (c) 1994, Regents of the University of California
                                  8                 :                :  *
                                  9                 :                :  * src/include/optimizer/geqo_gene.h
                                 10                 :                :  *
                                 11                 :                :  *-------------------------------------------------------------------------
                                 12                 :                :  */
                                 13                 :                : 
                                 14                 :                : /*
                                 15                 :                :  * contributed by:
                                 16                 :                :  * =*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=
                                 17                 :                :  * *  Martin Utesch              * Institute of Automatic Control      *
                                 18                 :                :  * =                             = University of Mining and Technology =
                                 19                 :                :  * *  utesch@aut.tu-freiberg.de  * Freiberg, Germany                   *
                                 20                 :                :  * =*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=
                                 21                 :                :  */
                                 22                 :                : 
                                 23                 :                : 
                                 24                 :                : #ifndef GEQO_GENE_H
                                 25                 :                : #define GEQO_GENE_H
                                 26                 :                : 
                                 27                 :                : #include <float.h>
                                 28                 :                : #include <limits.h>
                                 29                 :                : 
                                 30                 :                : #include "nodes/nodes.h"
                                 31                 :                : 
                                 32                 :                : /*
                                 33                 :                :  * we presume that int instead of Relid
                                 34                 :                :  * is o.k. for Gene; so don't change it!
                                 35                 :                :  */
                                 36                 :                : typedef int Gene;
                                 37                 :                : 
                                 38                 :                : /*
                                 39                 :                :  * Fitness of a candidate join order.
                                 40                 :                :  *
                                 41                 :                :  * A tour for which no valid plan could be constructed is represented by
                                 42                 :                :  * disabled_nodes = INT_MAX and cost = DBL_MAX.
                                 43                 :                :  */
                                 44                 :                : typedef struct Fitness
                                 45                 :                : {
                                 46                 :                :     int         disabled_nodes;
                                 47                 :                :     Cost        cost;
                                 48                 :                : } Fitness;
                                 49                 :                : 
                                 50                 :                : /*
                                 51                 :                :  * Is this a valid tour?
                                 52                 :                :  */
                                 53                 :                : static inline bool
    3 rhaas@postgresql.org       54                 :CBC        1820 : fitness_is_valid(Fitness fitness)
                                 55                 :                : {
                                 56   [ -  +  -  - ]:           1820 :     return fitness.disabled_nodes < INT_MAX || fitness.cost < DBL_MAX;
                                 57                 :                : }
                                 58                 :                : 
                                 59                 :                : /*
                                 60                 :                :  * Which fitness is better?
                                 61                 :                :  */
                                 62                 :                : static inline int
                                 63                 :           5512 : fitness_compare(Fitness fitness1, Fitness fitness2)
                                 64                 :                : {
                                 65         [ +  + ]:           5512 :     if (fitness1.disabled_nodes != fitness2.disabled_nodes)
                                 66         [ +  + ]:            122 :         return fitness1.disabled_nodes < fitness2.disabled_nodes ? -1 : 1;
                                 67         [ -  + ]:           5390 :     if (fitness1.cost != fitness2.cost)
    3 rhaas@postgresql.org       68         [ #  # ]:UBC           0 :         return fitness1.cost < fitness2.cost ? -1 : 1;
    3 rhaas@postgresql.org       69                 :CBC        5390 :     return 0;
                                 70                 :                : }
                                 71                 :                : 
                                 72                 :                : typedef struct Chromosome
                                 73                 :                : {
                                 74                 :                :     Gene       *string;
                                 75                 :                :     Fitness     worth;
                                 76                 :                : } Chromosome;
                                 77                 :                : 
                                 78                 :                : typedef struct Pool
                                 79                 :                : {
                                 80                 :                :     Chromosome *data;
                                 81                 :                :     int         size;
                                 82                 :                :     int         string_length;
                                 83                 :                : } Pool;
                                 84                 :                : 
                                 85                 :                : #endif                          /* GEQO_GENE_H */
        

Generated by: LCOV version 2.0-1