← Back to Overview

src/backend/commands/explain.c

Coverage: 182/187 lines (97.3%)
Total Lines
187
modified
Covered
182
97.3%
Uncovered
5
2.7%
Keyboard navigation
append_rpr_quantifier() lines 2916-2948
Modified Lines Coverage: 23/23 lines (100.0%)
LineHitsSourceCommit
2916 3028 append_rpr_quantifier(StringInfo buf, RPRPatternElement *elem) 24cfb8dRow pattern recognition patch (executor and commands).
2917 - { 24cfb8dRow pattern recognition patch (executor and commands).
2918 - /* Append quantifier if not {1,1} */ 24cfb8dRow pattern recognition patch (executor and commands).
2919 3028 if (elem->min == 0 && elem->max == RPR_QUANTITY_INF) 24cfb8dRow pattern recognition patch (executor and commands).
2920 56 appendStringInfoChar(buf, '*'); 24cfb8dRow pattern recognition patch (executor and commands).
2921 2972 else if (elem->min == 1 && elem->max == RPR_QUANTITY_INF) 24cfb8dRow pattern recognition patch (executor and commands).
2922 652 appendStringInfoChar(buf, '+'); 24cfb8dRow pattern recognition patch (executor and commands).
2923 2320 else if (elem->min == 0 && elem->max == 1) 24cfb8dRow pattern recognition patch (executor and commands).
2924 36 appendStringInfoChar(buf, '?'); 24cfb8dRow pattern recognition patch (executor and commands).
2925 2284 else if (elem->max == RPR_QUANTITY_INF) 24cfb8dRow pattern recognition patch (executor and commands).
2926 140 appendStringInfo(buf, "{%d,}", elem->min); 24cfb8dRow pattern recognition patch (executor and commands).
2927 2144 else if (elem->min == elem->max && elem->min != 1) 24cfb8dRow pattern recognition patch (executor and commands).
2928 176 appendStringInfo(buf, "{%d}", elem->min); 24cfb8dRow pattern recognition patch (executor and commands).
2929 1968 else if (elem->min != 1 || elem->max != 1) 24cfb8dRow pattern recognition patch (executor and commands).
2930 88 appendStringInfo(buf, "{%d,%d}", elem->min, elem->max); 24cfb8dRow pattern recognition patch (executor and commands).
2931 - 24cfb8dRow pattern recognition patch (executor and commands).
2932 3028 if (RPRElemIsReluctant(elem)) 24cfb8dRow pattern recognition patch (executor and commands).
2933 - { 24cfb8dRow pattern recognition patch (executor and commands).
2934 44 if (elem->min == 1 && elem->max == 1) 24cfb8dRow pattern recognition patch (executor and commands).
2935 4 appendStringInfoString(buf, "{1}"); /* make reluctant ? 24cfb8dRow pattern recognition patch (executor and commands).
2936 - * unambiguous */ 24cfb8dRow pattern recognition patch (executor and commands).
2937 44 appendStringInfoChar(buf, '?'); 24cfb8dRow pattern recognition patch (executor and commands).
2938 - } 24cfb8dRow pattern recognition patch (executor and commands).
2939 - 24cfb8dRow pattern recognition patch (executor and commands).
2940 - /* Append absorption markers: " for comparison point, ' for branch only */ 0bc60efRename absorption "judgment point" to "comparison point" in comments
2941 3028 if (RPRElemIsAbsorbable(elem)) 24cfb8dRow pattern recognition patch (executor and commands).
2942 - { 24cfb8dRow pattern recognition patch (executor and commands).
2943 452 Assert(elem->max == RPR_QUANTITY_INF); 24cfb8dRow pattern recognition patch (executor and commands).
2944 452 appendStringInfoChar(buf, '"'); 24cfb8dRow pattern recognition patch (executor and commands).
2945 - } 24cfb8dRow pattern recognition patch (executor and commands).
2946 2576 else if (RPRElemIsAbsorbableBranch(elem)) 24cfb8dRow pattern recognition patch (executor and commands).
2947 352 appendStringInfoChar(buf, '\''); 24cfb8dRow pattern recognition patch (executor and commands).
2948 3028 } 24cfb8dRow pattern recognition patch (executor and commands).
deparse_rpr_pattern() lines 2983-2992
Modified Lines Coverage: 6/6 lines (100.0%)
LineHitsSourceCommit
2983 1064 deparse_rpr_pattern(RPRPattern *pattern) 24cfb8dRow pattern recognition patch (executor and commands).
2984 - { 24cfb8dRow pattern recognition patch (executor and commands).
2985 1064 StringInfoData buf; 24cfb8dRow pattern recognition patch (executor and commands).
2986 - 24cfb8dRow pattern recognition patch (executor and commands).
2987 1064 Assert(pattern != NULL && pattern->numElements >= 2); 24cfb8dRow pattern recognition patch (executor and commands).
2988 - 24cfb8dRow pattern recognition patch (executor and commands).
2989 1064 initStringInfo(&buf); 24cfb8dRow pattern recognition patch (executor and commands).
2990 1064 deparse_rpr_seq(pattern, 0, pattern->numElements, &buf); 24cfb8dRow pattern recognition patch (executor and commands).
2991 1064 return buf.data; 24cfb8dRow pattern recognition patch (executor and commands).
2992 - } 24cfb8dRow pattern recognition patch (executor and commands).
deparse_rpr_seq() lines 3001-3014
Modified Lines Coverage: 9/9 lines (100.0%)
LineHitsSourceCommit
3001 2192 deparse_rpr_seq(RPRPattern *pattern, int start, int limit, StringInfo buf) 24cfb8dRow pattern recognition patch (executor and commands).
3002 - { 24cfb8dRow pattern recognition patch (executor and commands).
3003 2192 int i = start; 24cfb8dRow pattern recognition patch (executor and commands).
3004 2192 bool first = true; 24cfb8dRow pattern recognition patch (executor and commands).
3005 - 24cfb8dRow pattern recognition patch (executor and commands).
3006 5496 while (i < limit && !RPRElemIsFin(&pattern->elements[i])) 24cfb8dRow pattern recognition patch (executor and commands).
3007 - { 24cfb8dRow pattern recognition patch (executor and commands).
3008 3304 if (!first) 24cfb8dRow pattern recognition patch (executor and commands).
3009 1112 appendStringInfoChar(buf, ' '); 24cfb8dRow pattern recognition patch (executor and commands).
3010 3304 first = false; 24cfb8dRow pattern recognition patch (executor and commands).
3011 3304 i = deparse_rpr_node(pattern, i, limit, buf); 24cfb8dRow pattern recognition patch (executor and commands).
3012 - } 24cfb8dRow pattern recognition patch (executor and commands).
3013 2192 return i; 24cfb8dRow pattern recognition patch (executor and commands).
3014 - } 24cfb8dRow pattern recognition patch (executor and commands).
deparse_rpr_node() lines 3029-3090
Modified Lines Coverage: 37/37 lines (100.0%)
LineHitsSourceCommit
3029 3392 deparse_rpr_node(RPRPattern *pattern, int idx, int limit, StringInfo buf) 0e23c67Rename loop index variables in row pattern deparse helpers
3030 - { 24cfb8dRow pattern recognition patch (executor and commands).
3031 3392 RPRPatternElement *elem = &pattern->elements[idx]; 0e23c67Rename loop index variables in row pattern deparse helpers
3032 - 24cfb8dRow pattern recognition patch (executor and commands).
3033 3392 if (RPRElemIsVar(elem)) 24cfb8dRow pattern recognition patch (executor and commands).
3034 - { 24cfb8dRow pattern recognition patch (executor and commands).
3035 2596 Assert(elem->varId < pattern->numVars); 24cfb8dRow pattern recognition patch (executor and commands).
3036 2596 appendStringInfoString(buf, 24cfb8dRow pattern recognition patch (executor and commands).
3037 2596 quote_identifier(pattern->varNames[elem->varId])); 24cfb8dRow pattern recognition patch (executor and commands).
3038 2596 append_rpr_quantifier(buf, elem); 24cfb8dRow pattern recognition patch (executor and commands).
3039 2596 return idx + 1; 0e23c67Rename loop index variables in row pattern deparse helpers
3040 - } 24cfb8dRow pattern recognition patch (executor and commands).
3041 - 24cfb8dRow pattern recognition patch (executor and commands).
3042 796 if (RPRElemIsBegin(elem)) 24cfb8dRow pattern recognition patch (executor and commands).
3043 - { 24cfb8dRow pattern recognition patch (executor and commands).
3044 432 int end = rpr_match_end(pattern, idx); 0e23c67Rename loop index variables in row pattern deparse helpers
3045 432 bool loneAlt; 24cfb8dRow pattern recognition patch (executor and commands).
3046 - 24cfb8dRow pattern recognition patch (executor and commands).
3047 1296 loneAlt = (idx + 1 < end && 0e23c67Rename loop index variables in row pattern deparse helpers
3048 528 RPRElemIsAlt(&pattern->elements[idx + 1]) && 0e23c67Rename loop index variables in row pattern deparse helpers
3049 96 rpr_alt_scope_end(pattern, idx + 1) == end); 0e23c67Rename loop index variables in row pattern deparse helpers
3050 - 24cfb8dRow pattern recognition patch (executor and commands).
3051 432 if (loneAlt) 24cfb8dRow pattern recognition patch (executor and commands).
3052 - { 24cfb8dRow pattern recognition patch (executor and commands).
3053 - /* The ALT child already parenthesizes the whole group body. */ 24cfb8dRow pattern recognition patch (executor and commands).
3054 88 (void) deparse_rpr_node(pattern, idx + 1, end, buf); 0e23c67Rename loop index variables in row pattern deparse helpers
3055 - } 24cfb8dRow pattern recognition patch (executor and commands).
3056 - else 24cfb8dRow pattern recognition patch (executor and commands).
3057 - { 24cfb8dRow pattern recognition patch (executor and commands).
3058 344 appendStringInfoChar(buf, '('); 24cfb8dRow pattern recognition patch (executor and commands).
3059 344 (void) deparse_rpr_seq(pattern, idx + 1, end, buf); 0e23c67Rename loop index variables in row pattern deparse helpers
3060 344 appendStringInfoChar(buf, ')'); 24cfb8dRow pattern recognition patch (executor and commands).
3061 - } 24cfb8dRow pattern recognition patch (executor and commands).
3062 432 append_rpr_quantifier(buf, &pattern->elements[end]); 24cfb8dRow pattern recognition patch (executor and commands).
3063 432 return end + 1; 24cfb8dRow pattern recognition patch (executor and commands).
3064 - } 24cfb8dRow pattern recognition patch (executor and commands).
3065 - 24cfb8dRow pattern recognition patch (executor and commands).
3066 364 Assert(RPRElemIsAlt(elem)); 24cfb8dRow pattern recognition patch (executor and commands).
3067 - { 24cfb8dRow pattern recognition patch (executor and commands).
3068 364 int altEnd = rpr_alt_scope_end(pattern, idx); 0e23c67Rename loop index variables in row pattern deparse helpers
3069 364 int b; 24cfb8dRow pattern recognition patch (executor and commands).
3070 364 bool first = true; 24cfb8dRow pattern recognition patch (executor and commands).
3071 - 24cfb8dRow pattern recognition patch (executor and commands).
3072 - /* an alternation's depth-derived scope end never exceeds the limit */ 5afabadAdd row pattern recognition coverage tests and tidy unreachable code
3073 364 Assert(altEnd <= limit); 5afabadAdd row pattern recognition coverage tests and tidy unreachable code
3074 - 24cfb8dRow pattern recognition patch (executor and commands).
3075 364 appendStringInfoChar(buf, '('); 24cfb8dRow pattern recognition patch (executor and commands).
3076 364 b = idx + 1; 0e23c67Rename loop index variables in row pattern deparse helpers
3077 1148 while (b < altEnd) 24cfb8dRow pattern recognition patch (executor and commands).
3078 - { 24cfb8dRow pattern recognition patch (executor and commands).
3079 784 int nb = rpr_next_branch(pattern, b, altEnd); 24cfb8dRow pattern recognition patch (executor and commands).
3080 - 24cfb8dRow pattern recognition patch (executor and commands).
3081 784 if (!first) 24cfb8dRow pattern recognition patch (executor and commands).
3082 420 appendStringInfoString(buf, " | "); 24cfb8dRow pattern recognition patch (executor and commands).
3083 784 first = false; 24cfb8dRow pattern recognition patch (executor and commands).
3084 784 (void) deparse_rpr_seq(pattern, b, nb, buf); 24cfb8dRow pattern recognition patch (executor and commands).
3085 784 b = nb; 24cfb8dRow pattern recognition patch (executor and commands).
3086 - } 24cfb8dRow pattern recognition patch (executor and commands).
3087 364 appendStringInfoChar(buf, ')'); 24cfb8dRow pattern recognition patch (executor and commands).
3088 364 return altEnd; 24cfb8dRow pattern recognition patch (executor and commands).
3089 - } 24cfb8dRow pattern recognition patch (executor and commands).
3090 - } 24cfb8dRow pattern recognition patch (executor and commands).
rpr_match_end() lines 3097-3110
Modified Lines Coverage: 7/8 lines (87.5%)
LineHitsSourceCommit
3097 432 rpr_match_end(RPRPattern *pattern, int beginIdx) 24cfb8dRow pattern recognition patch (executor and commands).
3098 - { 24cfb8dRow pattern recognition patch (executor and commands).
3099 432 RPRDepth d = pattern->elements[beginIdx].depth; 24cfb8dRow pattern recognition patch (executor and commands).
3100 432 int i; 0e23c67Rename loop index variables in row pattern deparse helpers
3101 - 24cfb8dRow pattern recognition patch (executor and commands).
3102 1564 for (i = beginIdx + 1; i < pattern->numElements; i++) 0e23c67Rename loop index variables in row pattern deparse helpers
3103 - { 24cfb8dRow pattern recognition patch (executor and commands).
3104 1564 RPRPatternElement *e = &pattern->elements[i]; 0e23c67Rename loop index variables in row pattern deparse helpers
3105 - 24cfb8dRow pattern recognition patch (executor and commands).
3106 1564 if (RPRElemIsEnd(e) && e->depth == d) 24cfb8dRow pattern recognition patch (executor and commands).
3107 432 return i; 0e23c67Rename loop index variables in row pattern deparse helpers
3108 - } 24cfb8dRow pattern recognition patch (executor and commands).
3109 0 pg_unreachable(); /* a BEGIN always has a matching END */ 24cfb8dRow pattern recognition patch (executor and commands).
3110 - } 24cfb8dRow pattern recognition patch (executor and commands).
rpr_alt_scope_end() lines 3119-3130
Modified Lines Coverage: 5/5 lines (100.0%)
LineHitsSourceCommit
3119 460 rpr_alt_scope_end(RPRPattern *pattern, int idx) 0e23c67Rename loop index variables in row pattern deparse helpers
3120 - { 24cfb8dRow pattern recognition patch (executor and commands).
3121 460 RPRDepth d = pattern->elements[idx].depth; 0e23c67Rename loop index variables in row pattern deparse helpers
3122 460 int i; 0e23c67Rename loop index variables in row pattern deparse helpers
3123 - 24cfb8dRow pattern recognition patch (executor and commands).
3124 2176 for (i = idx + 1; i < pattern->numElements; i++) 0e23c67Rename loop index variables in row pattern deparse helpers
3125 - { 24cfb8dRow pattern recognition patch (executor and commands).
3126 2176 if (pattern->elements[i].depth <= d) 0e23c67Rename loop index variables in row pattern deparse helpers
3127 - return i; 0e23c67Rename loop index variables in row pattern deparse helpers
3128 - } 24cfb8dRow pattern recognition patch (executor and commands).
3129 - return pattern->numElements; 24cfb8dRow pattern recognition patch (executor and commands).
3130 - } 24cfb8dRow pattern recognition patch (executor and commands).
rpr_next_branch() lines 3143-3151
Modified Lines Coverage: 5/5 lines (100.0%)
LineHitsSourceCommit
3143 784 rpr_next_branch(RPRPattern *pattern, int bno, int altEnd) 0e23c67Rename loop index variables in row pattern deparse helpers
3144 - { 24cfb8dRow pattern recognition patch (executor and commands).
3145 784 int j = pattern->elements[bno].jump; 0e23c67Rename loop index variables in row pattern deparse helpers
3146 - 24cfb8dRow pattern recognition patch (executor and commands).
3147 784 if (j != RPR_ELEMIDX_INVALID && j < altEnd && 24cfb8dRow pattern recognition patch (executor and commands).
3148 424 pattern->elements[j - 1].next != j) 24cfb8dRow pattern recognition patch (executor and commands).
3149 420 return j; 24cfb8dRow pattern recognition patch (executor and commands).
3150 - return altEnd; 24cfb8dRow pattern recognition patch (executor and commands).
3151 - } 24cfb8dRow pattern recognition patch (executor and commands).
show_window_def() lines 3157-3281
Modified Lines Coverage: 28/32 lines (87.5%)
LineHitsSourceCommit
3157 - show_window_def(WindowAggState *planstate, List *ancestors, ExplainState *es) -
3158 - { -
3159 - WindowAgg *wagg = (WindowAgg *) planstate->ss.ps.plan; -
3160 - StringInfoData wbuf; -
3161 - bool needspace = false; -
3162 - -
3163 - initStringInfo(&wbuf); -
3164 - appendStringInfo(&wbuf, "%s AS (", quote_identifier(wagg->winname)); -
3165 - -
3166 - /* The key columns refer to the tlist of the child plan */ -
3167 - ancestors = lcons(wagg, ancestors); -
3168 - if (wagg->partNumCols > 0) -
3169 - { -
3170 - appendStringInfoString(&wbuf, "PARTITION BY "); -
3171 - show_window_keys(&wbuf, outerPlanState(planstate), -
3172 - wagg->partNumCols, wagg->partColIdx, -
3173 - ancestors, es); -
3174 - needspace = true; -
3175 - } -
3176 - if (wagg->ordNumCols > 0) -
3177 - { -
3178 - if (needspace) -
3179 - appendStringInfoChar(&wbuf, ' '); -
3180 - appendStringInfoString(&wbuf, "ORDER BY "); -
3181 - show_window_keys(&wbuf, outerPlanState(planstate), -
3182 - wagg->ordNumCols, wagg->ordColIdx, -
3183 - ancestors, es); -
3184 - needspace = true; -
3185 - } -
3186 - ancestors = list_delete_first(ancestors); -
3187 - if (wagg->frameOptions & FRAMEOPTION_NONDEFAULT) -
3188 - { -
3189 - List *context; -
3190 - bool useprefix; -
3191 - char *framestr; -
3192 - -
3193 - /* Set up deparsing context for possible frame expressions */ -
3194 - context = set_deparse_context_plan(es->deparse_cxt, -
3195 - (Plan *) wagg, -
3196 - ancestors); -
3197 - useprefix = (es->rtable_size > 1 || es->verbose); -
3198 - framestr = get_window_frame_options_for_explain(wagg->frameOptions, -
3199 - wagg->startOffset, -
3200 - wagg->endOffset, -
3201 - context, -
3202 - useprefix); -
3203 - if (needspace) -
3204 - appendStringInfoChar(&wbuf, ' '); -
3205 - appendStringInfoString(&wbuf, framestr); -
3206 - pfree(framestr); -
3207 - } -
3208 - appendStringInfoChar(&wbuf, ')'); -
3209 - ExplainPropertyText("Window", wbuf.data, es); -
3210 - pfree(wbuf.data); -
3211 - 24cfb8dRow pattern recognition patch (executor and commands).
3212 - /* Show Row Pattern Recognition pattern if present */ 24cfb8dRow pattern recognition patch (executor and commands).
3213 1416 if (wagg->rpPattern != NULL) 24cfb8dRow pattern recognition patch (executor and commands).
3214 - { 24cfb8dRow pattern recognition patch (executor and commands).
3215 1064 RPRNavOffsetKind maxKind = wagg->navMaxOffsetKind; b848408Tidy up row pattern recognition plumbing
3216 1064 int64 maxOffset = wagg->navMaxOffset; b848408Tidy up row pattern recognition plumbing
3217 1064 RPRNavOffsetKind firstKind = wagg->navFirstOffsetKind; b848408Tidy up row pattern recognition plumbing
3218 1064 int64 firstOffset = wagg->navFirstOffset; b848408Tidy up row pattern recognition plumbing
3219 - b848408Tidy up row pattern recognition plumbing
3220 1064 char *patternStr = deparse_rpr_pattern(wagg->rpPattern); 24cfb8dRow pattern recognition patch (executor and commands).
3221 - 24cfb8dRow pattern recognition patch (executor and commands).
3222 1064 ExplainPropertyText("Pattern", patternStr, es); b848408Tidy up row pattern recognition plumbing
3223 - b848408Tidy up row pattern recognition plumbing
3224 1064 pfree(patternStr); b848408Tidy up row pattern recognition plumbing
3225 - 24cfb8dRow pattern recognition patch (executor and commands).
3226 - /* 24cfb8dRow pattern recognition patch (executor and commands).
3227 - * Show navigation offsets for tuplestore trim. For EXPLAIN ANALYZE, 24cfb8dRow pattern recognition patch (executor and commands).
3228 - * use the executor-resolved values (which may differ from the plan 24cfb8dRow pattern recognition patch (executor and commands).
3229 - * when NEEDS_EVAL was resolved to FIXED or RETAIN_ALL at init). 24cfb8dRow pattern recognition patch (executor and commands).
3230 - */ 24cfb8dRow pattern recognition patch (executor and commands).
3231 1064 if (es->analyze) b848408Tidy up row pattern recognition plumbing
3232 - { 24cfb8dRow pattern recognition patch (executor and commands).
3233 500 maxKind = planstate->navMaxOffsetKind; b848408Tidy up row pattern recognition plumbing
3234 500 maxOffset = planstate->navMaxOffset; b848408Tidy up row pattern recognition plumbing
3235 500 firstKind = planstate->navFirstOffsetKind; b848408Tidy up row pattern recognition plumbing
3236 500 firstOffset = planstate->navFirstOffset; b848408Tidy up row pattern recognition plumbing
3237 - } b848408Tidy up row pattern recognition plumbing
3238 - 24cfb8dRow pattern recognition patch (executor and commands).
3239 1064 switch (maxKind) b848408Tidy up row pattern recognition plumbing
3240 - { b848408Tidy up row pattern recognition plumbing
3241 12 case RPR_NAV_OFFSET_NEEDS_EVAL: b848408Tidy up row pattern recognition plumbing
3242 12 ExplainPropertyText("Nav Mark Lookback", "runtime", es); b848408Tidy up row pattern recognition plumbing
3243 - break; b848408Tidy up row pattern recognition plumbing
3244 8 case RPR_NAV_OFFSET_RETAIN_ALL: b848408Tidy up row pattern recognition plumbing
3245 8 ExplainPropertyText("Nav Mark Lookback", "retain all", es); b848408Tidy up row pattern recognition plumbing
3246 - break; b848408Tidy up row pattern recognition plumbing
3247 1044 case RPR_NAV_OFFSET_FIXED: b848408Tidy up row pattern recognition plumbing
3248 1044 ExplainPropertyInteger("Nav Mark Lookback", NULL, b848408Tidy up row pattern recognition plumbing
3249 - maxOffset, es); b848408Tidy up row pattern recognition plumbing
3250 - break; b848408Tidy up row pattern recognition plumbing
3251 0 default: b848408Tidy up row pattern recognition plumbing
3252 0 elog(ERROR, "unrecognized RPR nav offset kind: %d", b848408Tidy up row pattern recognition plumbing
3253 - maxKind); b848408Tidy up row pattern recognition plumbing
3254 - break; b848408Tidy up row pattern recognition plumbing
3255 - } b848408Tidy up row pattern recognition plumbing
3256 - 24cfb8dRow pattern recognition patch (executor and commands).
3257 1064 if (wagg->hasFirstNav) b848408Tidy up row pattern recognition plumbing
3258 - { b848408Tidy up row pattern recognition plumbing
3259 32 switch (firstKind) b848408Tidy up row pattern recognition plumbing
3260 - { 24cfb8dRow pattern recognition patch (executor and commands).
3261 4 case RPR_NAV_OFFSET_NEEDS_EVAL: 24cfb8dRow pattern recognition patch (executor and commands).
3262 4 ExplainPropertyText("Nav Mark Lookahead", "runtime", b848408Tidy up row pattern recognition plumbing
3263 - es); b848408Tidy up row pattern recognition plumbing
3264 - break; 24cfb8dRow pattern recognition patch (executor and commands).
3265 28 case RPR_NAV_OFFSET_FIXED: 24cfb8dRow pattern recognition patch (executor and commands).
3266 28 if (firstOffset == PG_INT64_MAX) b848408Tidy up row pattern recognition plumbing
3267 8 ExplainPropertyText("Nav Mark Lookahead", "infinite", b848408Tidy up row pattern recognition plumbing
3268 - es); b848408Tidy up row pattern recognition plumbing
3269 - else b848408Tidy up row pattern recognition plumbing
3270 20 ExplainPropertyInteger("Nav Mark Lookahead", NULL, b848408Tidy up row pattern recognition plumbing
3271 - firstOffset, es); b848408Tidy up row pattern recognition plumbing
3272 - break; 24cfb8dRow pattern recognition patch (executor and commands).
3273 0 default: 24cfb8dRow pattern recognition patch (executor and commands).
3274 - /* RPR_NAV_OFFSET_RETAIN_ALL is lookback-only, never here */ 5afabadAdd row pattern recognition coverage tests and tidy unreachable code
3275 0 elog(ERROR, "unrecognized RPR nav offset kind: %d", 24cfb8dRow pattern recognition patch (executor and commands).
3276 - firstKind); b848408Tidy up row pattern recognition plumbing
3277 - break; 24cfb8dRow pattern recognition patch (executor and commands).
3278 - } 24cfb8dRow pattern recognition patch (executor and commands).
3279 - } 24cfb8dRow pattern recognition patch (executor and commands).
3280 - } 24cfb8dRow pattern recognition patch (executor and commands).
3281 - } -
show_windowagg_info() lines 3829-3850
Modified Lines Coverage: 3/3 lines (100.0%)
LineHitsSourceCommit
3829 - show_windowagg_info(WindowAggState *winstate, ExplainState *es) -
3830 - { -
3831 - char *maxStorageType; -
3832 - int64 maxSpaceUsed; -
3833 1416 WindowAgg *wagg = (WindowAgg *) winstate->ss.ps.plan; 24cfb8dRow pattern recognition patch (executor and commands).
3834 - -
3835 - Tuplestorestate *tupstore = winstate->buffer; -
3836 - -
3837 - /* -
3838 - * Nothing to show if ANALYZE option wasn't used or if execution didn't -
3839 - * get as far as creating the tuplestore. -
3840 - */ -
3841 - if (!es->analyze || tupstore == NULL) -
3842 - return; -
3843 - -
3844 - tuplestore_get_stats(tupstore, &maxStorageType, &maxSpaceUsed); -
3845 - show_storage_info(maxStorageType, maxSpaceUsed, es); -
3846 - 24cfb8dRow pattern recognition patch (executor and commands).
3847 - /* Show NFA statistics for Row Pattern Recognition */ 24cfb8dRow pattern recognition patch (executor and commands).
3848 508 if (wagg->rpPattern != NULL) 24cfb8dRow pattern recognition patch (executor and commands).
3849 496 show_rpr_nfa_stats(winstate, es); 24cfb8dRow pattern recognition patch (executor and commands).
3850 - } 24cfb8dRow pattern recognition patch (executor and commands).
show_rpr_nfa_stats() lines 3856-4000
Modified Lines Coverage: 59/59 lines (100.0%)
LineHitsSourceCommit
3856 496 show_rpr_nfa_stats(WindowAggState *winstate, ExplainState *es) 24cfb8dRow pattern recognition patch (executor and commands).
3857 - { 24cfb8dRow pattern recognition patch (executor and commands).
3858 496 if (es->format != EXPLAIN_FORMAT_TEXT) 24cfb8dRow pattern recognition patch (executor and commands).
3859 - { 24cfb8dRow pattern recognition patch (executor and commands).
3860 - /* State and context counters */ 24cfb8dRow pattern recognition patch (executor and commands).
3861 20 ExplainPropertyInteger("NFA States Peak", NULL, winstate->nfaStatesMax, es); 24cfb8dRow pattern recognition patch (executor and commands).
3862 20 ExplainPropertyInteger("NFA States Total", NULL, winstate->nfaStatesTotalCreated, es); 24cfb8dRow pattern recognition patch (executor and commands).
3863 20 ExplainPropertyInteger("NFA States Merged", NULL, winstate->nfaStatesMerged, es); 24cfb8dRow pattern recognition patch (executor and commands).
3864 20 ExplainPropertyInteger("NFA Contexts Peak", NULL, winstate->nfaContextsMax, es); 24cfb8dRow pattern recognition patch (executor and commands).
3865 20 ExplainPropertyInteger("NFA Contexts Total", NULL, winstate->nfaContextsTotalCreated, es); 24cfb8dRow pattern recognition patch (executor and commands).
3866 20 ExplainPropertyInteger("NFA Contexts Absorbed", NULL, winstate->nfaContextsAbsorbed, es); 24cfb8dRow pattern recognition patch (executor and commands).
3867 20 ExplainPropertyInteger("NFA Contexts Skipped", NULL, winstate->nfaContextsSkipped, es); 24cfb8dRow pattern recognition patch (executor and commands).
3868 20 ExplainPropertyInteger("NFA Contexts Pruned", NULL, winstate->nfaContextsPruned, es); 24cfb8dRow pattern recognition patch (executor and commands).
3869 - 24cfb8dRow pattern recognition patch (executor and commands).
3870 - /* Match/mismatch counts and length statistics */ 24cfb8dRow pattern recognition patch (executor and commands).
3871 20 ExplainPropertyInteger("NFA Matched", NULL, winstate->nfaMatchesSucceeded, es); 24cfb8dRow pattern recognition patch (executor and commands).
3872 20 ExplainPropertyInteger("NFA Mismatched", NULL, winstate->nfaMatchesFailed, es); 24cfb8dRow pattern recognition patch (executor and commands).
3873 20 if (winstate->nfaMatchesSucceeded > 0) 24cfb8dRow pattern recognition patch (executor and commands).
3874 - { 24cfb8dRow pattern recognition patch (executor and commands).
3875 20 ExplainPropertyInteger("NFA Match Length Min", NULL, winstate->nfaMatchLen.min, es); 24cfb8dRow pattern recognition patch (executor and commands).
3876 20 ExplainPropertyInteger("NFA Match Length Max", NULL, winstate->nfaMatchLen.max, es); 24cfb8dRow pattern recognition patch (executor and commands).
3877 20 ExplainPropertyFloat("NFA Match Length Avg", NULL, 24cfb8dRow pattern recognition patch (executor and commands).
3878 20 (double) winstate->nfaMatchLen.total / winstate->nfaMatchesSucceeded, 1, 24cfb8dRow pattern recognition patch (executor and commands).
3879 - es); 24cfb8dRow pattern recognition patch (executor and commands).
3880 - } 24cfb8dRow pattern recognition patch (executor and commands).
3881 20 if (winstate->nfaMatchesFailed > 0) 24cfb8dRow pattern recognition patch (executor and commands).
3882 - { 24cfb8dRow pattern recognition patch (executor and commands).
3883 8 ExplainPropertyInteger("NFA Mismatch Length Min", NULL, winstate->nfaFailLen.min, es); 24cfb8dRow pattern recognition patch (executor and commands).
3884 8 ExplainPropertyInteger("NFA Mismatch Length Max", NULL, winstate->nfaFailLen.max, es); 24cfb8dRow pattern recognition patch (executor and commands).
3885 8 ExplainPropertyFloat("NFA Mismatch Length Avg", NULL, 24cfb8dRow pattern recognition patch (executor and commands).
3886 8 (double) winstate->nfaFailLen.total / winstate->nfaMatchesFailed, 1, 24cfb8dRow pattern recognition patch (executor and commands).
3887 - es); 24cfb8dRow pattern recognition patch (executor and commands).
3888 - } 24cfb8dRow pattern recognition patch (executor and commands).
3889 - 24cfb8dRow pattern recognition patch (executor and commands).
3890 - /* Absorbed/skipped context length statistics */ 24cfb8dRow pattern recognition patch (executor and commands).
3891 20 if (winstate->nfaContextsAbsorbed > 0) 24cfb8dRow pattern recognition patch (executor and commands).
3892 - { 24cfb8dRow pattern recognition patch (executor and commands).
3893 4 ExplainPropertyInteger("NFA Absorbed Length Min", NULL, winstate->nfaAbsorbedLen.min, es); 24cfb8dRow pattern recognition patch (executor and commands).
3894 4 ExplainPropertyInteger("NFA Absorbed Length Max", NULL, winstate->nfaAbsorbedLen.max, es); 24cfb8dRow pattern recognition patch (executor and commands).
3895 4 ExplainPropertyFloat("NFA Absorbed Length Avg", NULL, 24cfb8dRow pattern recognition patch (executor and commands).
3896 4 (double) winstate->nfaAbsorbedLen.total / winstate->nfaContextsAbsorbed, 1, 24cfb8dRow pattern recognition patch (executor and commands).
3897 - es); 24cfb8dRow pattern recognition patch (executor and commands).
3898 - } 24cfb8dRow pattern recognition patch (executor and commands).
3899 20 if (winstate->nfaContextsSkipped > 0) 24cfb8dRow pattern recognition patch (executor and commands).
3900 - { 24cfb8dRow pattern recognition patch (executor and commands).
3901 20 ExplainPropertyInteger("NFA Skipped Length Min", NULL, winstate->nfaSkippedLen.min, es); 24cfb8dRow pattern recognition patch (executor and commands).
3902 20 ExplainPropertyInteger("NFA Skipped Length Max", NULL, winstate->nfaSkippedLen.max, es); 24cfb8dRow pattern recognition patch (executor and commands).
3903 20 ExplainPropertyFloat("NFA Skipped Length Avg", NULL, 24cfb8dRow pattern recognition patch (executor and commands).
3904 20 (double) winstate->nfaSkippedLen.total / winstate->nfaContextsSkipped, 1, 24cfb8dRow pattern recognition patch (executor and commands).
3905 - es); 24cfb8dRow pattern recognition patch (executor and commands).
3906 - } 24cfb8dRow pattern recognition patch (executor and commands).
3907 - } 24cfb8dRow pattern recognition patch (executor and commands).
3908 - else 24cfb8dRow pattern recognition patch (executor and commands).
3909 - { 24cfb8dRow pattern recognition patch (executor and commands).
3910 - /* State and context counters */ 24cfb8dRow pattern recognition patch (executor and commands).
3911 476 ExplainIndentText(es); 24cfb8dRow pattern recognition patch (executor and commands).
3912 476 appendStringInfo(es->str, 24cfb8dRow pattern recognition patch (executor and commands).
3913 - "NFA States: " INT64_FORMAT " peak, " INT64_FORMAT " total, " INT64_FORMAT " merged\n", 24cfb8dRow pattern recognition patch (executor and commands).
3914 - winstate->nfaStatesMax, 24cfb8dRow pattern recognition patch (executor and commands).
3915 - winstate->nfaStatesTotalCreated, 24cfb8dRow pattern recognition patch (executor and commands).
3916 - winstate->nfaStatesMerged); 24cfb8dRow pattern recognition patch (executor and commands).
3917 476 ExplainIndentText(es); 24cfb8dRow pattern recognition patch (executor and commands).
3918 476 appendStringInfo(es->str, 24cfb8dRow pattern recognition patch (executor and commands).
3919 - "NFA Contexts: " INT64_FORMAT " peak, " INT64_FORMAT " total, " INT64_FORMAT " pruned\n", 24cfb8dRow pattern recognition patch (executor and commands).
3920 - winstate->nfaContextsMax, 24cfb8dRow pattern recognition patch (executor and commands).
3921 - winstate->nfaContextsTotalCreated, 24cfb8dRow pattern recognition patch (executor and commands).
3922 - winstate->nfaContextsPruned); 24cfb8dRow pattern recognition patch (executor and commands).
3923 - 24cfb8dRow pattern recognition patch (executor and commands).
3924 - /* Match/mismatch counts with length min/max/avg */ 24cfb8dRow pattern recognition patch (executor and commands).
3925 476 ExplainIndentText(es); 24cfb8dRow pattern recognition patch (executor and commands).
3926 476 appendStringInfoString(es->str, "NFA: "); 24cfb8dRow pattern recognition patch (executor and commands).
3927 476 if (winstate->nfaMatchesSucceeded > 0) 24cfb8dRow pattern recognition patch (executor and commands).
3928 - { 24cfb8dRow pattern recognition patch (executor and commands).
3929 448 double avgLen = (double) winstate->nfaMatchLen.total / winstate->nfaMatchesSucceeded; 24cfb8dRow pattern recognition patch (executor and commands).
3930 - 24cfb8dRow pattern recognition patch (executor and commands).
3931 448 appendStringInfo(es->str, 24cfb8dRow pattern recognition patch (executor and commands).
3932 - INT64_FORMAT " matched (len " INT64_FORMAT "/" INT64_FORMAT "/%.1f)", 24cfb8dRow pattern recognition patch (executor and commands).
3933 - winstate->nfaMatchesSucceeded, 24cfb8dRow pattern recognition patch (executor and commands).
3934 - winstate->nfaMatchLen.min, 24cfb8dRow pattern recognition patch (executor and commands).
3935 - winstate->nfaMatchLen.max, 24cfb8dRow pattern recognition patch (executor and commands).
3936 - avgLen); 24cfb8dRow pattern recognition patch (executor and commands).
3937 - } 24cfb8dRow pattern recognition patch (executor and commands).
3938 - else 24cfb8dRow pattern recognition patch (executor and commands).
3939 - { 24cfb8dRow pattern recognition patch (executor and commands).
3940 28 appendStringInfoString(es->str, "0 matched"); 24cfb8dRow pattern recognition patch (executor and commands).
3941 - } 24cfb8dRow pattern recognition patch (executor and commands).
3942 476 if (winstate->nfaMatchesFailed > 0) 24cfb8dRow pattern recognition patch (executor and commands).
3943 - { 24cfb8dRow pattern recognition patch (executor and commands).
3944 140 double avgFail = (double) winstate->nfaFailLen.total / winstate->nfaMatchesFailed; 24cfb8dRow pattern recognition patch (executor and commands).
3945 - 24cfb8dRow pattern recognition patch (executor and commands).
3946 140 appendStringInfo(es->str, 24cfb8dRow pattern recognition patch (executor and commands).
3947 - ", " INT64_FORMAT " mismatched (len " INT64_FORMAT "/" INT64_FORMAT "/%.1f)", 24cfb8dRow pattern recognition patch (executor and commands).
3948 - winstate->nfaMatchesFailed, 24cfb8dRow pattern recognition patch (executor and commands).
3949 - winstate->nfaFailLen.min, 24cfb8dRow pattern recognition patch (executor and commands).
3950 - winstate->nfaFailLen.max, 24cfb8dRow pattern recognition patch (executor and commands).
3951 - avgFail); 24cfb8dRow pattern recognition patch (executor and commands).
3952 - } 24cfb8dRow pattern recognition patch (executor and commands).
3953 - else 24cfb8dRow pattern recognition patch (executor and commands).
3954 - { 24cfb8dRow pattern recognition patch (executor and commands).
3955 336 appendStringInfoString(es->str, ", 0 mismatched"); 24cfb8dRow pattern recognition patch (executor and commands).
3956 - } 24cfb8dRow pattern recognition patch (executor and commands).
3957 476 appendStringInfoChar(es->str, '\n'); 24cfb8dRow pattern recognition patch (executor and commands).
3958 - 24cfb8dRow pattern recognition patch (executor and commands).
3959 - /* Absorbed/skipped context length statistics */ 24cfb8dRow pattern recognition patch (executor and commands).
3960 476 if (winstate->nfaContextsAbsorbed > 0 || winstate->nfaContextsSkipped > 0) 24cfb8dRow pattern recognition patch (executor and commands).
3961 - { 24cfb8dRow pattern recognition patch (executor and commands).
3962 380 ExplainIndentText(es); 24cfb8dRow pattern recognition patch (executor and commands).
3963 380 appendStringInfoString(es->str, "NFA: "); 24cfb8dRow pattern recognition patch (executor and commands).
3964 - 24cfb8dRow pattern recognition patch (executor and commands).
3965 380 if (winstate->nfaContextsAbsorbed > 0) 24cfb8dRow pattern recognition patch (executor and commands).
3966 - { 24cfb8dRow pattern recognition patch (executor and commands).
3967 148 double avgAbsorbed = (double) winstate->nfaAbsorbedLen.total / winstate->nfaContextsAbsorbed; 24cfb8dRow pattern recognition patch (executor and commands).
3968 - 24cfb8dRow pattern recognition patch (executor and commands).
3969 148 appendStringInfo(es->str, 24cfb8dRow pattern recognition patch (executor and commands).
3970 - INT64_FORMAT " absorbed (len " INT64_FORMAT "/" INT64_FORMAT "/%.1f)", 24cfb8dRow pattern recognition patch (executor and commands).
3971 - winstate->nfaContextsAbsorbed, 24cfb8dRow pattern recognition patch (executor and commands).
3972 - winstate->nfaAbsorbedLen.min, 24cfb8dRow pattern recognition patch (executor and commands).
3973 - winstate->nfaAbsorbedLen.max, 24cfb8dRow pattern recognition patch (executor and commands).
3974 - avgAbsorbed); 24cfb8dRow pattern recognition patch (executor and commands).
3975 - } 24cfb8dRow pattern recognition patch (executor and commands).
3976 - else 24cfb8dRow pattern recognition patch (executor and commands).
3977 - { 24cfb8dRow pattern recognition patch (executor and commands).
3978 232 appendStringInfoString(es->str, "0 absorbed"); 24cfb8dRow pattern recognition patch (executor and commands).
3979 - } 24cfb8dRow pattern recognition patch (executor and commands).
3980 - 24cfb8dRow pattern recognition patch (executor and commands).
3981 380 if (winstate->nfaContextsSkipped > 0) 24cfb8dRow pattern recognition patch (executor and commands).
3982 - { 24cfb8dRow pattern recognition patch (executor and commands).
3983 364 double avgSkipped = (double) winstate->nfaSkippedLen.total / winstate->nfaContextsSkipped; 24cfb8dRow pattern recognition patch (executor and commands).
3984 - 24cfb8dRow pattern recognition patch (executor and commands).
3985 364 appendStringInfo(es->str, 24cfb8dRow pattern recognition patch (executor and commands).
3986 - ", " INT64_FORMAT " skipped (len " INT64_FORMAT "/" INT64_FORMAT "/%.1f)", 24cfb8dRow pattern recognition patch (executor and commands).
3987 - winstate->nfaContextsSkipped, 24cfb8dRow pattern recognition patch (executor and commands).
3988 - winstate->nfaSkippedLen.min, 24cfb8dRow pattern recognition patch (executor and commands).
3989 - winstate->nfaSkippedLen.max, 24cfb8dRow pattern recognition patch (executor and commands).
3990 - avgSkipped); 24cfb8dRow pattern recognition patch (executor and commands).
3991 - } 24cfb8dRow pattern recognition patch (executor and commands).
3992 - else 24cfb8dRow pattern recognition patch (executor and commands).
3993 - { 24cfb8dRow pattern recognition patch (executor and commands).
3994 16 appendStringInfoString(es->str, ", 0 skipped"); 24cfb8dRow pattern recognition patch (executor and commands).
3995 - } 24cfb8dRow pattern recognition patch (executor and commands).
3996 - 24cfb8dRow pattern recognition patch (executor and commands).
3997 380 appendStringInfoChar(es->str, '\n'); 24cfb8dRow pattern recognition patch (executor and commands).
3998 - } 24cfb8dRow pattern recognition patch (executor and commands).
3999 - } 24cfb8dRow pattern recognition patch (executor and commands).
4000 - } -