mirror of
https://github.com/GreptimeTeam/greptimedb.git
synced 2026-10-12 06:52:34 +00:00
chore: update rust toolchain to 1.98.1 (#9429)
This commit is contained in:
Generated
+9
-9
@@ -8,11 +8,11 @@
|
||||
"rust-analyzer-src": "rust-analyzer-src"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1785314864,
|
||||
"narHash": "sha256-imz9J5iMNersDeQ1ymenFg35N6C2R3MCaGg2i0XCIrE=",
|
||||
"lastModified": 1790642863,
|
||||
"narHash": "sha256-JIwE6EnebvxW7QFFEitWHuZDXwN6Qcf6ZC8DIvYW3y8=",
|
||||
"owner": "nix-community",
|
||||
"repo": "fenix",
|
||||
"rev": "594418b2c9ea0731bee6988236ef5bfd97e81dca",
|
||||
"rev": "a8f386c482e78e9a48be5abecdc17a9b098a95a1",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
@@ -41,11 +41,11 @@
|
||||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1785133411,
|
||||
"narHash": "sha256-Yjv0WEg39KRYS0rBdTbu6Fc/or/ihAKk13W9sQ6VWd0=",
|
||||
"lastModified": 1790533781,
|
||||
"narHash": "sha256-F+b8u43BVF5DlM0pz7JQSbtbwKy5PrHIT5zQUekXsD0=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "2f5a153c270b70cb0f8c11f46d96d6d3bc39f4e3",
|
||||
"rev": "cf5e76507c6e23b59f7e0ffcc7baa2a39ddd8442",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
@@ -65,11 +65,11 @@
|
||||
"rust-analyzer-src": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1785261141,
|
||||
"narHash": "sha256-sA+DHPejWD68mLA7gtTiHGd5T41F6W+NKf0g+ibFCW4=",
|
||||
"lastModified": 1790532271,
|
||||
"narHash": "sha256-j8y/AO3AMDF9p+11aIDhnA21JnNj5PjvcejTI43vI8Q=",
|
||||
"owner": "rust-lang",
|
||||
"repo": "rust-analyzer",
|
||||
"rev": "bec66814323579659ffd77c909b3d963af118ece",
|
||||
"rev": "03fcb77246f2568adb0e9b2fa60d19c6cc1686f4",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
lib = nixpkgs.lib;
|
||||
rustToolchain = fenix.packages.${system}.fromToolchainName {
|
||||
name = (lib.importTOML ./rust-toolchain.toml).toolchain.channel;
|
||||
sha256 = "sha256-h+t2xTBz5yt2YIO+1VMIIGlCU7gyp2LYOFvaV1nwOXU=";
|
||||
sha256 = "sha256-p8h3Sl/YRByZfZTAKXdsvF6xEenXKrXSVvpphmZENH4=";
|
||||
};
|
||||
in
|
||||
{
|
||||
|
||||
+1
-1
@@ -1,2 +1,2 @@
|
||||
[toolchain]
|
||||
channel = "1.96.1"
|
||||
channel = "1.98.1"
|
||||
|
||||
@@ -53,8 +53,10 @@ pub fn binlit_as_veclit(bytes: &[u8]) -> Result<Cow<'_, [f32]>> {
|
||||
})
|
||||
} else {
|
||||
let v = bytes
|
||||
.chunks_exact(std::mem::size_of::<f32>())
|
||||
.map(|chunk| f32::from_le_bytes(chunk.try_into().unwrap()))
|
||||
.as_chunks::<{ std::mem::size_of::<f32>() }>()
|
||||
.0
|
||||
.iter()
|
||||
.map(|chunk| f32::from_le_bytes(*chunk))
|
||||
.collect::<Vec<f32>>();
|
||||
Ok(Cow::Owned(v))
|
||||
}
|
||||
|
||||
@@ -732,12 +732,12 @@ impl PackedRegionFileRefs {
|
||||
}
|
||||
|
||||
let mut refs = HashSet::new();
|
||||
for bytes in files.chunks_exact(16) {
|
||||
for bytes in files.as_chunks::<16>().0 {
|
||||
let mut id = [0; 16];
|
||||
id.copy_from_slice(bytes);
|
||||
refs.insert(FileRef::new(region, FileId::from_bytes(id), None));
|
||||
}
|
||||
for bytes in indexed.chunks_exact(24) {
|
||||
for bytes in indexed.as_chunks::<24>().0 {
|
||||
let mut id = [0; 16];
|
||||
id.copy_from_slice(&bytes[..16]);
|
||||
let mut version = [0; 8];
|
||||
|
||||
@@ -82,7 +82,7 @@ impl KvBackend for ChrootKvBackend {
|
||||
|
||||
async fn batch_put(&self, mut req: BatchPutRequest) -> Result<BatchPutResponse, Self::Error> {
|
||||
for kv in req.kvs.iter_mut() {
|
||||
kv.key = self.key_prepend_root(kv.key.drain(..).collect());
|
||||
kv.key = self.key_prepend_root(std::mem::take(&mut kv.key));
|
||||
}
|
||||
let mut res = self.inner.batch_put(req).await?;
|
||||
res.prev_kvs = res
|
||||
|
||||
@@ -48,7 +48,7 @@ pub fn region_distribution(region_routes: &[RegionRoute]) -> RegionDistribution
|
||||
.add_follower_region(region_number);
|
||||
}
|
||||
}
|
||||
for (_, region_role_set) in regions_id_map.iter_mut() {
|
||||
for region_role_set in regions_id_map.values_mut() {
|
||||
// Sort the regions in ascending order.
|
||||
region_role_set.sort()
|
||||
}
|
||||
|
||||
@@ -199,7 +199,7 @@ impl RangeResponse {
|
||||
}
|
||||
|
||||
pub fn take_kvs(&mut self) -> Vec<KeyValue> {
|
||||
self.kvs.drain(..).collect()
|
||||
std::mem::take(&mut self.kvs)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -451,7 +451,7 @@ impl BatchPutResponse {
|
||||
}
|
||||
|
||||
pub fn take_prev_kvs(&mut self) -> Vec<KeyValue> {
|
||||
self.prev_kvs.drain(..).collect()
|
||||
std::mem::take(&mut self.prev_kvs)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -780,7 +780,7 @@ impl DeleteRangeResponse {
|
||||
}
|
||||
|
||||
pub fn take_prev_kvs(&mut self) -> Vec<KeyValue> {
|
||||
self.prev_kvs.drain(..).collect()
|
||||
std::mem::take(&mut self.prev_kvs)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -188,7 +188,7 @@ impl Inner {
|
||||
}
|
||||
|
||||
error::NextSequenceSnafu {
|
||||
err_msg: format!("{}.next()", &self.name),
|
||||
err_msg: format!("{}.next()", self.name),
|
||||
}
|
||||
.fail()
|
||||
}
|
||||
@@ -264,7 +264,7 @@ impl Inner {
|
||||
}
|
||||
|
||||
error::NextSequenceSnafu {
|
||||
err_msg: format!("{}.next_range()", &self.name),
|
||||
err_msg: format!("{}.next_range()", self.name),
|
||||
}
|
||||
.fail()
|
||||
}
|
||||
|
||||
@@ -95,7 +95,7 @@ impl DisplayAs for StreamScanAdapter {
|
||||
f,
|
||||
"StreamScanAdapter: [<SendableRecordBatchStream>], schema: ["
|
||||
)?;
|
||||
write!(f, "{:?}", &self.arrow_schema)?;
|
||||
write!(f, "{:?}", self.arrow_schema)?;
|
||||
write!(f, "]")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -86,8 +86,10 @@ pub fn vector_type_value_to_string(val: &[u8], dim: u32) -> Result<String> {
|
||||
}
|
||||
|
||||
let elements = val
|
||||
.chunks_exact(std::mem::size_of::<f32>())
|
||||
.map(|e| f32::from_le_bytes(e.try_into().unwrap()));
|
||||
.as_chunks::<{ std::mem::size_of::<f32>() }>()
|
||||
.0
|
||||
.iter()
|
||||
.map(|e| f32::from_le_bytes(*e));
|
||||
|
||||
let mut s = String::from("[");
|
||||
for (i, e) in elements.enumerate() {
|
||||
|
||||
@@ -22,7 +22,6 @@ use common_recordbatch::recordbatch::merge_record_batches;
|
||||
use common_recordbatch::{RecordBatch, util};
|
||||
use common_time::Timestamp;
|
||||
use datafusion_common::ScalarValue;
|
||||
use datafusion_common::tree_node::TreeNode as _;
|
||||
use datafusion_expr::{GroupingSet, TableScanBuilder};
|
||||
use datatypes::arrow::array::{Array, AsArray};
|
||||
use datatypes::arrow::datatypes::{Float64Type, Int64Type, UInt64Type};
|
||||
|
||||
@@ -270,8 +270,10 @@ mod tests {
|
||||
/// Converts a slice of bytes to a vector of `u64`.
|
||||
pub fn u64_vec_from_bytes(bytes: &[u8]) -> Vec<u64> {
|
||||
bytes
|
||||
.chunks_exact(std::mem::size_of::<u64>())
|
||||
.map(|chunk| u64::from_le_bytes(chunk.try_into().unwrap()))
|
||||
.as_chunks::<{ std::mem::size_of::<u64>() }>()
|
||||
.0
|
||||
.iter()
|
||||
.map(|chunk| u64::from_le_bytes(*chunk))
|
||||
.collect()
|
||||
}
|
||||
|
||||
|
||||
@@ -158,13 +158,10 @@ impl RecordsBuffer {
|
||||
impl RecordsBuffer {
|
||||
fn pop_front(&mut self) -> Option<RecordAndOffset> {
|
||||
while let Some(index) = self.index.peek() {
|
||||
if let Some(record_and_offset) = self.buffer.pop_front() {
|
||||
if index == record_and_offset.offset as u64 {
|
||||
self.index.next();
|
||||
return Some(record_and_offset);
|
||||
}
|
||||
} else {
|
||||
return None;
|
||||
let record_and_offset = self.buffer.pop_front()?;
|
||||
if index == record_and_offset.offset as u64 {
|
||||
self.index.next();
|
||||
return Some(record_and_offset);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -40,7 +40,7 @@ struct EpochStats {
|
||||
impl EpochStats {
|
||||
#[inline]
|
||||
fn drain_all(&mut self) -> Vec<Stat> {
|
||||
self.stats.drain(..).collect()
|
||||
std::mem::take(&mut self.stats)
|
||||
}
|
||||
|
||||
#[inline]
|
||||
|
||||
@@ -82,7 +82,7 @@ pub fn merge_and_validate_region_wal_options(
|
||||
table_id: TableId,
|
||||
) -> Result<RegionWalOptions> {
|
||||
// Doesn't allow overwriting existing WAL options.
|
||||
for (region_number, _) in new_region_wal_options.iter() {
|
||||
for region_number in new_region_wal_options.keys() {
|
||||
if region_wal_options.contains_key(region_number) {
|
||||
return error::UnexpectedSnafu {
|
||||
violated: format!(
|
||||
|
||||
@@ -419,7 +419,6 @@ mod tests {
|
||||
use std::sync::Arc;
|
||||
|
||||
use api::v1::meta::heartbeat_server::Heartbeat;
|
||||
use api::v1::meta::*;
|
||||
use common_meta::kv_backend::memory::MemoryKvBackend;
|
||||
use common_telemetry::tracing_context::W3cTrace;
|
||||
use servers::grpc::GrpcOptions;
|
||||
|
||||
@@ -116,7 +116,7 @@ impl<'a, 'b> SparsePrimaryKeyView<'a, 'b> {
|
||||
// encoded_value checked the markers and every chunk length. Reserve once
|
||||
// before unchunking so the buffer does not grow for each 8-byte chunk.
|
||||
buffer.reserve(encoded.len() - 2);
|
||||
for chunk in encoded[2..].chunks_exact(9) {
|
||||
for chunk in encoded[2..].as_chunks::<9>().0 {
|
||||
let len = usize::from(chunk[8]).min(8);
|
||||
buffer.extend_from_slice(&chunk[..len]);
|
||||
}
|
||||
|
||||
@@ -268,7 +268,7 @@ fn filter_1_host(c: &mut Criterion) {
|
||||
)
|
||||
.unwrap();
|
||||
|
||||
for (_range_id, range) in ranges.ranges.iter() {
|
||||
for range in ranges.ranges.values() {
|
||||
let iter = range.build_record_batch_iter(None, None).unwrap();
|
||||
for batch in iter {
|
||||
let _batch = batch.unwrap();
|
||||
|
||||
@@ -546,7 +546,7 @@ async fn test_planning_panic_notifies_and_clears_status() {
|
||||
|
||||
let finished = recv_compaction_pick_finished(&mut rx).await;
|
||||
let CompactionPlanningResult::Error(err) = &finished.result else {
|
||||
panic!("expected planning error, got {:?}", &finished.result);
|
||||
panic!("expected planning error, got {:?}", finished.result);
|
||||
};
|
||||
assert!(err.to_string().contains("planning boom"));
|
||||
let pending_ddls = scheduler
|
||||
|
||||
@@ -518,13 +518,9 @@ async fn write_and_list_entry(store: &ObjectStore, path: &str) -> Entry {
|
||||
.await
|
||||
.unwrap();
|
||||
// List the parent directory to get the entry.
|
||||
let parent = std::path::Path::new(path).parent().and_then(|p| {
|
||||
if p.as_os_str().is_empty() {
|
||||
None
|
||||
} else {
|
||||
Some(p)
|
||||
}
|
||||
});
|
||||
let parent = std::path::Path::new(path)
|
||||
.parent()
|
||||
.filter(|p| !p.as_os_str().is_empty());
|
||||
let prefix = match parent {
|
||||
Some(p) => format!("{}/", p.to_str().unwrap()),
|
||||
None => String::new(), // root
|
||||
|
||||
@@ -1872,7 +1872,7 @@ mod tests {
|
||||
let total_rows: usize = ranges.ranges.values().map(|r| r.stats().num_rows()).sum();
|
||||
assert_eq!(5, total_rows);
|
||||
|
||||
for (_range_id, range) in ranges.ranges.iter() {
|
||||
for range in ranges.ranges.values() {
|
||||
assert!(range.num_rows() > 0);
|
||||
assert!(range.is_record_batch());
|
||||
|
||||
@@ -2468,7 +2468,7 @@ mod tests {
|
||||
let total_rows: usize = ranges.ranges.values().map(|r| r.stats().num_rows()).sum();
|
||||
assert_eq!(10, total_rows);
|
||||
|
||||
for (_range_id, range) in ranges.ranges.iter() {
|
||||
for range in ranges.ranges.values() {
|
||||
assert!(range.num_rows() > 0);
|
||||
assert!(range.is_record_batch());
|
||||
|
||||
@@ -2554,7 +2554,7 @@ mod tests {
|
||||
|
||||
// Read all data and verify
|
||||
let mut total_rows_read = 0;
|
||||
for (_range_id, range) in ranges.ranges.iter() {
|
||||
for range in ranges.ranges.values() {
|
||||
assert!(range.is_record_batch());
|
||||
let record_batch_iter = range.build_record_batch_iter(None, None).unwrap();
|
||||
|
||||
@@ -2642,7 +2642,7 @@ mod tests {
|
||||
assert_eq!(13, total_rows);
|
||||
|
||||
let mut total_rows_read = 0;
|
||||
for (_range_id, range) in ranges.ranges.iter() {
|
||||
for range in ranges.ranges.values() {
|
||||
let record_batch_iter = range.build_record_batch_iter(None, None).unwrap();
|
||||
for batch_result in record_batch_iter {
|
||||
let batch = batch_result.unwrap();
|
||||
@@ -3063,7 +3063,7 @@ mod tests {
|
||||
|
||||
// Read all data
|
||||
let mut total_rows_read = 0;
|
||||
for (_range_id, range) in ranges.ranges.iter() {
|
||||
for range in ranges.ranges.values() {
|
||||
assert!(range.is_record_batch());
|
||||
let record_batch_iter = range.build_record_batch_iter(None, None).unwrap();
|
||||
|
||||
@@ -3120,7 +3120,7 @@ mod tests {
|
||||
|
||||
// Should return ranges but each range should produce an empty iterator
|
||||
// instead of an error.
|
||||
for (_range_id, range) in ranges.ranges.iter() {
|
||||
for range in ranges.ranges.values() {
|
||||
assert!(range.is_record_batch());
|
||||
let record_batch_iter = range.build_record_batch_iter(None, None).unwrap();
|
||||
let total_rows: usize = record_batch_iter.map(|r| r.unwrap().num_rows()).sum();
|
||||
|
||||
@@ -77,12 +77,8 @@ impl FileReferenceManager {
|
||||
}
|
||||
|
||||
fn ref_file_set(&self, region_id: RegionId) -> Option<HashSet<FileRef>> {
|
||||
let file_refs = if let Some(file_refs) = self.files_per_region.get(®ion_id) {
|
||||
file_refs.clone()
|
||||
} else {
|
||||
// region id not found.
|
||||
return None;
|
||||
};
|
||||
// region id not found.
|
||||
let file_refs = self.files_per_region.get(®ion_id)?.clone();
|
||||
|
||||
if file_refs.files.is_empty() {
|
||||
// still return an empty manifest to indicate no files are referenced.
|
||||
|
||||
@@ -911,7 +911,7 @@ fn identity_pipeline_inner(
|
||||
}
|
||||
|
||||
let column_count = schema_info.schema.len();
|
||||
for (_, row) in opt_map.iter_mut() {
|
||||
for row in opt_map.values_mut() {
|
||||
for row in row.iter_mut() {
|
||||
assert!(
|
||||
column_count >= row.values.len(),
|
||||
|
||||
@@ -1218,7 +1218,7 @@ impl HistogramFoldStream {
|
||||
|
||||
fn flush_remaining(&mut self) -> DataFusionResult<()> {
|
||||
if self.mode == FoldMode::Optimistic && self.input_buffered_rows > 0 {
|
||||
let buffered_batches: Vec<_> = self.input_buffer.drain(..).collect();
|
||||
let buffered_batches: Vec<_> = std::mem::take(&mut self.input_buffer);
|
||||
if !buffered_batches.is_empty() {
|
||||
let batch = concat_batches(&self.input_schema, buffered_batches.as_slice())?;
|
||||
self.switch_to_safe_mode(batch)?;
|
||||
|
||||
@@ -653,7 +653,7 @@ impl PlanRewriter {
|
||||
))
|
||||
})?;
|
||||
|
||||
for (_col_name, alias_set) in part_cols.iter_mut() {
|
||||
for alias_set in part_cols.values_mut() {
|
||||
let aliased_cols = aliased_columns_for(
|
||||
&alias_set.clone().into_iter().collect(),
|
||||
plan,
|
||||
|
||||
@@ -328,7 +328,7 @@ impl QueryTraceParams {
|
||||
}
|
||||
.build()
|
||||
})?;
|
||||
for (_, v) in tags_map.iter_mut() {
|
||||
for v in tags_map.values_mut() {
|
||||
if let Some(number) = convert_string_to_number(v) {
|
||||
*v = number;
|
||||
}
|
||||
|
||||
@@ -658,7 +658,7 @@ fn resolve_series_labels<'a>(
|
||||
let mut tags = Vec::with_capacity(labels_refs.len() / 2);
|
||||
label_names.clear();
|
||||
|
||||
for pair in labels_refs.chunks_exact(2) {
|
||||
for pair in labels_refs.as_chunks::<2>().0 {
|
||||
let name = symbol_ref(symbols, pair[0], "label name")?;
|
||||
let value = symbol_ref(symbols, pair[1], "label value")?;
|
||||
validate_label(name)?;
|
||||
|
||||
@@ -768,7 +768,7 @@ impl<'a> ParserContext<'a> {
|
||||
{
|
||||
return Err(ParserError::ParserError(format!(
|
||||
"Cannot use keyword '{}' as column name. Hint: add quotes to the name.",
|
||||
&name.value
|
||||
name.value
|
||||
)));
|
||||
}
|
||||
|
||||
@@ -786,7 +786,7 @@ impl<'a> ParserContext<'a> {
|
||||
InvalidSqlSnafu {
|
||||
msg: format!(
|
||||
"Cannot use keyword '{}' as column name. Hint: add quotes to the name.",
|
||||
&name.value
|
||||
name.value
|
||||
),
|
||||
}
|
||||
);
|
||||
|
||||
@@ -46,7 +46,7 @@ pub struct CopyQueryTo {
|
||||
|
||||
impl Display for CopyQueryTo {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
write!(f, "COPY ({}) TO {}", &self.query, &self.arg.location)?;
|
||||
write!(f, "COPY ({}) TO {}", self.query, self.arg.location)?;
|
||||
if !self.arg.with.is_empty() {
|
||||
let options = self.arg.with.kv_pairs();
|
||||
write!(f, " WITH ({})", options.join(", "))?;
|
||||
@@ -70,11 +70,11 @@ impl Display for CopyTable {
|
||||
write!(f, "COPY ")?;
|
||||
let (with, connection) = match self {
|
||||
CopyTable::To(args) => {
|
||||
write!(f, "{} TO {}", &args.table_name, &args.location)?;
|
||||
write!(f, "{} TO {}", args.table_name, args.location)?;
|
||||
(&args.with, &args.connection)
|
||||
}
|
||||
CopyTable::From(args) => {
|
||||
write!(f, "{} FROM {}", &args.table_name, &args.location)?;
|
||||
write!(f, "{} FROM {}", args.table_name, args.location)?;
|
||||
(&args.with, &args.connection)
|
||||
}
|
||||
};
|
||||
@@ -101,11 +101,11 @@ impl Display for CopyDatabase {
|
||||
write!(f, "COPY DATABASE ")?;
|
||||
let (with, connection) = match self {
|
||||
CopyDatabase::To(args) => {
|
||||
write!(f, "{} TO {}", &args.database_name, &args.location)?;
|
||||
write!(f, "{} TO {}", args.database_name, args.location)?;
|
||||
(&args.with, &args.connection)
|
||||
}
|
||||
CopyDatabase::From(args) => {
|
||||
write!(f, "{} FROM {}", &args.database_name, &args.location)?;
|
||||
write!(f, "{} FROM {}", args.database_name, args.location)?;
|
||||
(&args.with, &args.connection)
|
||||
}
|
||||
};
|
||||
|
||||
@@ -456,7 +456,7 @@ impl CreateTable {
|
||||
if self.if_not_exists {
|
||||
write!(f, "IF NOT EXISTS ")?;
|
||||
}
|
||||
writeln!(f, "{} (", &self.name)?;
|
||||
writeln!(f, "{} (", self.name)?;
|
||||
for (index, column) in self.columns.iter().enumerate() {
|
||||
if index > 0 {
|
||||
f.write_str(LINE_SEP)?;
|
||||
@@ -471,7 +471,7 @@ impl CreateTable {
|
||||
if let Some(partitions) = &self.partitions {
|
||||
writeln!(f, "{partitions}")?;
|
||||
}
|
||||
writeln!(f, "ENGINE={}", &self.engine)?;
|
||||
writeln!(f, "ENGINE={}", self.engine)?;
|
||||
if !self.options.is_empty() {
|
||||
f.write_str("WITH(\n")?;
|
||||
self.options.write_sql(f, LINE_SEP, " ", complete)?;
|
||||
@@ -506,7 +506,7 @@ impl Display for CreateDatabase {
|
||||
if self.if_not_exists {
|
||||
write!(f, "IF NOT EXISTS ")?;
|
||||
}
|
||||
write!(f, "{}", &self.name)?;
|
||||
write!(f, "{}", self.name)?;
|
||||
if !self.options.is_empty() {
|
||||
let options = self.options.kv_pairs();
|
||||
write!(f, "\nWITH(\n{}\n)", format_list_indent!(options))?;
|
||||
@@ -533,11 +533,11 @@ impl Display for CreateExternalTable {
|
||||
if self.if_not_exists {
|
||||
write!(f, "IF NOT EXISTS ")?;
|
||||
}
|
||||
writeln!(f, "{} (", &self.name)?;
|
||||
writeln!(f, "{} (", self.name)?;
|
||||
writeln!(f, "{},", format_list_indent!(self.columns))?;
|
||||
writeln!(f, "{}", format_table_constraint(&self.constraints))?;
|
||||
writeln!(f, ")")?;
|
||||
writeln!(f, "ENGINE={}", &self.engine)?;
|
||||
writeln!(f, "ENGINE={}", self.engine)?;
|
||||
if !self.options.is_empty() {
|
||||
let options = self.options.kv_pairs();
|
||||
write!(f, "WITH(\n{}\n)", format_list_indent!(options))?;
|
||||
@@ -635,8 +635,8 @@ impl Display for CreateFlow {
|
||||
if self.if_not_exists {
|
||||
write!(f, "IF NOT EXISTS ")?;
|
||||
}
|
||||
writeln!(f, "{}", &self.flow_name)?;
|
||||
writeln!(f, "SINK TO {}", &self.sink_table_name)?;
|
||||
writeln!(f, "{}", self.flow_name)?;
|
||||
writeln!(f, "SINK TO {}", self.sink_table_name)?;
|
||||
if let Some(expire_after) = &self.expire_after {
|
||||
writeln!(f, "EXPIRE AFTER '{} s'", expire_after)?;
|
||||
}
|
||||
@@ -657,7 +657,7 @@ impl Display for CreateFlow {
|
||||
let options = self.flow_options.kv_pairs();
|
||||
writeln!(f, "WITH ({})", format_list_comma!(options))?;
|
||||
}
|
||||
write!(f, "AS {}", &self.query)
|
||||
write!(f, "AS {}", self.query)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -687,11 +687,11 @@ impl Display for CreateView {
|
||||
if self.if_not_exists {
|
||||
write!(f, "IF NOT EXISTS ")?;
|
||||
}
|
||||
write!(f, "{} ", &self.name)?;
|
||||
write!(f, "{} ", self.name)?;
|
||||
if !self.columns.is_empty() {
|
||||
write!(f, "({}) ", format_list_comma!(self.columns))?;
|
||||
}
|
||||
write!(f, "AS {}", &self.query)
|
||||
write!(f, "AS {}", self.query)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -258,10 +258,10 @@ impl Visit for OptionMap {
|
||||
|
||||
impl VisitMut for OptionMap {
|
||||
fn visit<V: VisitorMut>(&mut self, visitor: &mut V) -> ControlFlow<V::Break> {
|
||||
for (_, v) in self.options.iter_mut() {
|
||||
for v in self.options.values_mut() {
|
||||
v.visit(visitor)?;
|
||||
}
|
||||
for (_, v) in self.secrets.iter_mut() {
|
||||
for v in self.secrets.values_mut() {
|
||||
v.expose_secret_mut().visit(visitor)?;
|
||||
}
|
||||
ControlFlow::Continue(())
|
||||
|
||||
@@ -41,7 +41,7 @@ impl Display for ShowKind {
|
||||
macro_rules! format_kind {
|
||||
($self: expr, $f: expr) => {
|
||||
if $self.kind != ShowKind::All {
|
||||
write!($f, " {}", &$self.kind)?;
|
||||
write!($f, " {}", $self.kind)?;
|
||||
}
|
||||
};
|
||||
}
|
||||
@@ -71,7 +71,7 @@ impl Display for ShowColumns {
|
||||
if self.full {
|
||||
write!(f, "FULL ")?;
|
||||
}
|
||||
write!(f, "COLUMNS IN {}", &self.table)?;
|
||||
write!(f, "COLUMNS IN {}", self.table)?;
|
||||
if let Some(database) = &self.database {
|
||||
write!(f, " IN {database}")?;
|
||||
}
|
||||
@@ -90,7 +90,7 @@ pub struct ShowIndex {
|
||||
|
||||
impl Display for ShowIndex {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
write!(f, "SHOW INDEX IN {}", &self.table)?;
|
||||
write!(f, "SHOW INDEX IN {}", self.table)?;
|
||||
if let Some(database) = &self.database {
|
||||
write!(f, " IN {database}")?;
|
||||
}
|
||||
@@ -110,7 +110,7 @@ pub struct ShowRegion {
|
||||
|
||||
impl Display for ShowRegion {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
write!(f, "SHOW REGION IN {}", &self.table)?;
|
||||
write!(f, "SHOW REGION IN {}", self.table)?;
|
||||
if let Some(database) = &self.database {
|
||||
write!(f, " IN {database}")?;
|
||||
}
|
||||
|
||||
@@ -1143,7 +1143,7 @@ impl TableMeta {
|
||||
.with_context(|_| error::CastDefaultValueSnafu {
|
||||
reason: format!(
|
||||
"Failed to cast default value from {:?} to type {:?}",
|
||||
default_value, &change_column.target_type
|
||||
default_value, change_column.target_type
|
||||
),
|
||||
})?,
|
||||
)
|
||||
|
||||
@@ -505,13 +505,10 @@ fn extract_from_in_list_expr(
|
||||
for expr in list {
|
||||
if let Expr::Literal(scalar, _) = expr {
|
||||
return_none_if_utf8!(scalar);
|
||||
if let Some(timestamp) = scalar_value_to_timestamp(scalar, None) {
|
||||
init_range = init_range.or(&TimestampRange::single(timestamp))
|
||||
} else {
|
||||
// TODO(hl): maybe we should raise an error here since cannot parse
|
||||
// timestamp value from in list expr
|
||||
return None;
|
||||
}
|
||||
// TODO(hl): maybe we should raise an error here since cannot parse
|
||||
// timestamp value from in list expr
|
||||
let timestamp = scalar_value_to_timestamp(scalar, None)?;
|
||||
init_range = init_range.or(&TimestampRange::single(timestamp));
|
||||
}
|
||||
}
|
||||
Some(init_range)
|
||||
|
||||
@@ -188,7 +188,6 @@ impl Stream for MemtableStream {
|
||||
#[cfg(test)]
|
||||
mod test {
|
||||
use common_recordbatch::util;
|
||||
use datatypes::prelude::*;
|
||||
use datatypes::schema::ColumnSchema;
|
||||
use datatypes::vectors::{Helper, Int32Vector, StringVector};
|
||||
|
||||
|
||||
@@ -380,7 +380,7 @@ impl GreptimeDbClusterBuilder {
|
||||
let home_dir = if let Some(home_dir) = &self.shared_home_dir {
|
||||
home_dir.path().to_str().unwrap().to_string()
|
||||
} else {
|
||||
let home_tmp_dir = create_temp_dir(&format!("gt_home_{}", &self.cluster_name));
|
||||
let home_tmp_dir = create_temp_dir(&format!("gt_home_{}", self.cluster_name));
|
||||
let home_dir = home_tmp_dir.path().to_str().unwrap().to_string();
|
||||
guards.push(TestGuard {
|
||||
home_guard: FileDirGuard::new(home_tmp_dir),
|
||||
|
||||
@@ -385,7 +385,7 @@ impl GreptimeDbStandaloneBuilder {
|
||||
let procedure_config = ProcedureConfig::default();
|
||||
|
||||
let kv_backend = standalone::build_metadata_kvbackend(
|
||||
format!("{}/kv", &opts.storage.data_home),
|
||||
format!("{}/kv", opts.storage.data_home),
|
||||
kv_backend_config,
|
||||
)
|
||||
.unwrap();
|
||||
|
||||
@@ -2648,7 +2648,7 @@ async fn test_execute_copy_from_orc_with_cast(instance: Arc<dyn MockInstance>) {
|
||||
|
||||
let output = execute_sql(
|
||||
&instance,
|
||||
&format!("copy demo from '{}' WITH(FORMAT='orc');", &filepath),
|
||||
&format!("copy demo from '{}' WITH(FORMAT='orc');", filepath),
|
||||
)
|
||||
.await
|
||||
.data;
|
||||
@@ -2687,7 +2687,7 @@ async fn test_execute_copy_from_orc(instance: Arc<dyn MockInstance>) {
|
||||
|
||||
let output = execute_sql(
|
||||
&instance,
|
||||
&format!("copy demo from '{}' WITH(FORMAT='orc');", &filepath),
|
||||
&format!("copy demo from '{}' WITH(FORMAT='orc');", filepath),
|
||||
)
|
||||
.await
|
||||
.data;
|
||||
@@ -2724,7 +2724,7 @@ async fn test_cast_type_issue_1594(instance: Arc<dyn MockInstance>) {
|
||||
|
||||
let output = execute_sql(
|
||||
&instance,
|
||||
&format!("copy tsbs_cpu from '{}' WITH(FORMAT='csv');", &filepath),
|
||||
&format!("copy tsbs_cpu from '{}' WITH(FORMAT='csv');", filepath),
|
||||
)
|
||||
.await;
|
||||
|
||||
@@ -2762,7 +2762,7 @@ async fn test_copy_from_csv_skip_bad_records(instance: Arc<dyn MockInstance>) {
|
||||
&instance,
|
||||
&format!(
|
||||
"copy csv_skip_bad_records from '{}' WITH(FORMAT='csv', skip_bad_records='true');",
|
||||
&filepath
|
||||
filepath
|
||||
),
|
||||
)
|
||||
.await
|
||||
|
||||
Reference in New Issue
Block a user