Skip to content

Commit

Permalink
Merge remote-tracking branch 'bend-up/main' into feat/add-transaction…
Browse files Browse the repository at this point in the history
…-method
  • Loading branch information
hantmac committed Mar 19, 2024
2 parents 67d52bf + 58a0c12 commit 52f55c3
Show file tree
Hide file tree
Showing 15 changed files with 26 additions and 21 deletions.
10 changes: 5 additions & 5 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ members = [
resolver = "2"

[workspace.package]
version = "0.13.3"
version = "0.14.0"
edition = "2021"
license = "Apache-2.0"
authors = ["Databend Authors <[email protected]>"]
Expand All @@ -21,7 +21,7 @@ keywords = ["databend", "database"]
repository = "https://github.com/datafuselabs/bendsql"

[workspace.dependencies]
databend-client = { path = "core", version = "0.13.3" }
databend-driver = { path = "driver", version = "0.13.3" }
databend-driver-macros = { path = "macros", version = "0.13.3" }
databend-sql = { path = "sql", version = "0.13.3" }
databend-client = { path = "core", version = "0.14.0" }
databend-driver = { path = "driver", version = "0.14.0" }
databend-driver-macros = { path = "macros", version = "0.14.0" }
databend-sql = { path = "sql", version = "0.14.0" }
2 changes: 1 addition & 1 deletion bindings/nodejs/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ doc = false
[dependencies]
databend-driver = { workspace = true, features = ["rustls", "flight-sql"] }

chrono = { version = "0.4", default-features = false }
chrono = { version = "0.4.35", default-features = false }
napi = { version = "2.14", default-features = false, features = [
"napi6",
"async",
Expand Down
2 changes: 1 addition & 1 deletion bindings/nodejs/npm/darwin-arm64/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@databend-driver/lib-darwin-arm64",
"repository": "https://github.com/datafuselabs/bendsql.git",
"version": "0.13.3",
"version": "0.14.0",
"os": [
"darwin"
],
Expand Down
2 changes: 1 addition & 1 deletion bindings/nodejs/npm/darwin-x64/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@databend-driver/lib-darwin-x64",
"repository": "https://github.com/datafuselabs/bendsql.git",
"version": "0.13.3",
"version": "0.14.0",
"os": [
"darwin"
],
Expand Down
2 changes: 1 addition & 1 deletion bindings/nodejs/npm/linux-arm64-gnu/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@databend-driver/lib-linux-arm64-gnu",
"repository": "https://github.com/datafuselabs/bendsql.git",
"version": "0.13.3",
"version": "0.14.0",
"os": [
"linux"
],
Expand Down
2 changes: 1 addition & 1 deletion bindings/nodejs/npm/linux-x64-gnu/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@databend-driver/lib-linux-x64-gnu",
"repository": "https://github.com/datafuselabs/bendsql.git",
"version": "0.13.3",
"version": "0.14.0",
"os": [
"linux"
],
Expand Down
2 changes: 1 addition & 1 deletion bindings/nodejs/npm/win32-x64-msvc/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@databend-driver/lib-win32-x64-msvc",
"repository": "https://github.com/datafuselabs/bendsql.git",
"version": "0.13.3",
"version": "0.14.0",
"os": [
"win32"
],
Expand Down
2 changes: 1 addition & 1 deletion bindings/nodejs/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "databend-driver",
"author": "Databend Authors <[email protected]>",
"version": "0.13.3",
"version": "0.14.0",
"license": "Apache-2.0",
"main": "index.js",
"types": "index.d.ts",
Expand Down
2 changes: 1 addition & 1 deletion cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ databend-driver = { workspace = true, features = ["rustls", "flight-sql"] }

anyhow = "1.0"
async-trait = "0.1"
chrono = { version = "0.4.31", default-features = false, features = ["clock"] }
chrono = { version = "0.4.35", default-features = false, features = ["clock"] }
clap = { version = "4.4", features = ["derive", "env"] }
comfy-table = "7.1"
csv = "1.3"
Expand Down
2 changes: 1 addition & 1 deletion core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,4 @@ url = { version = "2.5", default-features = false }
uuid = { version = "1.6", features = ["v4"] }

[dev-dependencies]
chrono = { version = "0.4", default-features = false, features = ["clock"] }
chrono = { version = "0.4.35", default-features = false, features = ["clock"] }
2 changes: 1 addition & 1 deletion core/src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -323,10 +323,10 @@ impl APIClient {
}

let resp: QueryResponse = resp.json().await?;
self.handle_session(&resp.session).await;
if let Some(err) = resp.error {
return Err(Error::InvalidResponse(err));
}
self.handle_session(&resp.session).await;
self.handle_warnings(&resp);
Ok(resp)
}
Expand Down
2 changes: 1 addition & 1 deletion driver/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ databend-driver-macros = { workspace = true }
databend-sql = { workspace = true }

async-trait = "0.1"
chrono = { version = "0.4.31", default-features = false, features = ["clock"] }
chrono = { version = "0.4.35", default-features = false, features = ["clock"] }
csv = "1.3"
dyn-clone = "1.0"
glob = "0.3"
Expand Down
3 changes: 3 additions & 0 deletions driver/src/rest_api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,9 @@ impl Stream for RestAPIRows {
Some(ref mut next_page) => match Pin::new(next_page).poll(cx) {
Poll::Ready(Ok(resp)) => {
self.data = resp.data.into();
if self.schema.fields().is_empty() {
self.schema = Arc::new(resp.schema.try_into()?);
}
self.query_id = resp.id;
self.next_uri = resp.next_uri;
self.next_page = None;
Expand Down
2 changes: 1 addition & 1 deletion sql/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ flight-sql = ["dep:arrow-array", "dep:arrow-schema", "dep:tonic"]
[dependencies]
databend-client = { workspace = true }

chrono = { version = "0.4", default-features = false }
chrono = { version = "0.4.35", default-features = false }
geozero = { version = "0.12.0", features = ["default", "with-wkb"] }
glob = "0.3"
itertools = "0.12"
Expand Down
10 changes: 6 additions & 4 deletions sql/src/value.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
// limitations under the License.

use arrow::datatypes::{i256, ArrowNativeTypeOp};
use chrono::{Datelike, NaiveDate, NaiveDateTime};
use chrono::{DateTime, Datelike, NaiveDate, NaiveDateTime};

use crate::{
error::{ConvertError, Error, Result},
Expand Down Expand Up @@ -190,6 +190,7 @@ impl TryFrom<(&DataType, &str)> for Value {

DataType::Timestamp => Ok(Self::Timestamp(
chrono::NaiveDateTime::parse_from_str(v, "%Y-%m-%d %H:%M:%S%.6f")?
.and_utc()
.timestamp_micros(),
)),
DataType::Date => Ok(Self::Date(
Expand Down Expand Up @@ -527,9 +528,9 @@ impl TryFrom<Value> for NaiveDateTime {
Value::Timestamp(i) => {
let secs = i / 1_000_000;
let nanos = ((i % 1_000_000) * 1000) as u32;
let t = NaiveDateTime::from_timestamp_opt(secs, nanos);
let t = DateTime::from_timestamp(secs, nanos);
match t {
Some(t) => Ok(t),
Some(t) => Ok(t.naive_utc()),
None => Err(ConvertError::new("NaiveDateTime", "".to_string()).into()),
}
}
Expand Down Expand Up @@ -636,7 +637,8 @@ fn encode_value(f: &mut std::fmt::Formatter<'_>, val: &Value, raw: bool) -> std:
Value::Timestamp(i) => {
let secs = i / 1_000_000;
let nanos = ((i % 1_000_000) * 1000) as u32;
let t = NaiveDateTime::from_timestamp_opt(secs, nanos).unwrap_or_default();
let t = DateTime::from_timestamp(secs, nanos).unwrap_or_default();
let t = t.naive_utc();
if raw {
write!(f, "{}", t)
} else {
Expand Down

0 comments on commit 52f55c3

Please sign in to comment.