Skip to content

Commit 3c4d25e

Browse files
committed
format
1 parent f741922 commit 3c4d25e

2 files changed

Lines changed: 49 additions & 55 deletions

File tree

be/src/exec/runtime_filter/runtime_filter_consumer.cpp

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -193,10 +193,9 @@ Status RuntimeFilterConsumer::_get_push_exprs(std::vector<VRuntimeFilterPtr>& co
193193
auto bloom_pred = VBloomPredicate::create_shared(node);
194194
bloom_pred->set_filter(_wrapper->bloom_filter_func());
195195
bloom_pred->add_child(probe_ctx->root());
196-
auto wrapper = VRuntimeFilterWrapper::create_shared(node, bloom_pred,
197-
get_bloom_filter_ignore_thredhold(),
198-
null_aware, _wrapper->filter_id(),
199-
sampling_frequency);
196+
auto wrapper = VRuntimeFilterWrapper::create_shared(
197+
node, bloom_pred, get_bloom_filter_ignore_thredhold(), null_aware,
198+
_wrapper->filter_id(), sampling_frequency);
200199
container.push_back(wrapper);
201200
break;
202201
}
@@ -215,9 +214,8 @@ Status RuntimeFilterConsumer::_get_push_exprs(std::vector<VRuntimeFilterPtr>& co
215214
if (null_aware) {
216215
return Status::InternalError("bitmap predicate do not support null aware");
217216
}
218-
auto wrapper = VRuntimeFilterWrapper::create_shared(node, bitmap_pred, 0, null_aware,
219-
_wrapper->filter_id(),
220-
sampling_frequency);
217+
auto wrapper = VRuntimeFilterWrapper::create_shared(
218+
node, bitmap_pred, 0, null_aware, _wrapper->filter_id(), sampling_frequency);
221219
container.push_back(wrapper);
222220
break;
223221
}

be/test/exec/runtime_filter/vruntimefilter_wrapper_sampling_test.cpp

Lines changed: 44 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -44,15 +44,14 @@ class StubVExpr : public VExpr {
4444

4545
private:
4646
static TExprNode make_texpr_node() {
47-
return TExprNodeBuilder(
48-
TExprNodeType::SLOT_REF,
49-
TTypeDescBuilder()
50-
.set_types(TTypeNodeBuilder()
51-
.set_type(TTypeNodeType::SCALAR)
52-
.set_scalar_type(TPrimitiveType::INT)
53-
.build())
54-
.build(),
55-
0)
47+
return TExprNodeBuilder(TExprNodeType::SLOT_REF,
48+
TTypeDescBuilder()
49+
.set_types(TTypeNodeBuilder()
50+
.set_type(TTypeNodeType::SCALAR)
51+
.set_scalar_type(TPrimitiveType::INT)
52+
.build())
53+
.build(),
54+
0)
5655
.build();
5756
}
5857
};
@@ -65,15 +64,14 @@ class VRuntimeFilterWrapperSamplingTest : public RuntimeFilterTest {};
6564
// VExprContext via VExprContext::create_shared(expr).
6665
TEST_F(VRuntimeFilterWrapperSamplingTest, open_propagates_sampling_frequency) {
6766
auto stub = std::make_shared<StubVExpr>();
68-
auto node = TExprNodeBuilder(
69-
TExprNodeType::SLOT_REF,
70-
TTypeDescBuilder()
71-
.set_types(TTypeNodeBuilder()
72-
.set_type(TTypeNodeType::SCALAR)
73-
.set_scalar_type(TPrimitiveType::INT)
74-
.build())
75-
.build(),
76-
0)
67+
auto node = TExprNodeBuilder(TExprNodeType::SLOT_REF,
68+
TTypeDescBuilder()
69+
.set_types(TTypeNodeBuilder()
70+
.set_type(TTypeNodeType::SCALAR)
71+
.set_scalar_type(TPrimitiveType::INT)
72+
.build())
73+
.build(),
74+
0)
7775
.build();
7876

7977
const int expected_frequency = 32;
@@ -87,9 +85,9 @@ TEST_F(VRuntimeFilterWrapperSamplingTest, open_propagates_sampling_frequency) {
8785

8886
RowDescriptor row_desc;
8987
ASSERT_TRUE(wrapper->prepare(_runtime_states[0].get(), row_desc, context.get()).ok());
90-
ASSERT_TRUE(wrapper->open(_runtime_states[0].get(), context.get(),
91-
FunctionContext::FRAGMENT_LOCAL)
92-
.ok());
88+
ASSERT_TRUE(
89+
wrapper->open(_runtime_states[0].get(), context.get(), FunctionContext::FRAGMENT_LOCAL)
90+
.ok());
9391

9492
// After open(), sampling_frequency should be propagated from VRuntimeFilterWrapper
9593
// to VExprContext. Verify by accumulating low-selectivity data and checking
@@ -103,15 +101,14 @@ TEST_F(VRuntimeFilterWrapperSamplingTest, open_propagates_sampling_frequency) {
103101
// optimization, matching the behavior when disable_always_true_logic is set.
104102
TEST_F(VRuntimeFilterWrapperSamplingTest, default_sampling_frequency_disables_optimization) {
105103
auto stub = std::make_shared<StubVExpr>();
106-
auto node = TExprNodeBuilder(
107-
TExprNodeType::SLOT_REF,
108-
TTypeDescBuilder()
109-
.set_types(TTypeNodeBuilder()
110-
.set_type(TTypeNodeType::SCALAR)
111-
.set_scalar_type(TPrimitiveType::INT)
112-
.build())
113-
.build(),
114-
0)
104+
auto node = TExprNodeBuilder(TExprNodeType::SLOT_REF,
105+
TTypeDescBuilder()
106+
.set_types(TTypeNodeBuilder()
107+
.set_type(TTypeNodeType::SCALAR)
108+
.set_scalar_type(TPrimitiveType::INT)
109+
.build())
110+
.build(),
111+
0)
115112
.build();
116113

117114
// No sampling_frequency argument - uses default DISABLE_SAMPLING
@@ -120,9 +117,9 @@ TEST_F(VRuntimeFilterWrapperSamplingTest, default_sampling_frequency_disables_op
120117
auto context = std::make_shared<VExprContext>(wrapper);
121118
RowDescriptor row_desc;
122119
ASSERT_TRUE(wrapper->prepare(_runtime_states[0].get(), row_desc, context.get()).ok());
123-
ASSERT_TRUE(wrapper->open(_runtime_states[0].get(), context.get(),
124-
FunctionContext::FRAGMENT_LOCAL)
125-
.ok());
120+
ASSERT_TRUE(
121+
wrapper->open(_runtime_states[0].get(), context.get(), FunctionContext::FRAGMENT_LOCAL)
122+
.ok());
126123

127124
// Even with low-selectivity data, always_true should NOT be detected
128125
// because sampling is disabled
@@ -135,15 +132,14 @@ TEST_F(VRuntimeFilterWrapperSamplingTest, default_sampling_frequency_disables_op
135132
// exact scenario that caused the original bug.
136133
TEST_F(VRuntimeFilterWrapperSamplingTest, sampling_frequency_survives_context_recreation) {
137134
auto stub = std::make_shared<StubVExpr>();
138-
auto node = TExprNodeBuilder(
139-
TExprNodeType::SLOT_REF,
140-
TTypeDescBuilder()
141-
.set_types(TTypeNodeBuilder()
142-
.set_type(TTypeNodeType::SCALAR)
143-
.set_scalar_type(TPrimitiveType::INT)
144-
.build())
145-
.build(),
146-
0)
135+
auto node = TExprNodeBuilder(TExprNodeType::SLOT_REF,
136+
TTypeDescBuilder()
137+
.set_types(TTypeNodeBuilder()
138+
.set_type(TTypeNodeType::SCALAR)
139+
.set_scalar_type(TPrimitiveType::INT)
140+
.build())
141+
.build(),
142+
0)
147143
.build();
148144

149145
const int expected_frequency = 32;
@@ -154,9 +150,9 @@ TEST_F(VRuntimeFilterWrapperSamplingTest, sampling_frequency_survives_context_re
154150
auto context1 = std::make_shared<VExprContext>(wrapper);
155151
RowDescriptor row_desc;
156152
ASSERT_TRUE(wrapper->prepare(_runtime_states[0].get(), row_desc, context1.get()).ok());
157-
ASSERT_TRUE(wrapper->open(_runtime_states[0].get(), context1.get(),
158-
FunctionContext::FRAGMENT_LOCAL)
159-
.ok());
153+
ASSERT_TRUE(
154+
wrapper->open(_runtime_states[0].get(), context1.get(), FunctionContext::FRAGMENT_LOCAL)
155+
.ok());
160156

161157
// Simulate context recreation (what _append_rf_into_conjuncts does):
162158
// Create a brand new VExprContext with the same VRuntimeFilterWrapper.
@@ -165,9 +161,9 @@ TEST_F(VRuntimeFilterWrapperSamplingTest, sampling_frequency_survives_context_re
165161
EXPECT_FALSE(context2->get_runtime_filter_selectivity().maybe_always_true_can_ignore());
166162

167163
// After open() on the new context, sampling_frequency should be propagated
168-
ASSERT_TRUE(wrapper->open(_runtime_states[0].get(), context2.get(),
169-
FunctionContext::THREAD_LOCAL)
170-
.ok());
164+
ASSERT_TRUE(
165+
wrapper->open(_runtime_states[0].get(), context2.get(), FunctionContext::THREAD_LOCAL)
166+
.ok());
171167

172168
auto& selectivity2 = context2->get_runtime_filter_selectivity();
173169
selectivity2.update_judge_selectivity(1, 2000, 50000, 0.1);

0 commit comments

Comments
 (0)