mirror of
https://github.com/GreptimeTeam/greptimedb.git
synced 2026-05-23 00:10:38 +00:00
update rust toolchain
This commit is contained in:
@@ -1,3 +1,3 @@
|
||||
[toolchain]
|
||||
channel = "nightly-2024-06-06"
|
||||
channel = "nightly-2024-09-27"
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@ impl StaticUserProvider {
|
||||
value: value.to_string(),
|
||||
msg: "StaticUserProviderOption must be in format `<option>:<value>`",
|
||||
})?;
|
||||
return match mode {
|
||||
match mode {
|
||||
"file" => {
|
||||
let users = load_credential_from_file(content)?
|
||||
.context(InvalidConfigSnafu {
|
||||
@@ -58,7 +58,7 @@ impl StaticUserProvider {
|
||||
msg: "StaticUserProviderOption must be in format `file:<path>` or `cmd:<values>`",
|
||||
}
|
||||
.fail(),
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
/// All table names in `information_schema`.
|
||||
//! All table names in `information_schema`.
|
||||
|
||||
pub const TABLES: &str = "tables";
|
||||
pub const COLUMNS: &str = "columns";
|
||||
|
||||
@@ -12,6 +12,9 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
//! The `pg_catalog.pg_namespace` table implementation.
|
||||
//! namespace is a schema in greptime
|
||||
|
||||
pub(super) mod oid_map;
|
||||
|
||||
use std::sync::{Arc, Weak};
|
||||
@@ -40,9 +43,6 @@ use crate::system_schema::utils::tables::{string_column, u32_column};
|
||||
use crate::system_schema::SystemTable;
|
||||
use crate::CatalogManager;
|
||||
|
||||
/// The `pg_catalog.pg_namespace` table implementation.
|
||||
/// namespace is a schema in greptime
|
||||
|
||||
const NSPNAME: &str = "nspname";
|
||||
const INIT_CAPACITY: usize = 42;
|
||||
|
||||
|
||||
@@ -74,6 +74,7 @@ pub trait App: Send {
|
||||
}
|
||||
|
||||
/// Log the versions of the application, and the arguments passed to the cli.
|
||||
///
|
||||
/// `version` should be the same as the output of cli "--version";
|
||||
/// and the `short_version` is the short version of the codes, often consist of git branch and commit.
|
||||
pub fn log_versions(version: &str, short_version: &str, app: &str) {
|
||||
|
||||
@@ -46,8 +46,9 @@ impl From<String> for SecretString {
|
||||
}
|
||||
}
|
||||
|
||||
/// Wrapper type for values that contains secrets, which attempts to limit
|
||||
/// accidental exposure and ensure secrets are wiped from memory when dropped.
|
||||
/// Wrapper type for values that contains secrets.
|
||||
///
|
||||
/// It attempts to limit accidental exposure and ensure secrets are wiped from memory when dropped.
|
||||
/// (e.g. passwords, cryptographic keys, access tokens or other credentials)
|
||||
///
|
||||
/// Access to the secret inner value occurs through the [`ExposeSecret`]
|
||||
|
||||
@@ -103,14 +103,15 @@ pub const INFORMATION_SCHEMA_PROCEDURE_INFO_TABLE_ID: u32 = 34;
|
||||
/// id for information_schema.region_statistics
|
||||
pub const INFORMATION_SCHEMA_REGION_STATISTICS_TABLE_ID: u32 = 35;
|
||||
|
||||
/// ----- End of information_schema tables -----
|
||||
// ----- End of information_schema tables -----
|
||||
|
||||
/// ----- Begin of pg_catalog tables -----
|
||||
pub const PG_CATALOG_PG_CLASS_TABLE_ID: u32 = 256;
|
||||
pub const PG_CATALOG_PG_TYPE_TABLE_ID: u32 = 257;
|
||||
pub const PG_CATALOG_PG_NAMESPACE_TABLE_ID: u32 = 258;
|
||||
|
||||
/// ----- End of pg_catalog tables -----
|
||||
// ----- End of pg_catalog tables -----
|
||||
|
||||
pub const MITO_ENGINE: &str = "mito";
|
||||
pub const MITO2_ENGINE: &str = "mito2";
|
||||
pub const METRIC_ENGINE: &str = "metric";
|
||||
|
||||
@@ -199,6 +199,7 @@ pub fn default_get_uuid(working_home: &Option<String>) -> Option<String> {
|
||||
}
|
||||
|
||||
/// Report version info to GreptimeDB.
|
||||
///
|
||||
/// We do not collect any identity-sensitive information.
|
||||
/// This task is scheduled to run every 30 minutes.
|
||||
/// The task will be disabled default. It can be enabled by setting the build feature `greptimedb-telemetry`
|
||||
|
||||
@@ -35,7 +35,9 @@ pub fn aggr_func_type_store_derive(input: TokenStream) -> TokenStream {
|
||||
}
|
||||
|
||||
/// A struct can be used as a creator for aggregate function if it has been annotated with this
|
||||
/// attribute first. This attribute add a necessary field which is intended to store the input
|
||||
/// attribute first.
|
||||
///
|
||||
/// This attribute add a necessary field which is intended to store the input
|
||||
/// data's types to the struct.
|
||||
/// This attribute is expected to be used along with derive macro [AggrFuncTypeStore].
|
||||
#[proc_macro_attribute]
|
||||
@@ -44,9 +46,10 @@ pub fn as_aggr_func_creator(args: TokenStream, input: TokenStream) -> TokenStrea
|
||||
}
|
||||
|
||||
/// Attribute macro to convert an arithimetic function to a range function. The annotated function
|
||||
/// should accept servaral arrays as input and return a single value as output. This procedure
|
||||
/// macro can works on any number of input parameters. Return type can be either primitive type
|
||||
/// or wrapped in `Option`.
|
||||
/// should accept servaral arrays as input and return a single value as output.
|
||||
///
|
||||
/// This procedure macro can works on any number of input parameters. Return type can be either
|
||||
/// primitive type or wrapped in `Option`.
|
||||
///
|
||||
/// # Example
|
||||
/// Take `count_over_time()` in PromQL as an example:
|
||||
|
||||
@@ -55,6 +55,7 @@ pub trait ClusterInfo {
|
||||
}
|
||||
|
||||
/// The key of [NodeInfo] in the storage. The format is `__meta_cluster_node_info-{cluster_id}-{role}-{node_id}`.
|
||||
///
|
||||
/// This key cannot be used to describe the `Metasrv` because the `Metasrv` does not have
|
||||
/// a `cluster_id`, it serves multiple clusters.
|
||||
#[derive(Debug, Clone, Eq, Hash, PartialEq, Serialize, Deserialize)]
|
||||
|
||||
@@ -104,7 +104,7 @@ impl<'a> MetadataKey<'a, FlowNameKeyInner<'a>> for FlowNameKeyInner<'_> {
|
||||
.into_bytes()
|
||||
}
|
||||
|
||||
fn from_bytes(bytes: &'a [u8]) -> Result<FlowNameKeyInner> {
|
||||
fn from_bytes(bytes: &'a [u8]) -> Result<FlowNameKeyInner<'a>> {
|
||||
let key = std::str::from_utf8(bytes).map_err(|e| {
|
||||
error::InvalidMetadataSnafu {
|
||||
err_msg: format!(
|
||||
|
||||
@@ -220,7 +220,7 @@ pub struct RecordBatchRowIterator<'a> {
|
||||
}
|
||||
|
||||
impl<'a> RecordBatchRowIterator<'a> {
|
||||
fn new(record_batch: &'a RecordBatch) -> RecordBatchRowIterator {
|
||||
fn new(record_batch: &'a RecordBatch) -> RecordBatchRowIterator<'a> {
|
||||
RecordBatchRowIterator {
|
||||
record_batch,
|
||||
rows: record_batch.df_record_batch.num_rows(),
|
||||
|
||||
@@ -62,6 +62,7 @@ impl From<ArrowIntervalUnit> for IntervalUnit {
|
||||
}
|
||||
|
||||
/// Interval Type represents a period of time.
|
||||
///
|
||||
/// It is composed of months, days and nanoseconds.
|
||||
/// 3 kinds of interval are supported: year-month, day-time and
|
||||
/// month-day-nano, which will be stored in the following format.
|
||||
|
||||
@@ -82,8 +82,8 @@ pub fn cast_with_opt(
|
||||
}
|
||||
}
|
||||
|
||||
/// Return true if the src_value can be casted to dest_type,
|
||||
/// Otherwise, return false.
|
||||
/// Return true if the src_value can be casted to dest_type, Otherwise, return false.
|
||||
///
|
||||
/// Notice: this function does not promise that the `cast_with_opt` will succeed,
|
||||
/// it only checks whether the src_value can be casted to dest_type.
|
||||
pub fn can_cast_type(src_value: &Value, dest_type: &ConcreteDataType) -> bool {
|
||||
|
||||
@@ -83,9 +83,10 @@ pub trait LogicalPrimitiveType: 'static + Sized {
|
||||
fn cast_value_ref(value: ValueRef) -> Result<Option<Self::Wrapper>>;
|
||||
}
|
||||
|
||||
/// A new type for [WrapperType], complement the `Ord` feature for it. Wrapping non ordered
|
||||
/// primitive types like `f32` and `f64` in `OrdPrimitive` can make them be used in places that
|
||||
/// require `Ord`. For example, in `Median` UDAFs.
|
||||
/// A new type for [WrapperType], complement the `Ord` feature for it.
|
||||
///
|
||||
/// Wrapping non ordered primitive types like `f32` and `f64` in `OrdPrimitive`
|
||||
/// can make them be used in places that require `Ord`. For example, in `Median` UDAFs.
|
||||
#[derive(Debug, Clone, Copy, PartialEq)]
|
||||
pub struct OrdPrimitive<T: WrapperType>(pub T);
|
||||
|
||||
|
||||
@@ -157,7 +157,7 @@ pub struct ListIter<'a> {
|
||||
}
|
||||
|
||||
impl<'a> ListIter<'a> {
|
||||
fn new(vector: &'a ListVector) -> ListIter {
|
||||
fn new(vector: &'a ListVector) -> ListIter<'a> {
|
||||
ListIter { vector, idx: 0 }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,7 +19,9 @@ use crate::inverted_index::error::Result;
|
||||
use crate::inverted_index::format::reader::InvertedIndexReader;
|
||||
|
||||
/// `FstValuesMapper` maps FST-encoded u64 values to their corresponding bitmaps
|
||||
/// within an inverted index. The higher 32 bits of each u64 value represent the
|
||||
/// within an inverted index.
|
||||
///
|
||||
/// The higher 32 bits of each u64 value represent the
|
||||
/// bitmap offset and the lower 32 bits represent its size. This mapper uses these
|
||||
/// combined offset-size pairs to fetch and union multiple bitmaps into a single `BitVec`.
|
||||
pub struct FstValuesMapper<'a> {
|
||||
|
||||
@@ -134,7 +134,7 @@ impl PredicatesIndexApplier {
|
||||
fn bitmap_full_range(metadata: &InvertedIndexMetas) -> BitVec {
|
||||
let total_count = metadata.total_row_count;
|
||||
let segment_count = metadata.segment_row_count;
|
||||
let len = (total_count + segment_count - 1) / segment_count;
|
||||
let len = total_count.div_ceil(segment_count);
|
||||
BitVec::repeat(true, len as _)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
#![feature(result_flattening)]
|
||||
#![feature(assert_matches)]
|
||||
#![feature(extract_if)]
|
||||
#![feature(option_take_if)]
|
||||
|
||||
pub mod bootstrap;
|
||||
mod cache_invalidator;
|
||||
|
||||
@@ -499,7 +499,7 @@ fn divide_num_cpus(divisor: usize) -> usize {
|
||||
let cores = common_config::utils::get_cpus();
|
||||
debug_assert!(cores > 0);
|
||||
|
||||
(cores + divisor - 1) / divisor
|
||||
cores.div_ceil(divisor)
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
|
||||
@@ -724,7 +724,7 @@ fn maybe_split_parts(mut parts: Vec<ScanPart>, parallelism: usize) -> Vec<ScanPa
|
||||
// Safety: `can_split_preserve_order()` ensures file_ranges.len() == 1.
|
||||
// Splits part into `num_parts_to_split + 1` new parts if possible.
|
||||
let target_part_num = num_parts_to_split + 1;
|
||||
let ranges_per_part = (part.file_ranges[0].len() + target_part_num - 1) / target_part_num;
|
||||
let ranges_per_part = part.file_ranges[0].len().div_ceil(target_part_num);
|
||||
// `can_split_preserve_order()` ensures part.file_ranges[0].len() > 1.
|
||||
assert!(ranges_per_part > 0);
|
||||
for ranges in part.file_ranges[0].chunks(ranges_per_part) {
|
||||
|
||||
@@ -35,7 +35,11 @@ pub(crate) struct MetadataLoader<'a> {
|
||||
|
||||
impl<'a> MetadataLoader<'a> {
|
||||
/// Create a new parquet metadata loader.
|
||||
pub fn new(object_store: ObjectStore, file_path: &'a str, file_size: u64) -> MetadataLoader {
|
||||
pub fn new(
|
||||
object_store: ObjectStore,
|
||||
file_path: &'a str,
|
||||
file_size: u64,
|
||||
) -> MetadataLoader<'a> {
|
||||
Self {
|
||||
object_store,
|
||||
file_path,
|
||||
|
||||
@@ -62,7 +62,8 @@ const TARGET_FIELDS_NAME: &str = "target_fields";
|
||||
// const ON_FAILURE_NAME: &str = "on_failure";
|
||||
// const TAG_NAME: &str = "tag";
|
||||
|
||||
/// Processor trait defines the interface for all processors
|
||||
/// Processor trait defines the interface for all processors.
|
||||
///
|
||||
/// A processor is a transformation that can be applied to a field in a document
|
||||
/// It can be used to extract, transform, or enrich data
|
||||
/// Now Processor only have one input field. In the future, we may support multiple input fields.
|
||||
|
||||
@@ -26,6 +26,7 @@ pub mod table;
|
||||
pub mod util;
|
||||
|
||||
/// Pipeline version. An optional timestamp with nanosecond precision.
|
||||
///
|
||||
/// If the version is None, it means the latest version of the pipeline.
|
||||
/// User can specify the version by providing a timestamp string formatted as iso8601.
|
||||
/// When it used in cache key, it will be converted to i64 meaning the number of nanoseconds since the epoch.
|
||||
|
||||
@@ -44,7 +44,9 @@ use datatypes::vectors::MutableVector;
|
||||
use futures::{ready, Stream, StreamExt};
|
||||
|
||||
/// `HistogramFold` will fold the conventional (non-native) histogram ([1]) for later
|
||||
/// computing. Specifically, it will transform the `le` and `field` column into a complex
|
||||
/// computing.
|
||||
///
|
||||
/// Specifically, it will transform the `le` and `field` column into a complex
|
||||
/// type, and samples on other tag columns:
|
||||
/// - `le` will become a [ListArray] of [f64]. With each bucket bound parsed
|
||||
/// - `field` will become a [ListArray] of [f64]
|
||||
|
||||
@@ -46,7 +46,8 @@ use crate::error::{ColumnNotFoundSnafu, DataFusionPlanningSnafu, DeserializeSnaf
|
||||
/// `ScalarCalculate` is the custom logical plan to calculate
|
||||
/// [`scalar`](https://prometheus.io/docs/prometheus/latest/querying/functions/#scalar)
|
||||
/// in PromQL, return NaN when have multiple time series.
|
||||
/// return the time series as scalar value when only have one time series.
|
||||
///
|
||||
/// Return the time series as scalar value when only have one time series.
|
||||
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
|
||||
pub struct ScalarCalculate {
|
||||
start: Millisecond,
|
||||
|
||||
@@ -12,6 +12,8 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
//! PyVectors' rustpython specify methods
|
||||
|
||||
use arrow::compute::kernels::numeric;
|
||||
use common_time::date::Date;
|
||||
use common_time::datetime::DateTime;
|
||||
@@ -40,7 +42,6 @@ use crate::python::ffi_types::vector::{
|
||||
arrow_rfloordiv, arrow_rsub, arrow_rtruediv, rspy_is_pyobj_scalar, wrap_result, PyVector,
|
||||
};
|
||||
use crate::python::rspython::utils::{is_instance, obj_cast_to};
|
||||
/// PyVectors' rustpython specify methods
|
||||
|
||||
fn to_type_error(vm: &'_ VirtualMachine) -> impl FnOnce(String) -> PyBaseExceptionRef + '_ {
|
||||
|msg: String| vm.new_type_error(msg)
|
||||
|
||||
@@ -31,7 +31,9 @@ use crate::error::{InvalidExportMetricsConfigSnafu, Result, SendPromRemoteReques
|
||||
use crate::prom_store::{snappy_compress, to_grpc_row_insert_requests};
|
||||
use crate::query_handler::PromStoreProtocolHandlerRef;
|
||||
|
||||
/// Use to export the metrics generated by greptimedb, encoded to Prometheus [RemoteWrite format](https://prometheus.io/docs/concepts/remote_write_spec/),
|
||||
/// Use to export the metrics generated by greptimedb.
|
||||
///
|
||||
/// Encoded to Prometheus [RemoteWrite format](https://prometheus.io/docs/concepts/remote_write_spec/),
|
||||
/// and send to Prometheus remote-write compatible receiver (e.g. send to `greptimedb` itself)
|
||||
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Eq)]
|
||||
#[serde(default)]
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
// limitations under the License.
|
||||
|
||||
//! All query handler traits for various request protocols, like SQL or GRPC.
|
||||
//!
|
||||
//! Instance that wishes to support certain request protocol, just implement the corresponding
|
||||
//! trait, the Server will handle codec for you.
|
||||
//!
|
||||
@@ -122,6 +123,7 @@ pub trait OpenTelemetryProtocolHandler {
|
||||
}
|
||||
|
||||
/// LogHandler is responsible for handling log related requests.
|
||||
///
|
||||
/// It should be able to insert logs and manage pipelines.
|
||||
/// The pipeline is a series of transformations that can be applied to logs.
|
||||
/// The pipeline is stored in the database and can be retrieved by name.
|
||||
|
||||
@@ -131,6 +131,7 @@ impl Display for TqlAnalyze {
|
||||
}
|
||||
|
||||
/// Intermediate structure used to unify parameter mappings for various TQL operations.
|
||||
///
|
||||
/// This struct serves as a common parameter container for parsing TQL queries
|
||||
/// and constructing corresponding TQL operations: `TqlEval`, `TqlAnalyze` or `TqlExplain`.
|
||||
#[derive(Debug)]
|
||||
|
||||
@@ -31,8 +31,9 @@ pub fn supported_protocol_version() -> (ProtocolVersion, ProtocolVersion) {
|
||||
}
|
||||
|
||||
/// Protocol action that used to block older clients from reading or writing the log when backwards
|
||||
/// incompatible changes are made to the protocol. clients should be tolerant of messages and
|
||||
/// fields that they do not understand.
|
||||
/// incompatible changes are made to the protocol.
|
||||
///
|
||||
/// clients should be tolerant of messages and fields that they do not understand.
|
||||
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
|
||||
pub struct ProtocolAction {
|
||||
pub min_reader_version: ProtocolVersion,
|
||||
|
||||
@@ -13,9 +13,9 @@
|
||||
// limitations under the License.
|
||||
|
||||
//! Path constants for table engines, cluster states and WAL
|
||||
//! All paths relative to data_home(file storage) or root path(S3, OSS etc).
|
||||
|
||||
use crate::storage::{RegionId, RegionNumber, TableId};
|
||||
/// All paths relative to data_home(file storage) or root path(S3, OSS etc).
|
||||
|
||||
/// WAL dir for local file storage
|
||||
pub const WAL_DIR: &str = "wal/";
|
||||
@@ -45,7 +45,9 @@ pub fn region_dir(path: &str, region_id: RegionId) -> String {
|
||||
)
|
||||
}
|
||||
|
||||
/// get_storage_path returns the storage path from the region_dir. It will always return the storage path if the region_dir is valid, otherwise None.
|
||||
/// get_storage_path returns the storage path from the region_dir.
|
||||
///
|
||||
/// It will always return the storage path if the region_dir is valid, otherwise None.
|
||||
/// The storage path is constructed from the catalog and schema, which are generated by `common_meta::ddl::utils::region_storage_path`.
|
||||
/// We can extract the catalog and schema from the region_dir by following example:
|
||||
/// ```
|
||||
|
||||
@@ -247,6 +247,7 @@ impl ScannerProperties {
|
||||
}
|
||||
|
||||
/// A scanner that provides a way to scan the region concurrently.
|
||||
///
|
||||
/// The scanner splits the region into partitions so that each partition can be scanned concurrently.
|
||||
/// You can use this trait to implement an [`ExecutionPlan`](datafusion_physical_plan::ExecutionPlan).
|
||||
pub trait RegionScanner: Debug + DisplayAs + Send {
|
||||
|
||||
@@ -100,7 +100,8 @@ pub struct TableIdent {
|
||||
pub version: TableVersion,
|
||||
}
|
||||
|
||||
/// The table metadata
|
||||
/// The table metadata.
|
||||
///
|
||||
/// Note: if you add new fields to this struct, please ensure 'new_meta_builder' function works.
|
||||
/// TODO(dennis): find a better way to ensure 'new_meta_builder' works when adding new fields.
|
||||
#[derive(Clone, Debug, Builder, PartialEq, Eq)]
|
||||
|
||||
@@ -14,7 +14,8 @@
|
||||
|
||||
use datatypes::value::Value;
|
||||
|
||||
/// Statistics for a relation
|
||||
/// Statistics for a relation.
|
||||
///
|
||||
/// Fields are optional and can be inexact because the sources
|
||||
/// sometimes provide approximate estimates for performance reasons
|
||||
/// and the transformations output are not always predictable.
|
||||
|
||||
Reference in New Issue
Block a user