Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: applying clippy suggestions #1014

Merged
merged 2 commits into from
Dec 2, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/alerts/mod.rs
Original file line number Diff line number Diff line change
@@ -136,7 +136,7 @@ pub struct Message {
impl Message {
// checks if message (with a column name) is valid (i.e. the column name is present in the schema)
pub fn valid(&self, schema: &Schema, column: &str) -> bool {
return get_field(&schema.fields, column).is_some();
get_field(&schema.fields, column).is_some()
}

pub fn extract_column_names(&self) -> Vec<&str> {
3 changes: 2 additions & 1 deletion src/handlers/http/modal/utils/logstream_utils.rs
Original file line number Diff line number Diff line change
@@ -148,7 +148,8 @@ async fn update_stream(
return Ok(req.headers().clone());
}
validate_and_update_custom_partition(stream_name, custom_partition).await?;
return Ok(req.headers().clone());

Ok(req.headers().clone())
}

async fn validate_and_update_custom_partition(
38 changes: 18 additions & 20 deletions src/handlers/http/otel/opentelemetry.proto.resource.v1.rs
Original file line number Diff line number Diff line change
@@ -15,24 +15,22 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
// This file was generated by protoc-gen-rust-protobuf. The file was edited after the generation.
// All the repeated fields were changed to Option<Vec<T>>
// This file was generated by protoc-gen-rust-protobuf. The file was edited after the generation.
// All the repeated fields were changed to Option<Vec<T>>

use crate::handlers::http::otel::proto::common::v1::KeyValue;
use serde::{Deserialize, Serialize};

#[derive(Serialize, Deserialize, Debug)]
/// Resource information.
pub struct Resource {
/// Set of attributes that describe the resource.
/// Attribute keys MUST be unique (it is not allowed to have more than one
/// attribute with the same key).
#[serde(rename = "attributes")]
pub attributes: Option<Vec<KeyValue>>,
/// dropped_attributes_count is the number of dropped attributes. If the value is 0, then
/// no attributes were dropped.
#[serde(rename = "droppedAttributesCount")]
pub dropped_attributes_count: Option<u32>,
}

use crate::handlers::http::otel::proto::common::v1::KeyValue;
use serde::{Deserialize, Serialize};

#[derive(Serialize, Deserialize, Debug)]
/// Resource information.
pub struct Resource {
/// Set of attributes that describe the resource.
/// Attribute keys MUST be unique (it is not allowed to have more than one
/// attribute with the same key).
#[serde(rename = "attributes")]
pub attributes: Option<Vec<KeyValue>>,
/// dropped_attributes_count is the number of dropped attributes. If the value is 0, then
/// no attributes were dropped.
#[serde(rename = "droppedAttributesCount")]
pub dropped_attributes_count: Option<u32>,
}
47 changes: 23 additions & 24 deletions src/utils/arrow/mod.rs
Original file line number Diff line number Diff line change
@@ -17,6 +17,29 @@
*
*/

//! example function for concat recordbatch(may not work)
//! ```rust
//! # use arrow::record_batch::RecordBatch;
//! # use arrow::error::Result;
//!
//! fn concat_batches(batch1: RecordBatch, batch2: RecordBatch) -> Result<RecordBatch> {
//! let schema = batch1.schema();
//! let columns = schema
//! .fields()
//! .iter()
//! .enumerate()
//! .map(|(i, _)| -> Result<_> {
//! let array1 = batch1.column(i);
//! let array2 = batch2.column(i);
//! let array = arrow::compute::concat(&[array1.as_ref(), array2.as_ref()])?;
//! Ok(array)
//! })
//! .collect::<Result<Vec<_>>>()?;
//!
//! RecordBatch::try_new(schema.clone(), columns)
//! }
//! ```
use std::sync::Arc;

use arrow_array::{Array, RecordBatch};
@@ -33,30 +56,6 @@ pub use batch_adapter::adapt_batch;
pub use merged_reader::MergedRecordReader;
use serde_json::{Map, Value};

/// example function for concat recordbatch(may not work)
/// ```rust
/// # use arrow::record_batch::RecordBatch;
/// # use arrow::error::Result;
///
/// fn concat_batches(batch1: RecordBatch, batch2: RecordBatch) -> Result<RecordBatch> {
/// let schema = batch1.schema();
/// let columns = schema
/// .fields()
/// .iter()
/// .enumerate()
/// .map(|(i, _)| -> Result<_> {
/// let array1 = batch1.column(i);
/// let array2 = batch2.column(i);
/// let array = arrow::compute::concat(&[array1.as_ref(), array2.as_ref()])?;
/// Ok(array)
/// })
/// .collect::<Result<Vec<_>>>()?;
///
/// RecordBatch::try_new(schema.clone(), columns)
/// }
/// ```
///
/// Replaces columns in a record batch with new arrays.
///
/// # Arguments