zhangyue-hashdata commented on code in PR #724:
URL: https://github.com/apache/cloudberry/pull/724#discussion_r2017870102


##########
src/backend/executor/nodeSeqscan.c:
##########
@@ -365,3 +398,60 @@ ExecSeqScanInitializeWorker(SeqScanState *node,
        }
        node->ss.ss_currentScanDesc = scandesc;
 }
+
+/*
+ * Returns true if the element may be in the bloom filter.
+ */
+static bool
+PassByBloomFilter(SeqScanState *node, TupleTableSlot *slot)
+{
+       ScanKey sk;
+       Datum   val;
+       bool    isnull;
+       ListCell *lc;
+       bloom_filter *blm_filter;
+
+       foreach (lc, node->filters)
+       {
+               sk = lfirst(lc);
+               if (sk->sk_flags != SK_BLOOM_FILTER)
+                       continue;
+
+               val = slot_getattr(slot, sk->sk_attno, &isnull);
+               if (isnull)
+                       continue;
+
+               blm_filter = (bloom_filter *)DatumGetPointer(sk->sk_argument);
+               if (bloom_lacks_element(blm_filter, (unsigned char *)&val, 
sizeof(Datum)))
+                       return false;
+       }
+
+       return true;
+}
+
+/*
+ * Convert the list of ScanKey to the array, and append an emtpy ScanKey as
+ * the end flag of the array.
+ */
+static ScanKey
+ScanKeyListToArray(List *keys, int *num)
+{
+       ScanKey sk;
+
+       if (list_length(keys) == 0)
+               return NULL;
+
+       Assert(num);
+       *num = list_length(keys);
+
+       sk = (ScanKey)palloc(sizeof(ScanKeyData) * (*num + 1));
+       for (int i = 0; i < *num; ++i)
+               memcpy(&sk[i], list_nth(keys, i), sizeof(ScanKeyData));
+
+       /*
+        * SK_EMPYT means the end of the array of the ScanKey
+        */
+       sk[*num].sk_flags = SK_EMPYT;

Review Comment:
   Currently, there are no tables in CBDB that support runtime filter pushdown 
to AM. So runtime filter pushdown to AM will not be supported temporarily, and 
filtering operations can be performed only in SeqScan.



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