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


##########
src/backend/gpopt/translate/CTranslatorDXLToPlStmt.cpp:
##########
@@ -5568,23 +5565,29 @@ CTranslatorDXLToPlStmt::TranslateDXLDirectDispatchInfo(
                return segids_list;
        }
 
-       ULONG hash_code = GetDXLDatumGPDBHash(dxl_datum_array, pRTEHashFuncCal);
+       // Each datum array is one value combination of the distribution key
+       // (e.g. one array per IN-list constant). Dispatch to the union of the
+       // segments they hash to, like the planner does.
+       List *segids_list = NIL;
        for (ULONG ul = 0; ul < length; ul++)
        {
                CDXLDatumArray *dispatch_identifier_datum_array =
                        (*dispatch_identifier_datum_arrays)[ul];
                GPOS_ASSERT(0 < dispatch_identifier_datum_array->Size());
-               ULONG hash_code_new = GetDXLDatumGPDBHash(
-                       dispatch_identifier_datum_array, pRTEHashFuncCal);
+               ULONG hash_code = 
GetDXLDatumGPDBHash(dispatch_identifier_datum_array,
+                                                                               
          pRTEHashFuncCal);
 
-               if (hash_code != hash_code_new)
-               {
-                       // values don't hash to the same segment
-                       return NIL;
-               }
+               segids_list = gpdb::LAppendUniqueInt(segids_list, hash_code);

Review Comment:
   if (gpdb::ListLength(segids_list) == m_num_of_segments) , early exit ?



-- 
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