@@ -420,13 +420,11 @@ jsonAnalyzeJsonValue(JsonAnalyzeContext *ctx, JsonValueStats *vstats,
420
420
}
421
421
422
422
/*
423
- * jsonAnalyzeJson
424
- * Parse the JSON document and build/update stats.
425
- *
426
- * XXX The name seems a bit weird, with the two json bits.
423
+ * jsonAnalyzeCollectPaths
424
+ * Parse the JSON document and collect all paths and their values.
427
425
*/
428
426
static void
429
- jsonAnalyzeJson (JsonAnalyzeContext * ctx , Jsonb * jb , void * param )
427
+ jsonAnalyzeCollectPaths (JsonAnalyzeContext * ctx , Jsonb * jb , void * param )
430
428
{
431
429
JsonbValue jv ;
432
430
JsonbIterator * it ;
@@ -513,12 +511,12 @@ jsonAnalyzeJson(JsonAnalyzeContext *ctx, Jsonb *jb, void *param)
513
511
}
514
512
515
513
/*
516
- * jsonAnalyzeJsonSubpath
517
- * ???
514
+ * jsonAnalyzeCollectSubpath
515
+ * Recursively extract trailing part of a path and collect its values.
518
516
*/
519
517
static void
520
- jsonAnalyzeJsonSubpath (JsonAnalyzeContext * ctx , JsonPathAnlStats * pstats ,
521
- JsonbValue * jbv , int n )
518
+ jsonAnalyzeCollectSubpath (JsonAnalyzeContext * ctx , JsonPathAnlStats * pstats ,
519
+ JsonbValue * jbv , int n )
522
520
{
523
521
JsonbValue scalar ;
524
522
int i ;
@@ -549,7 +547,7 @@ jsonAnalyzeJsonSubpath(JsonAnalyzeContext *ctx, JsonPathAnlStats *pstats,
549
547
while ((r = JsonbIteratorNext (& it , & elem , true)) != WJB_DONE )
550
548
{
551
549
if (r == WJB_ELEM )
552
- jsonAnalyzeJsonSubpath (ctx , pstats , & elem , i + 1 );
550
+ jsonAnalyzeCollectSubpath (ctx , pstats , & elem , i + 1 );
553
551
}
554
552
555
553
return ;
@@ -579,11 +577,11 @@ jsonAnalyzeJsonSubpath(JsonAnalyzeContext *ctx, JsonPathAnlStats *pstats,
579
577
}
580
578
581
579
/*
582
- * jsonAnalyzeJsonPath
583
- * ???
580
+ * jsonAnalyzeCollectPath
581
+ * Extract a single path from JSON documents and collect its values.
584
582
*/
585
583
static void
586
- jsonAnalyzeJsonPath (JsonAnalyzeContext * ctx , Jsonb * jb , void * param )
584
+ jsonAnalyzeCollectPath (JsonAnalyzeContext * ctx , Jsonb * jb , void * param )
587
585
{
588
586
JsonPathAnlStats * pstats = (JsonPathAnlStats * ) param ;
589
587
JsonbValue jbvtmp ;
@@ -603,7 +601,7 @@ jsonAnalyzeJsonPath(JsonAnalyzeContext *ctx, Jsonb *jb, void *param)
603
601
pstats -> entries [i ] = path ;
604
602
}
605
603
606
- jsonAnalyzeJsonSubpath (ctx , pstats , jbv , 0 );
604
+ jsonAnalyzeCollectSubpath (ctx , pstats , jbv , 0 );
607
605
}
608
606
609
607
static Datum
@@ -1219,7 +1217,7 @@ compute_json_stats(VacAttrStats *stats, AnalyzeAttrFetchFunc fetchfunc,
1219
1217
if (false)
1220
1218
{
1221
1219
/* Collect all values of all paths */
1222
- jsonAnalyzePass (& ctx , jsonAnalyzeJson , (void * )(intptr_t ) true);
1220
+ jsonAnalyzePass (& ctx , jsonAnalyzeCollectPaths , (void * )(intptr_t ) true);
1223
1221
jsonAnalyzePaths (& ctx );
1224
1222
}
1225
1223
else
@@ -1249,7 +1247,7 @@ compute_json_stats(VacAttrStats *stats, AnalyzeAttrFetchFunc fetchfunc,
1249
1247
*/
1250
1248
1251
1249
/* Collect all paths first and sort them */
1252
- jsonAnalyzePass (& ctx , jsonAnalyzeJson , (void * )(intptr_t ) false);
1250
+ jsonAnalyzePass (& ctx , jsonAnalyzeCollectPaths , (void * )(intptr_t ) false);
1253
1251
jsonAnalyzeSortPaths (& ctx );
1254
1252
1255
1253
MemoryContextReset (tmpcxt );
@@ -1261,7 +1259,7 @@ compute_json_stats(VacAttrStats *stats, AnalyzeAttrFetchFunc fetchfunc,
1261
1259
elog (DEBUG1 , "analyzing json path (%d/%d) %s" ,
1262
1260
i + 1 , ctx .npaths , path -> pathstr );
1263
1261
1264
- jsonAnalyzePass (& ctx , jsonAnalyzeJsonPath , path );
1262
+ jsonAnalyzePass (& ctx , jsonAnalyzeCollectPath , path );
1265
1263
jsonAnalyzePath (& ctx , path );
1266
1264
1267
1265
MemoryContextReset (tmpcxt );
0 commit comments