gfphoenix78 commented on code in PR #1333:
URL: https://github.com/apache/cloudberry/pull/1333#discussion_r2424407754
##########
src/include/nodes/execnodes.h:
##########
@@ -2230,7 +2230,7 @@ typedef struct DynamicSeqScanState
Bitmapset *as_valid_subplans; /* used to determine partitions during
dynamic pruning*/
bool did_pruning; /* flag that is set once dynamic pruning
is performed */
- /* runtime filter support */
+ /* runtime filter support */
Review Comment:
trailing spaces should be removed.
##########
contrib/pax_storage/src/cpp/storage/micro_partition_row_filter_reader.cc:
##########
@@ -73,6 +75,95 @@ MicroPartitionRowFilterReader::GetNextGroup(TupleDesc desc) {
return group_;
}
+void MicroPartitionRowFilterReader::LoadExprFilterColumns(
+ MicroPartitionReader::Group *group, TupleDesc desc,
+ const ExecutionFilterContext *ctx, size_t row_index, TupleTableSlot *slot)
{
+ for (int i = 0; i < ctx->size; i++) {
+ auto attno = ctx->attnos[i];
+ Assert(attno > 0);
+ std::tie(slot->tts_values[attno - 1], slot->tts_isnull[attno - 1]) =
+ group->GetColumnValue(desc, attno - 1, row_index);
+ }
+}
Review Comment:
Will the same column value be fetched multiple times and add additional
runtime cost?
##########
contrib/pax_storage/src/cpp/storage/micro_partition_row_filter_reader.cc:
##########
@@ -73,6 +75,95 @@ MicroPartitionRowFilterReader::GetNextGroup(TupleDesc desc) {
return group_;
}
+void MicroPartitionRowFilterReader::LoadExprFilterColumns(
+ MicroPartitionReader::Group *group, TupleDesc desc,
+ const ExecutionFilterContext *ctx, size_t row_index, TupleTableSlot *slot)
{
+ for (int i = 0; i < ctx->size; i++) {
+ auto attno = ctx->attnos[i];
+ Assert(attno > 0);
+ std::tie(slot->tts_values[attno - 1], slot->tts_isnull[attno - 1]) =
+ group->GetColumnValue(desc, attno - 1, row_index);
+ }
+}
+
+bool MicroPartitionRowFilterReader::EvalBloomNode(
+ const ExecutionFilterContext *ctx, MicroPartitionReader::Group *group,
+ TupleDesc desc, size_t row_index, int bloom_index) {
+ Assert(bloom_index >= 0 &&
+ (size_t)bloom_index < ctx->runtime_bloom_keys.size());
+ const auto &skd = ctx->runtime_bloom_keys[bloom_index];
+ const ScanKey sk = const_cast<ScanKeyData *>(&skd);
+ bool isnull = false;
+ Datum val;
+ std::tie(val, isnull) =
+ group->GetColumnValue(desc, sk->sk_attno - 1, row_index);
+ if (isnull) return true;
+ bloom_filter *bf = (bloom_filter *)DatumGetPointer(sk->sk_argument);
+ return !bloom_lacks_element(bf, (unsigned char *)&val, sizeof(Datum));
+}
+
+bool MicroPartitionRowFilterReader::EvalExprNode(
+ const ExecutionFilterContext *ctx, TupleTableSlot *slot, int expr_index) {
+ return TestRowScanInternal(slot, ctx->estates[expr_index],
+ ctx->attnos[expr_index]);
+}
+
+bool MicroPartitionRowFilterReader::EvalFilterNode(
Review Comment:
Please add comment about this function, especially on the return value.
--
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]