update histogram buckets from pointer to ObArrayWrap

This commit is contained in:
wangt1xiuyi
2023-02-10 11:11:04 +00:00
committed by ob-robot
parent 0a9101d215
commit ca1fcada83
23 changed files with 270 additions and 299 deletions

View File

@ -680,7 +680,7 @@ TEST_F(TestOptEstSel, histogram)
num_elements.push_back(infos[i][2]);
}
init_histogram(ObHistType::FREQUENCY, 100, 0.0025,
init_histogram(allocator_, ObHistType::FREQUENCY, 100, 0.0025,
repeat_count, value, num_elements, opt_stat_.get_histogram());
run_test(test_file, result_file, tmp_file, 10);

View File

@ -403,6 +403,7 @@ void TestOptimizerUtils::run_test(const char* test_file,
}
void TestOptimizerUtils::init_histogram(
common::ObIAllocator &allocator,
const ObHistType type,
const double sample_size,
const double density,
@ -418,14 +419,13 @@ void TestOptimizerUtils::init_histogram(
hist.set_sample_size(sample_size);
hist.set_density(density);
int64_t bucket_cnt = 0;
ObSEArray<ObHistBucket, 4> tmp_buckets;
hist.prepare_allocate_buckets(allocator, repeat_count.count());
for (int64_t i = 0; i < repeat_count.count(); i++) {
ObHistBucket bucket(repeat_count.at(i), num_elements.at(i));
tmp_buckets.push_back(bucket);
tmp_buckets.at(tmp_buckets.count() - 1).endpoint_value_.set_int(value.at(i));
bucket_cnt += num_elements.at(i);
hist.get(i).endpoint_num_ = repeat_count.at(i);
hist.get(i).endpoint_repeat_count_ = num_elements.at(i);
hist.get(i).endpoint_value_.set_int(value.at(i));
}
hist.add_buckets(tmp_buckets);
hist.set_bucket_cnt(repeat_count.count());
}
void TestOptimizerUtils::run_fail_test(const char *test_file)

View File

@ -89,6 +89,7 @@ class TestOptimizerUtils : public TestSqlUtils, public ::testing::Test {
void formalize_tmp_file(const char *tmp_file);
void init_histogram(
common::ObIAllocator &allocator,
const ObHistType type,
const double sample_size,
const double density,