mirror of
https://github.com/roapi/roapi.git
synced 2026-06-05 21:04:02 +08:00
fix clippy errors
Some checks failed
build / build (push) Has been cancelled
build / build_ui (push) Has been cancelled
build / database_test (push) Has been cancelled
build / object_store_memory_test (push) Has been cancelled
build / object_store_direct_test (push) Has been cancelled
build / openssl_build (push) Has been cancelled
build / mac_cross_build (push) Has been cancelled
build / Docker Image Build (push) Has been cancelled
columnq-cli release / Validate git tag (push) Has been cancelled
roapi release / Validate git tag (push) Has been cancelled
columnq-cli release / macos (push) Has been cancelled
columnq-cli release / windows (map[features:database-sqlite python-architecture:x64 target:x86_64-pc-windows-msvc]) (push) Has been cancelled
columnq-cli release / linux (map[features:rustls,database-sqlite image_tag:aarch64-musl manylinux:2014 name_suffix: target:aarch64-unknown-linux-musl upload:true]) (push) Has been cancelled
columnq-cli release / linux (map[features:rustls,database-sqlite image_tag:x86_64-musl manylinux:2010 name_suffix: target:x86_64-unknown-linux-musl upload:true]) (push) Has been cancelled
columnq-cli release / PyPI Release (push) Has been cancelled
roapi release / macos (push) Has been cancelled
roapi release / windows (map[features:database-sqlite python-architecture:x64 target:x86_64-pc-windows-msvc]) (push) Has been cancelled
roapi release / linux (map[features:rustls,database-sqlite image_tag:aarch64-musl manylinux:2014 name_suffix: target:aarch64-unknown-linux-musl upload:true]) (push) Has been cancelled
roapi release / linux (map[features:rustls,database-sqlite image_tag:x86_64-musl manylinux:2010 name_suffix: target:x86_64-unknown-linux-musl upload:true]) (push) Has been cancelled
roapi release / PyPI Release (push) Has been cancelled
roapi release / Docker Image Release (push) Has been cancelled
Scheduled security audit / audit (push) Has been cancelled
Some checks failed
build / build (push) Has been cancelled
build / build_ui (push) Has been cancelled
build / database_test (push) Has been cancelled
build / object_store_memory_test (push) Has been cancelled
build / object_store_direct_test (push) Has been cancelled
build / openssl_build (push) Has been cancelled
build / mac_cross_build (push) Has been cancelled
build / Docker Image Build (push) Has been cancelled
columnq-cli release / Validate git tag (push) Has been cancelled
roapi release / Validate git tag (push) Has been cancelled
columnq-cli release / macos (push) Has been cancelled
columnq-cli release / windows (map[features:database-sqlite python-architecture:x64 target:x86_64-pc-windows-msvc]) (push) Has been cancelled
columnq-cli release / linux (map[features:rustls,database-sqlite image_tag:aarch64-musl manylinux:2014 name_suffix: target:aarch64-unknown-linux-musl upload:true]) (push) Has been cancelled
columnq-cli release / linux (map[features:rustls,database-sqlite image_tag:x86_64-musl manylinux:2010 name_suffix: target:x86_64-unknown-linux-musl upload:true]) (push) Has been cancelled
columnq-cli release / PyPI Release (push) Has been cancelled
roapi release / macos (push) Has been cancelled
roapi release / windows (map[features:database-sqlite python-architecture:x64 target:x86_64-pc-windows-msvc]) (push) Has been cancelled
roapi release / linux (map[features:rustls,database-sqlite image_tag:aarch64-musl manylinux:2014 name_suffix: target:aarch64-unknown-linux-musl upload:true]) (push) Has been cancelled
roapi release / linux (map[features:rustls,database-sqlite image_tag:x86_64-musl manylinux:2010 name_suffix: target:x86_64-unknown-linux-musl upload:true]) (push) Has been cancelled
roapi release / PyPI Release (push) Has been cancelled
roapi release / Docker Image Release (push) Has been cancelled
Scheduled security audit / audit (push) Has been cancelled
This commit is contained in:
parent
f01f6b4d9e
commit
162dbfe5ad
@ -48,7 +48,7 @@ async fn console_loop(cq: &ColumnQ) -> anyhow::Result<()> {
|
||||
|
||||
let mut readline = Editor::<()>::new();
|
||||
if let Err(e) = readline.load_history(&rl_history) {
|
||||
debug!("no query history loaded: {:?}", e);
|
||||
debug!("no query history loaded: {e:?}");
|
||||
}
|
||||
|
||||
loop {
|
||||
|
||||
@ -215,8 +215,7 @@ impl ColumnQ {
|
||||
|
||||
let object_store: DatafusionResult<Arc<DynObjectStore>> = match url.host() {
|
||||
None => Err(DataFusionError::Execution(format!(
|
||||
"Missing bucket name: {}",
|
||||
url
|
||||
"Missing bucket name: {url}"
|
||||
))),
|
||||
Some(host) => {
|
||||
match blob_type {
|
||||
|
||||
@ -52,7 +52,7 @@ where
|
||||
// TODO: load partitions in parallel
|
||||
let partitions = path_iter
|
||||
.map(|fpath| {
|
||||
debug!("loading file from path: {}", fpath);
|
||||
debug!("loading file from path: {fpath}");
|
||||
let reader = fs::File::open(fpath).context(FileOpenSnafu { fpath })?;
|
||||
|
||||
partition_reader(reader).context(TableSnafu)
|
||||
@ -83,6 +83,6 @@ where
|
||||
let files =
|
||||
build_file_list(&fs_path, &file_ext).context(FileListSnafu { fs_path, file_ext })?;
|
||||
|
||||
debug!("loading file partitions: {:?}", files);
|
||||
debug!("loading file partitions: {files:?}");
|
||||
partitions_from_iterator(files.iter().map(|s| s.as_str()), partition_reader)
|
||||
}
|
||||
|
||||
@ -74,7 +74,7 @@ where
|
||||
Err(Error::Status {
|
||||
status: resp.status(),
|
||||
uri: uri.to_string(),
|
||||
resp: format!("{:?}", resp),
|
||||
resp: format!("{resp:?}"),
|
||||
})?;
|
||||
}
|
||||
let reader = std::io::Cursor::new(resp.bytes().await.context(ReadBytesSnafu { uri })?);
|
||||
|
||||
@ -51,7 +51,7 @@ impl TryFrom<Option<&uriparse::Scheme<'_>>> for BlobStoreType {
|
||||
Some(uriparse::Scheme::HTTP) | Some(uriparse::Scheme::HTTPS) => Ok(BlobStoreType::Http),
|
||||
Some(uriparse::Scheme::Unregistered(s)) => BlobStoreType::try_from(s.as_str()),
|
||||
_ => Err(Error::InvalidUriScheme {
|
||||
scheme: format!("{:?}", scheme),
|
||||
scheme: format!("{scheme:?}"),
|
||||
}),
|
||||
}
|
||||
}
|
||||
|
||||
@ -49,7 +49,7 @@ mod imp {
|
||||
}
|
||||
.unwrap_or(t.name.clone());
|
||||
|
||||
let queries = CXQuery::naked(format!("SELECT * FROM {}", table_name));
|
||||
let queries = CXQuery::naked(format!("SELECT * FROM {table_name}"));
|
||||
let source = SourceConn::try_from(t.get_uri_str())
|
||||
.context(SourceSnafu)
|
||||
.map_err(Box::new)
|
||||
|
||||
@ -184,8 +184,8 @@ fn infer_schema_from_config(table_schema: &TableSchema) -> Result<Schema, Error>
|
||||
if unsupported_data_types.is_empty() {
|
||||
Ok(table_schema.into())
|
||||
} else {
|
||||
Err(Error::IncorrectSchema{msg: format!("Configured schema for excel file contains unsupported data types in columns {}. Supported datatype: \
|
||||
Boolean, Int64, Float64, Date32, Date64, !Timestamp [Second, null], !Duration [Second], Null, Utf8", unsupported_data_types)})
|
||||
Err(Error::IncorrectSchema{msg: format!("Configured schema for excel file contains unsupported data types in columns {unsupported_data_types}. Supported datatype: \
|
||||
Boolean, Int64, Float64, Date32, Date64, !Timestamp [Second, null], !Duration [Second], Null, Utf8")})
|
||||
}
|
||||
}
|
||||
|
||||
@ -193,7 +193,7 @@ fn empty_or_panic<T>(v: &ExcelDataType, field_name: &String) -> Option<T> {
|
||||
if v.is_empty() {
|
||||
None
|
||||
} else {
|
||||
panic!("Incorrect value {:?} in column {}", v, field_name)
|
||||
panic!("Incorrect value {v:?} in column {field_name}")
|
||||
}
|
||||
}
|
||||
|
||||
@ -338,7 +338,7 @@ fn excel_range_to_record_batch(
|
||||
})
|
||||
.collect::<PrimitiveArray<Date32Type>>(),
|
||||
) as ArrayRef,
|
||||
unsupported => panic!("Unsupported data type for excel table {:?}", unsupported),
|
||||
unsupported => panic!("Unsupported data type for excel table {unsupported:?}"),
|
||||
}
|
||||
})
|
||||
.collect::<Vec<ArrayRef>>();
|
||||
|
||||
@ -259,7 +259,7 @@ mod tests {
|
||||
let tmp_dir = tempfile::TempDir::new().unwrap();
|
||||
let tmp_file_path = tmp_dir.path().join("nested.json");
|
||||
let mut f = std::fs::File::create(tmp_file_path.clone()).unwrap();
|
||||
writeln!(f, "{}", json_content).unwrap();
|
||||
writeln!(f, "{json_content}").unwrap();
|
||||
|
||||
let ctx = SessionContext::new();
|
||||
let t = to_mem_table(
|
||||
|
||||
@ -643,7 +643,7 @@ impl TableSource {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn parsed_uri(&self) -> Result<URIReference, Error> {
|
||||
pub fn parsed_uri(&self) -> Result<URIReference<'_>, Error> {
|
||||
match &self.io_source {
|
||||
TableIoSource::Uri(uri) => {
|
||||
URIReference::try_from(uri.as_str()).map_err(|_| Error::InvalidUri {
|
||||
@ -1096,9 +1096,8 @@ schema:
|
||||
let t: TableSource = serde_yaml::from_str(&format!(
|
||||
r#"
|
||||
name: "uk_cities"
|
||||
uri: "sqlite://../test_data/sqlite/sample.{}"
|
||||
"#,
|
||||
ext
|
||||
uri: "sqlite://../test_data/sqlite/sample.{ext}"
|
||||
"#
|
||||
))
|
||||
.unwrap();
|
||||
let ctx = datafusion::prelude::SessionContext::new();
|
||||
|
||||
@ -140,7 +140,7 @@ impl ROAPIUI {
|
||||
}
|
||||
Err(e) => {
|
||||
self.show_error = true;
|
||||
self.error = Some(format!("Failed to parse query result: {}", e));
|
||||
self.error = Some(format!("Failed to parse query result: {e}"));
|
||||
}
|
||||
},
|
||||
_ => {
|
||||
@ -161,7 +161,7 @@ impl ROAPIUI {
|
||||
},
|
||||
Err(e) => {
|
||||
self.show_error = true;
|
||||
self.error = Some(format!("Failed to send request: {}", e));
|
||||
self.error = Some(format!("Failed to send request: {e}"));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -183,7 +183,7 @@ impl ROAPIUI {
|
||||
}
|
||||
},
|
||||
Err(e) => {
|
||||
self.schema_fetching_message = Some(format!("Failed to fetch schema: {}", e));
|
||||
self.schema_fetching_message = Some(format!("Failed to fetch schema: {e}"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -210,15 +210,15 @@ pub fn get_configuration(cmd: clap::Command) -> Result<Config, Whatever> {
|
||||
}
|
||||
|
||||
if let Some(addr) = matches.get_one::<String>("addr-http") {
|
||||
config.addr.http = Some(addr.to_owned());
|
||||
config.addr.http = Some(addr.clone());
|
||||
}
|
||||
|
||||
if let Some(addr) = matches.get_one::<String>("addr-postgres") {
|
||||
config.addr.postgres = Some(addr.to_owned());
|
||||
config.addr.postgres = Some(addr.clone());
|
||||
}
|
||||
|
||||
if let Some(addr) = matches.get_one::<String>("addr-flight-sql") {
|
||||
config.addr.flight_sql = Some(addr.to_owned());
|
||||
config.addr.flight_sql = Some(addr.clone());
|
||||
}
|
||||
|
||||
if matches.get_one::<bool>("disable-read-only") == Some(&true) {
|
||||
@ -229,7 +229,7 @@ pub fn get_configuration(cmd: clap::Command) -> Result<Config, Whatever> {
|
||||
if !config.disable_read_only {
|
||||
whatever!("Table reload not supported in read-only mode. Try specify the --disable-read-only option.");
|
||||
}
|
||||
config.reload_interval = Some(Duration::from_secs(reload_interval.to_owned()));
|
||||
config.reload_interval = Some(Duration::from_secs(*reload_interval));
|
||||
}
|
||||
|
||||
if let Some(response_format) = matches.get_one::<String>("response-format") {
|
||||
@ -249,7 +249,7 @@ impl Config {
|
||||
let mut opt = ConfigOptions::default();
|
||||
for (k, v) in df_cfg {
|
||||
whatever!(
|
||||
opt.set(format!("datafusion.{}", k).as_str(), v),
|
||||
opt.set(format!("datafusion.{k}").as_str(), v),
|
||||
"failed to set datafusion config: {k}={v}"
|
||||
);
|
||||
}
|
||||
|
||||
@ -22,7 +22,6 @@ async fn main() {
|
||||
}
|
||||
.await;
|
||||
if let Err(e) = re {
|
||||
cmd.error(clap::error::ErrorKind::Io, format!("{}", e))
|
||||
.exit();
|
||||
cmd.error(clap::error::ErrorKind::Io, format!("{e}")).exit();
|
||||
}
|
||||
}
|
||||
|
||||
@ -285,8 +285,7 @@ impl<H: RoapiContext> FlightSqlService for RoapiFlightSqlService<H> {
|
||||
|
||||
if !message.is::<FetchResults>() {
|
||||
Err(Status::unimplemented(format!(
|
||||
"do_get_fallback: The defined request is invalid: {:?}",
|
||||
message
|
||||
"do_get_fallback: The defined request is invalid: {message:?}"
|
||||
)))?
|
||||
}
|
||||
|
||||
@ -984,7 +983,7 @@ impl<H: RoapiContext> RoapiFlightSqlServer<H> {
|
||||
// when only basic auth is specified, handshake will return encoded basic auth
|
||||
// value as token to keep it constant
|
||||
(None, Some(BasicAuth { username, password })) => {
|
||||
let token = BASE64_STANDARD_NO_PAD.encode(format!("{}:{}", username, password));
|
||||
let token = BASE64_STANDARD_NO_PAD.encode(format!("{username}:{password}"));
|
||||
Some(token)
|
||||
}
|
||||
(None, None) => None,
|
||||
|
||||
@ -113,7 +113,7 @@ impl<H: RoapiContext> RoapiQueryHandler<H> {
|
||||
}
|
||||
|
||||
async fn execute_query(&self, query: &str) -> PgWireResult<QueryResponse<'static>> {
|
||||
info!("executing query: {}", query);
|
||||
info!("executing query: {query}");
|
||||
|
||||
// Handle some special PostgreSQL queries
|
||||
if query.trim().to_lowercase().starts_with("show") {
|
||||
@ -549,7 +549,7 @@ impl<H: RoapiContext> RunnableServer for PostgresServer<H> {
|
||||
let factory = Arc::new(RoapiHandlerFactory { handler });
|
||||
|
||||
if let Err(e) = process_socket(socket, None, factory).await {
|
||||
log::error!("Error processing postgres connection: {}", e);
|
||||
log::error!("Error processing postgres connection: {e}");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@ -75,7 +75,7 @@ impl Application {
|
||||
let _handle = tokio::task::spawn(async move {
|
||||
loop {
|
||||
if let Err(e) = ctx_ext.refresh_tables().await {
|
||||
error!("Failed to refresh table: {:?}", e);
|
||||
error!("Failed to refresh table: {e:?}");
|
||||
}
|
||||
time::sleep(Duration::from_millis(1000)).await;
|
||||
}
|
||||
|
||||
@ -267,7 +267,7 @@ async fn test_http2() {
|
||||
.unwrap()
|
||||
.stdout;
|
||||
|
||||
let two = vec!['\'', '2', '\n', '\'']
|
||||
let two = ['\'', '2', '\n', '\'']
|
||||
.iter()
|
||||
.map(|c| *c as u8)
|
||||
.collect::<Vec<_>>();
|
||||
|
||||
@ -12,7 +12,7 @@ fn test_load_yaml_datafusion_config() {
|
||||
let df_cfg = cfg.get_datafusion_config().unwrap();
|
||||
|
||||
assert_eq!(df_cfg.options().sql_parser.dialect, "Hive");
|
||||
assert_eq!(df_cfg.options().explain.physical_plan_only, true);
|
||||
assert!(df_cfg.options().explain.physical_plan_only);
|
||||
assert_eq!(df_cfg.options().optimizer.max_passes, 10);
|
||||
assert_eq!(df_cfg.options().execution.batch_size, 100);
|
||||
assert_eq!(df_cfg.options().catalog.format, Some("parquet".to_string()));
|
||||
|
||||
@ -5,7 +5,7 @@ use columnq::table::{TableColumn, TableLoadOption, TableOptionCsv, TableSource};
|
||||
|
||||
fn partitioned_csv_table() -> TableSource {
|
||||
let table_path = helpers::test_data_path("partitioned_csv");
|
||||
let table = TableSource::new("partitioned_csv".to_string(), table_path)
|
||||
TableSource::new("partitioned_csv".to_string(), table_path)
|
||||
.with_option(TableLoadOption::csv(
|
||||
TableOptionCsv::default().with_use_memory_table(false),
|
||||
))
|
||||
@ -20,9 +20,7 @@ fn partitioned_csv_table() -> TableSource {
|
||||
data_type: DataType::UInt16,
|
||||
nullable: false,
|
||||
},
|
||||
]);
|
||||
|
||||
table
|
||||
])
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
|
||||
Loading…
Reference in New Issue
Block a user