diff --git a/Cargo.lock b/Cargo.lock index c744c4f..95ab0bc 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1001,7 +1001,7 @@ checksum = "acbf1af155f9b9ef647e42cdc158db4b64a1b61f743629225fde6f3e0be2a7c7" [[package]] name = "columnq" -version = "0.7.0" +version = "0.8.0" dependencies = [ "arrow-schema", "bytes", @@ -2631,12 +2631,6 @@ dependencies = [ "vcpkg", ] -[[package]] -name = "linked-hash-map" -version = "0.5.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0717cef1bc8b636c6e1c1bbdefc09e6322da8a9321966e8928ef80d20f7f770f" - [[package]] name = "linux-raw-sys" version = "0.3.8" @@ -3797,7 +3791,7 @@ dependencies = [ [[package]] name = "roapi" -version = "0.10.0" +version = "0.11.0" dependencies = [ "arrow-cast", "arrow-flight", @@ -4315,14 +4309,15 @@ dependencies = [ [[package]] name = "serde_yaml" -version = "0.8.26" +version = "0.9.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "578a7433b776b56a35785ed5ce9a7e777ac0598aac5a6dd1b4b18a307c7fc71b" +checksum = "1a49e178e4452f45cb61d0cd8cebc1b0fafd3e41929e996cef79aa3aca91f574" dependencies = [ - "indexmap 1.9.3", + "indexmap 2.0.0", + "itoa", "ryu", "serde", - "yaml-rust", + "unsafe-libyaml", ] [[package]] @@ -5104,6 +5099,12 @@ dependencies = [ "void", ] +[[package]] +name = "unsafe-libyaml" +version = "0.2.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f28467d3e1d3c6586d8f25fa243f544f5800fec42d97032474e17222c2b75cfa" + [[package]] name = "untrusted" version = "0.7.1" @@ -5483,15 +5484,6 @@ dependencies = [ "lzma-sys", ] -[[package]] -name = "yaml-rust" -version = "0.4.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "56c1936c4cc7a1c9ab21a1ebb602eb942ba868cbd44a99cb7cdc5892335e1c85" -dependencies = [ - "linked-hash-map", -] - [[package]] name = "yansi" version = "0.5.1" diff --git a/columnq/Cargo.toml b/columnq/Cargo.toml index eff7579..4d979b7 100644 --- a/columnq/Cargo.toml +++ b/columnq/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "columnq" -version = "0.7.0" +version = "0.8.0" homepage = "https://github.com/roapi/roapi" license = "MIT" authors = ["QP Hou "] @@ -62,7 +62,7 @@ features = ["default", "dst_arrow"] optional = true [dev-dependencies] -serde_yaml = "0.8" +serde_yaml = "0.9" toml = "0.7" tempfile = "3.3.0" pretty_assertions = "*" diff --git a/columnq/src/table/mod.rs b/columnq/src/table/mod.rs index 9471d7e..63704ae 100644 --- a/columnq/src/table/mod.rs +++ b/columnq/src/table/mod.rs @@ -766,6 +766,28 @@ batch_size: 512 assert_eq!(table_source.batch_size, 512); } + #[test] + fn deserialize_datetime() { + let table_source: TableSource = serde_yaml::from_str( + r#" +name: "ts_table" +uri: "test_data/a.parquet" +schema: + columns: + - name: "ts" + data_type: !Timestamp [!Second, null] +"#, + ) + .unwrap(); + + use arrow::datatypes::*; + + assert_eq!( + DataType::Timestamp(TimeUnit::Second, None), + table_source.schema.unwrap().columns[0].data_type, + ); + } + #[test] fn test_parse_table_uri() { let t = parse_table_uri_arg("t=a/b/c").unwrap(); diff --git a/roapi/Cargo.toml b/roapi/Cargo.toml index 692fc81..7d67693 100644 --- a/roapi/Cargo.toml +++ b/roapi/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "roapi" -version = "0.10.0" +version = "0.11.0" authors = ["QP Hou "] homepage = "https://github.com/roapi/roapi" license = "MIT" @@ -34,7 +34,7 @@ log = "0" serde = { version = "1", features = ["rc"] } serde_json = "1" serde_derive = "1" -serde_yaml = "0.8" +serde_yaml = "0.9" toml = "0.7" clap = { version = "4", features = ["color"] } thiserror = "1" diff --git a/roapi/src/server/flight_sql.rs b/roapi/src/server/flight_sql.rs index 795f551..5bf972d 100644 --- a/roapi/src/server/flight_sql.rs +++ b/roapi/src/server/flight_sql.rs @@ -240,7 +240,7 @@ impl FlightSqlService for RoapiFlightSqlService { info!("getting results for {handle}"); let result = self.get_result(&handle)?; // if we get an empty result, create an empty schema - let (schema, batches) = match result.get(0) { + let (schema, batches) = match result.first() { None => (Arc::new(Schema::empty()), vec![]), Some(batch) => (batch.schema(), result.clone()), }; @@ -286,7 +286,7 @@ impl FlightSqlService for RoapiFlightSqlService { .map_err(|e| internal_error!("Error executing query", e))?; // if we get an empty result, create an empty schema - let schema = match result.get(0) { + let schema = match result.first() { None => Schema::empty(), Some(batch) => (*batch.schema()).clone(), }; @@ -364,7 +364,7 @@ impl FlightSqlService for RoapiFlightSqlService { .map_err(|e| internal_error!("Error executing query", e))?; // if we get an empty result, create an empty schema - let schema = match result.get(0) { + let schema = match result.first() { None => Schema::empty(), Some(batch) => (*batch.schema()).clone(), }; @@ -632,7 +632,7 @@ impl FlightSqlService for RoapiFlightSqlService { // TODO: ignore SYSTEM TABLE and VIEW let table_type = query .table_types - .get(0) + .first() .map(|s| s.as_str()) .unwrap_or_else(|| "table") .to_string();