yjhjstz commented on code in PR #1398:
URL: https://github.com/apache/cloudberry/pull/1398#discussion_r2448769677


##########
src/backend/gpopt/translate/CTranslatorRelcacheToDXL.cpp:
##########
@@ -618,14 +617,31 @@ CTranslatorRelcacheToDXL::RetrieveRel(CMemoryPool *mp, 
CMDAccessor *md_accessor,
                        CMDIdGPDB(IMDId::EmdidGeneral, 
gpdb::GetForeignServerId(oid));
        }
 
-       md_rel = GPOS_NEW(mp) CMDRelationGPDB(
+       CMDRelationGPDB *md_rel_gpdb = GPOS_NEW(mp) CMDRelationGPDB(
                mp, mdid, mdname, is_temporary, rel_storage_type, dist,
                mdcol_array, distr_cols, distr_op_families, part_keys, 
part_types,
                partition_oids, convert_hash_to_random, keyset_array,
                md_index_info_array, check_constraint_mdids, mdpart_constraint,
                foreign_server_mdid, rel->rd_rel->reltuples);
 
-       return md_rel;
+       // Set segment file count for AO/AOCO tables
+       // Skip partitioned tables as they don't have physical storage (only 
leaf partitions do)
+       if ((rel_storage_type == IMDRelation::ErelstorageAppendOnlyRows ||
+                rel_storage_type == IMDRelation::ErelstorageAppendOnlyCols) &&
+               rel->rd_rel->relkind != RELKIND_PARTITIONED_TABLE)
+       {
+               INT seg_file_count = 
gpdb::GetAppendOnlySegmentFilesCount(rel.get());

Review Comment:
   default is -1,  and with rel_storage_type judge



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to