This is an automated email from the ASF dual-hosted git repository. maxyang pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/cloudberry.git
commit 06d00130c5e1d12998b9d025b097e98dfb38fe50 Author: David Kimura <[email protected]> AuthorDate: Fri Sep 9 00:13:51 2022 +0000 Add HashValue function to CPartitionPropagationSpec --- .../include/gpopt/base/CPartitionPropagationSpec.h | 34 ++++++++++++++++++++-- 1 file changed, 32 insertions(+), 2 deletions(-) diff --git a/src/backend/gporca/libgpopt/include/gpopt/base/CPartitionPropagationSpec.h b/src/backend/gporca/libgpopt/include/gpopt/base/CPartitionPropagationSpec.h index e8c167bdde..077473c8aa 100644 --- a/src/backend/gporca/libgpopt/include/gpopt/base/CPartitionPropagationSpec.h +++ b/src/backend/gporca/libgpopt/include/gpopt/base/CPartitionPropagationSpec.h @@ -75,6 +75,28 @@ private: CRefCount::SafeRelease(m_filter_expr); } + // hash function + ULONG + HashValue() const + { + ULONG ulHash = m_root_rel_mdid->HashValue(); + + ulHash = + gpos::CombineHashes(ulHash, gpos::HashValue<ULONG>(&m_scan_id)); + if (m_selector_ids) + { + ulHash = gpos::CombineHashes( + ulHash, gpos::HashPtr<CBitSet>(m_selector_ids)); + } + if (m_filter_expr) + { + ulHash = gpos::CombineHashes( + ulHash, CExpression::HashValue(m_filter_expr)); + } + + return ulHash; + } + IOstream &OsPrint(IOstream &os) const; // used for determining equality in memo (e.g in optimization contexts) @@ -120,8 +142,16 @@ public: ULONG HashValue() const override { - // GPDB_12_MERGE_FIXME: Implement this, even if it's unused - GPOS_RTL_ASSERT(!"Unused"); + ULONG ulHash = 0; + + UlongToSPartPropSpecInfoMapIter hmulpi(m_part_prop_spec_infos); + while (hmulpi.Advance()) + { + const SPartPropSpecInfo *info = hmulpi.Value(); + ulHash = gpos::CombineHashes(ulHash, info->HashValue()); + } + + return ulHash; } // extract columns used by the partition propagation spec --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
