[Feature](vec)(quantile_state): support quantile state in vectorized engine (#16562)

* [Feature](vectorized)(quantile_state): support vectorized quantile state functions
1. now quantile column only support not nullable
2. add up some regression test cases
3. set default enable_quantile_state_type = true
---------

Co-authored-by: spaces-x <weixiang06@meituan.com>
This commit is contained in:
spaces-x
2023-03-14 10:54:04 +08:00
committed by GitHub
parent 36a0d40ac3
commit 5b39fa9843
39 changed files with 1119 additions and 23 deletions

View File

@ -291,6 +291,24 @@ void RPCFnImpl::_convert_col_to_pvalue(const ColumnPtr& column, const DataTypePt
}
break;
}
case TypeIndex::QuantileState: {
ptype->set_id(PGenericType::QUANTILE_STATE);
arg->mutable_bytes_value()->Reserve(row_count);
for (size_t row_num = start; row_num < end; ++row_num) {
if constexpr (nullable) {
if (column->is_null_at(row_num)) {
arg->add_bytes_value(nullptr);
} else {
StringRef data = column->get_data_at(row_num);
arg->add_bytes_value(data.data, data.size);
}
} else {
StringRef data = column->get_data_at(row_num);
arg->add_bytes_value(data.data, data.size);
}
}
break;
}
default:
LOG(INFO) << "unknown type: " << data_type->get_name();
ptype->set_id(PGenericType::UNKNOWN);
@ -443,6 +461,13 @@ void RPCFnImpl::_convert_to_column(MutableColumnPtr& column, const PValues& resu
}
break;
}
case PGenericType::QUANTILE_STATE: {
column->reserve(result.bytes_value_size());
for (int i = 0; i < result.bytes_value_size(); ++i) {
column->insert_data(result.bytes_value(i).c_str(), result.bytes_value(i).size());
}
break;
}
default: {
LOG(WARNING) << "unknown PGenericType: " << result.type().DebugString();
break;