Skip to content

Commit

Permalink
Update base64 lib and fix compilation failure in flight_sql.rs
Browse files Browse the repository at this point in the history
  • Loading branch information
ahmedriza committed Oct 21, 2023
1 parent 1063e0a commit a3c53aa
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
10 changes: 8 additions & 2 deletions ballista/core/src/serde/scheduler/to_proto.rs
Original file line number Diff line number Diff line change
Expand Up @@ -158,12 +158,18 @@ impl TryInto<protobuf::OperatorMetric> for &MetricValue {
}),
MetricValue::StartTimestamp(timestamp) => Ok(protobuf::OperatorMetric {
metric: Some(operator_metric::Metric::StartTimestamp(
timestamp.value().map(|m| m.timestamp_nanos()).unwrap_or(0),
timestamp
.value()
.map(|m| m.timestamp_nanos_opt().unwrap())
.unwrap_or(0),
)),
}),
MetricValue::EndTimestamp(timestamp) => Ok(protobuf::OperatorMetric {
metric: Some(operator_metric::Metric::EndTimestamp(
timestamp.value().map(|m| m.timestamp_nanos()).unwrap_or(0),
timestamp
.value()
.map(|m| m.timestamp_nanos_opt().unwrap())
.unwrap_or(0),
)),
}),
}
Expand Down
2 changes: 1 addition & 1 deletion ballista/scheduler/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ arrow-flight = { workspace = true }
async-recursion = "1.0.0"
async-trait = "0.1.41"
ballista-core = { path = "../core", version = "0.11.0", features = ["s3"] }
base64 = { version = "0.13", default-features = false }
base64 = { version = "0.21", default-features = false }
clap = { version = "3", features = ["derive", "cargo"] }
configure_me = { workspace = true }
dashmap = "5.4.0"
Expand Down
4 changes: 3 additions & 1 deletion ballista/scheduler/src/flight_sql.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ use arrow_flight::{
Action, FlightData, FlightDescriptor, FlightEndpoint, FlightInfo, HandshakeRequest,
HandshakeResponse, Location, Ticket,
};
use base64::{engine::general_purpose, Engine as _};
use log::{debug, error, warn};
use std::convert::TryFrom;
use std::pin::Pin;
Expand Down Expand Up @@ -504,7 +505,8 @@ impl FlightSqlService for FlightSqlServiceImpl {
)))?;
}
let base64 = &authorization[basic.len()..];
let bytes = base64::decode(base64)
let bytes = general_purpose::STANDARD
.decode(base64)
.map_err(|_| Status::invalid_argument("authorization not parsable"))?;
let str = String::from_utf8(bytes)
.map_err(|_| Status::invalid_argument("authorization not parsable"))?;
Expand Down

0 comments on commit a3c53aa

Please sign in to comment.