diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index b12d524f1..9a4c8e830 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -8,7 +8,7 @@ on: env: # NOTE: the version is also defined in roapi_release.yml and Dockerfile - RUST_TC_VER: "1.83.0" + RUST_TC_VER: "1.84.0" jobs: build: diff --git a/.github/workflows/columnq_cli_release.yml b/.github/workflows/columnq_cli_release.yml index 8032d8fcf..719ff72fa 100644 --- a/.github/workflows/columnq_cli_release.yml +++ b/.github/workflows/columnq_cli_release.yml @@ -12,7 +12,7 @@ on: env: # NOTE: the version is also defined in build.yml and Dockerfile - RUST_TC_VER: "1.83.0" + RUST_TC_VER: "1.84.0" jobs: # skip tag version validation on non-release branch run diff --git a/.github/workflows/roapi_release.yml b/.github/workflows/roapi_release.yml index 18b4a5506..169f2febe 100644 --- a/.github/workflows/roapi_release.yml +++ b/.github/workflows/roapi_release.yml @@ -12,7 +12,7 @@ on: env: # NOTE: the version is also defined in build.yml and Dockerfile - RUST_TC_VER: "1.83.0" + RUST_TC_VER: "1.84.0" jobs: validate-release-tag: @@ -108,7 +108,7 @@ jobs: - name: Upload wheels uses: actions/upload-artifact@v4 with: - name: wheels-widnows + name: wheels-windows path: dist - name: Archive binary if: "startsWith(github.ref, 'refs/tags/')" diff --git a/Cargo.lock b/Cargo.lock index 606ab3349..465936480 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1451,7 +1451,7 @@ checksum = "5b63caa9aa9397e2d9480a9b13673856c78d8ac123288526c37d7839f2a86990" [[package]] name = "columnq" -version = "0.9.3" +version = "0.9.4" dependencies = [ "bytes", "calamine", @@ -1463,7 +1463,6 @@ dependencies = [ "graphql-parser", "hyper-rustls 0.24.2", "hyper-tls", - "lazy_static", "log", "object_store", "percent-encoding", @@ -5023,7 +5022,7 @@ dependencies = [ [[package]] name = "roapi" -version = "0.12.3" +version = "0.12.4" dependencies = [ "arrow-cast", "arrow-flight", @@ -5058,7 +5057,7 @@ dependencies = [ "tokio-stream", "toml", "tonic", - "tower 0.5.2", + "tower 0.4.13", "tower-http", "tower-layer", "tower-service", diff --git a/Dockerfile b/Dockerfile index ff267923a..224a5f8dc 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -ARG RUST_VER=1.83.0-bookworm +ARG RUST_VER=1.84.0-bookworm ARG RUSTFLAGS='-C target-cpu=skylake' ARG FEATURES="database" diff --git a/README.md b/README.md index 6eabe584d..b7b663c24 100644 --- a/README.md +++ b/README.md @@ -125,7 +125,7 @@ advanced format specific table options: ```yaml addr: - http: 0.0.0.0:8084 + http: 0.0.0.0:8080 postgres: 0.0.0.0:5433 tables: - name: "blogs" diff --git a/columnq/Cargo.toml b/columnq/Cargo.toml index d398e541d..ea4e18351 100644 --- a/columnq/Cargo.toml +++ b/columnq/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "columnq" -version = "0.9.3" +version = "0.9.4" homepage = "https://github.com/roapi/roapi" license = "MIT" authors = ["QP Hou "] @@ -14,7 +14,6 @@ path = "src/lib.rs" url = "2.5" log = "0.4" regex = "1" -lazy_static = "1.5" thiserror = "1" snafu = "0.8" serde_json = { version = "1" } diff --git a/columnq/src/query/rest.rs b/columnq/src/query/rest.rs index 92a62e9c5..4d7478c5f 100644 --- a/columnq/src/query/rest.rs +++ b/columnq/src/query/rest.rs @@ -1,4 +1,5 @@ use std::collections::HashMap; +use std::sync::LazyLock; use datafusion::arrow::record_batch::RecordBatch; use datafusion::logical_expr::Operator; @@ -56,16 +57,14 @@ fn num_parse_err(e: std::num::ParseIntError) -> QueryError { } } +static RE_REST_FILTER: LazyLock = + LazyLock::new(|| Regex::new(r"filter\[(?P.+)\](?P.+)?").unwrap()); + /// Applies a rest query to the provided DataFrame. pub fn apply_query( mut df: datafusion::dataframe::DataFrame, params: &HashMap, ) -> Result { - lazy_static::lazy_static! { - static ref RE_REST_FILTER: Regex = - Regex::new(r"filter\[(?P.+)\](?P.+)?").unwrap(); - } - // filter[col1]eq='foo' // filter[col2]lt=2 for (key, val) in params.iter().filter(|(k, _)| k.starts_with("filter[")) { diff --git a/columnq/src/table/google_spreadsheets.rs b/columnq/src/table/google_spreadsheets.rs index f990d41ae..4944d19cf 100644 --- a/columnq/src/table/google_spreadsheets.rs +++ b/columnq/src/table/google_spreadsheets.rs @@ -1,5 +1,6 @@ use std::collections::{HashMap, HashSet}; use std::sync::Arc; +use std::sync::LazyLock; use datafusion::arrow::array::{ArrayRef, BooleanArray, PrimitiveArray, StringArray}; use datafusion::arrow::datatypes::{DataType, Field, Schema}; @@ -256,10 +257,10 @@ async fn fetch_auth_token( sa.token(scopes).await.context(ObtainTokenSnafu) } -async fn resolve_sheet_title<'a, 'b, 'c, 'd>( - token: &'a str, - spreadsheet_id: &'b str, - uri: &'c URIReference<'d>, +async fn resolve_sheet_title( + token: &str, + spreadsheet_id: &str, + uri: &URIReference<'_>, ) -> Result { // look up sheet title by sheet id through API let resp = gs_api_get( @@ -315,11 +316,10 @@ struct GetReqContext { url: String, } +static RE_GOOGLE_SHEET: LazyLock = + LazyLock::new(|| Regex::new(r"https://docs.google.com/spreadsheets/d/(.+)").unwrap()); + async fn gs_get_req_contex(t: &TableSource) -> Result { - lazy_static::lazy_static! { - static ref RE_GOOGLE_SHEET: Regex = - Regex::new(r"https://docs.google.com/spreadsheets/d/(.+)").unwrap(); - } let uri_str = t.get_uri_str(); if RE_GOOGLE_SHEET.captures(uri_str).is_none() { return Err(Error::InvalidUri { diff --git a/roapi/Cargo.toml b/roapi/Cargo.toml index d16695d4e..dee99992d 100644 --- a/roapi/Cargo.toml +++ b/roapi/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "roapi" -version = "0.12.3" +version = "0.12.4" authors = ["QP Hou "] homepage = "https://github.com/roapi/roapi" license = "MIT" @@ -72,6 +72,7 @@ snmalloc = ["snmalloc-rs"] database = ["columnq/database"] database-sqlite = ["columnq/database-sqlite"] database-mysql = ["columnq/database-mysql"] +database-postgres = ["columnq/database-postgres"] [dev-dependencies] reqwest = { version = "0", default-features = false, features = [ diff --git a/roapi/src/config.rs b/roapi/src/config.rs index 126eeb2c8..1cf279384 100644 --- a/roapi/src/config.rs +++ b/roapi/src/config.rs @@ -137,12 +137,28 @@ fn config_arg() -> clap::Arg { } pub fn get_cmd() -> clap::Command { + let features: &[&'static str] = &[ + #[cfg(feature = "database")] + "database", + #[cfg(feature = "database-sqlite")] + "database-sqlite", + #[cfg(feature = "database-postgres")] + "database-postgres", + #[cfg(feature = "database-mysql")] + "database-mysql", + #[cfg(feature = "snmalloc")] + "snmalloc", + #[cfg(feature = "rustls")] + "rustls", + ]; + clap::Command::new("roapi") .version(env!("CARGO_PKG_VERSION")) .author("QP Hou") .about( "Create full-fledged APIs for static datasets without writing a single line of code.", ) + .after_help(format!("Built with features: {}", features.join(", "))) .arg_required_else_help(true) .args(&[ address_http_arg(),