Skip to content

Commit

Permalink
merge main
Browse files Browse the repository at this point in the history
  • Loading branch information
ZhiHanZ committed Nov 11, 2021
2 parents 104b450 + 68bbe71 commit b4172b1
Show file tree
Hide file tree
Showing 54 changed files with 642 additions and 517 deletions.
10 changes: 9 additions & 1 deletion .github/workflows/cargo.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
name: Cargo
on: [push, pull_request]
on:
push:
paths-ignore:
- 'website/'
- '*.md'
pull_request:
paths-ignore:
- 'website/'
- '*.md'

env:
CARGO_TERM_COLOR: always
Expand Down
10 changes: 9 additions & 1 deletion .github/workflows/databend-build.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
name: Build
on: [push, pull_request]
on:
push:
paths-ignore:
- 'website/'
- '*.md'
pull_request:
paths-ignore:
- 'website/'
- '*.md'

env:
CARGO_TERM_COLOR: always
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/databend-docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ name: Push to Dockerhub
on:
push:
branches: main
paths-ignore:
- 'website/'
- '*.md'

jobs:
build:
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/databend-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -142,4 +142,5 @@ jobs:
mkdir -p ./target/aarch64-unknown-linux-gnu/release
tar xC ./target/x86_64-unknown-linux-gnu/release -f ./databend-${{ steps.get_version.outputs.VERSION }}-x86_64-unknown-linux-gnu.tar.gz
tar xC ./target/aarch64-unknown-linux-gnu/release -f ./databend-${{ steps.get_version.outputs.VERSION }}-aarch64-unknown-linux-gnu.tar.gz
HUB= ${{ secrets.DOCKERHUB_NAMESPACE }} TAG=${{ steps.get_version.outputs.VERSION }} make k8s-docker
export TAG=${{ steps.get_version.outputs.VERSION }}
make k8s-docker
10 changes: 9 additions & 1 deletion .github/workflows/embedded-meta-test.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
name: Stateless(Standalone, using embedded meta-store)
on: [push, pull_request]
on:
push:
paths-ignore:
- 'website/'
- '*.md'
pull_request:
paths-ignore:
- 'website/'
- '*.md'

env:
CARGO_TERM_COLOR: always
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/pr-audit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ name: Pull Request Security Audit
on:
push:
paths:
- '**/**/Cargo.toml'
- '**/Cargo.lock'
pull_request:
paths:
- '**/**/Cargo.toml'
- '**/Cargo.lock'

jobs:
security-audit:
Expand Down
10 changes: 9 additions & 1 deletion .github/workflows/stateless-tests-cluster.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
name: Stateless(Cluster)
on: [push, pull_request]
on:
push:
paths-ignore:
- 'website/'
- '*.md'
pull_request:
paths-ignore:
- 'website/'
- '*.md'

env:
CARGO_TERM_COLOR: always
Expand Down
10 changes: 9 additions & 1 deletion .github/workflows/stateless-tests-standalone.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
name: Stateless(Standalone)
on: [push, pull_request]
on:
push:
paths-ignore:
- 'website/'
- '*.md'
pull_request:
paths-ignore:
- 'website/'
- '*.md'

env:
CARGO_TERM_COLOR: always
Expand Down
10 changes: 9 additions & 1 deletion .github/workflows/unit-tests.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
name: Unit Tests
on: [push, pull_request]
on:
push:
paths-ignore:
- 'website/'
- '*.md'
pull_request:
paths-ignore:
- 'website/'
- '*.md'

env:
CARGO_TERM_COLOR: always
Expand Down
5 changes: 3 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<div align="center">
<h1>Databend</h1>
<p align="center"><img alt="Databend Logo" src="website/databend/docs/images/databend-logo.png" width="15%"/></p>
<p align="center">The Open Source Serverless Data Warehouse for Everyone</p>

<h4 align="center">
Expand Down
2 changes: 1 addition & 1 deletion common/base/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ pprof = { version = "0.5", features = ["flamegraph", "protobuf"] }
tokio = { version = "1.13.0", features = ["macros", "rt", "rt-multi-thread", "sync", "fs", "signal"] }
uuid = { version = "0.8", features = ["serde", "v4"] }
serde = { version = "1.0", features = ["derive"] }
poem = { version = "1.0.21", features = ["tls"] }
poem = { version = "1.0.23", features = ["rustls"] }


[dev-dependencies]
Expand Down
10 changes: 5 additions & 5 deletions common/base/src/http_shutdown_handlers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,10 @@ use common_tracing::tracing;
use futures::FutureExt;
use poem::listener::Acceptor;
use poem::listener::AcceptorExt;
use poem::listener::IntoTlsConfigStream;
use poem::listener::Listener;
use poem::listener::RustlsConfig;
use poem::listener::TcpListener;
use poem::listener::TlsConfig;
use poem::Endpoint;
use tokio::sync::oneshot;
use tokio::task::JoinHandle;
Expand All @@ -45,7 +46,7 @@ impl HttpShutdownHandler {
pub async fn start_service(
&mut self,
listening: String,
tls_config: Option<TlsConfig>,
tls_config: Option<RustlsConfig>,
ep: impl Endpoint + 'static,
) -> Result<SocketAddr> {
assert!(self.join_handle.is_none());
Expand All @@ -65,13 +66,12 @@ impl HttpShutdownHandler {

if let Some(tls_config) = tls_config {
acceptor = acceptor
.tls(tls_config)
.map_err(|err| {
.rustls(tls_config.into_stream().map_err(|err| {
ErrorCode::TLSConfigurationFailure(format!(
"Cannot build TLS config for http service, cause {}",
err
))
})?
})?)
.boxed();
}

Expand Down
97 changes: 81 additions & 16 deletions common/functions/src/scalars/maths/log.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,32 +27,45 @@ use crate::scalars::function_factory::FunctionFeatures;
use crate::scalars::Function;

#[derive(Clone)]
pub struct LogFunction {
_display_name: String,
pub struct GenericLogFunction {
display_name: String,
default_base: f64,
unary: bool,
}

impl LogFunction {
pub fn try_create(_display_name: &str) -> Result<Box<dyn Function>> {
impl GenericLogFunction {
pub fn try_create(
display_name: &str,
default_base: f64,
unary: bool,
) -> Result<Box<dyn Function>> {
Ok(Box::new(Self {
_display_name: _display_name.to_string(),
default_base: E,
display_name: display_name.to_string(),
default_base,
unary,
}))
}

pub fn desc() -> FunctionDescription {
FunctionDescription::creator(Box::new(Self::try_create))
.features(FunctionFeatures::default().deterministic())
}
}

impl Function for LogFunction {
impl Function for GenericLogFunction {
fn name(&self) -> &str {
&*self._display_name
&*self.display_name
}

fn num_arguments(&self) -> usize {
if self.unary {
1
} else {
0
}
}

fn variadic_arguments(&self) -> Option<(usize, usize)> {
Some((1, 2))
if self.unary {
None
} else {
Some((1, 2))
}
}

fn return_type(&self, _args: &[DataType]) -> Result<DataType> {
Expand Down Expand Up @@ -113,8 +126,60 @@ impl Function for LogFunction {
}
}

impl fmt::Display for LogFunction {
impl fmt::Display for GenericLogFunction {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "LOG")
write!(f, "{}", self.display_name.to_uppercase())
}
}

pub struct LogFunction {}

impl LogFunction {
pub fn try_create(display_name: &str) -> Result<Box<dyn Function>> {
GenericLogFunction::try_create(display_name, E, false)
}

pub fn desc() -> FunctionDescription {
FunctionDescription::creator(Box::new(Self::try_create))
.features(FunctionFeatures::default().deterministic())
}
}

pub struct LnFunction {}

impl LnFunction {
pub fn try_create(display_name: &str) -> Result<Box<dyn Function>> {
GenericLogFunction::try_create(display_name, E, true)
}

pub fn desc() -> FunctionDescription {
FunctionDescription::creator(Box::new(Self::try_create))
.features(FunctionFeatures::default().deterministic())
}
}

pub struct Log10Function {}

impl Log10Function {
pub fn try_create(display_name: &str) -> Result<Box<dyn Function>> {
GenericLogFunction::try_create(display_name, 10_f64, true)
}

pub fn desc() -> FunctionDescription {
FunctionDescription::creator(Box::new(Self::try_create))
.features(FunctionFeatures::default().deterministic())
}
}

pub struct Log2Function {}

impl Log2Function {
pub fn try_create(display_name: &str) -> Result<Box<dyn Function>> {
GenericLogFunction::try_create(display_name, 2_f64, true)
}

pub fn desc() -> FunctionDescription {
FunctionDescription::creator(Box::new(Self::try_create))
.features(FunctionFeatures::default().deterministic())
}
}
6 changes: 6 additions & 0 deletions common/functions/src/scalars/maths/math.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ use crate::scalars::function_factory::FunctionFactory;
use crate::scalars::AbsFunction;
use crate::scalars::CRC32Function;
use crate::scalars::DegressFunction;
use crate::scalars::LnFunction;
use crate::scalars::Log10Function;
use crate::scalars::Log2Function;
use crate::scalars::LogFunction;
use crate::scalars::PiFunction;
use crate::scalars::RadiansFunction;
Expand All @@ -38,5 +41,8 @@ impl MathsFunction {
factory.register("degrees", DegressFunction::desc());
factory.register("radians", RadiansFunction::desc());
factory.register("log", LogFunction::desc());
factory.register("log10", Log10Function::desc());
factory.register("log2", Log2Function::desc());
factory.register("ln", LnFunction::desc());
}
}
3 changes: 3 additions & 0 deletions common/functions/src/scalars/maths/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ pub use abs::AbsFunction;
pub use angle::DegressFunction;
pub use angle::RadiansFunction;
pub use crc32::CRC32Function;
pub use log::LnFunction;
pub use log::Log10Function;
pub use log::Log2Function;
pub use log::LogFunction;
pub use math::MathsFunction;
pub use pi::PiFunction;
Expand Down
Loading

0 comments on commit b4172b1

Please sign in to comment.