@@ -355,11 +355,15 @@ analyze_rel_internal(Oid relid, RangeVar *relation,
355
355
onerel -> rd_rel -> relkind == RELKIND_MATVIEW ||
356
356
onerel -> rd_rel -> relkind == RELKIND_DIRECTORY_TABLE )
357
357
{
358
+ /* Regular table, so we'll use the regular row acquisition function */
359
+ if (onerel -> rd_tableam )
360
+ acquirefunc = onerel -> rd_tableam -> relation_acquire_sample_rows ;
358
361
/*
359
362
* If the TableAmRoutine's gp_acquire_sample_rows_func if NULL, we use
360
363
* gp_acquire_sample_rows_func as default.
361
364
*/
362
- acquirefunc = gp_acquire_sample_rows_func ;
365
+ if (acquirefunc == NULL )
366
+ acquirefunc = gp_acquire_sample_rows_func ;
363
367
364
368
/* Also get regular table's size */
365
369
relpages = AcquireNumberOfBlocks (onerel );
@@ -2079,8 +2083,16 @@ acquire_inherited_sample_rows(Relation onerel, int elevel,
2079
2083
childrel -> rd_rel -> relkind == RELKIND_MATVIEW ||
2080
2084
childrel -> rd_rel -> relkind == RELKIND_DIRECTORY_TABLE )
2081
2085
{
2082
- /* use relation_acquire_sample_rows as default. */
2083
- acquirefunc = gp_acquire_sample_rows_func ;
2086
+ /* Regular table, so use the regular row acquisition function */
2087
+ if (childrel -> rd_tableam )
2088
+ acquirefunc = childrel -> rd_tableam -> relation_acquire_sample_rows ;
2089
+
2090
+ /*
2091
+ * If the TableAmRoutine's relation_acquire_sample_rows if NULL, we use
2092
+ * relation_acquire_sample_rows as default.
2093
+ */
2094
+ if (acquirefunc == NULL )
2095
+ acquirefunc = gp_acquire_sample_rows_func ;
2084
2096
2085
2097
relpages = AcquireNumberOfBlocks (childrel );
2086
2098
}
0 commit comments