Skip to content

Commit ad38f01

Browse files
committed
Merge remote-tracking branch 'up/main' into tracing
2 parents 85adca8 + 4d7997e commit ad38f01

File tree

78 files changed

+2432
-252
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

78 files changed

+2432
-252
lines changed

.github/workflows/links.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,19 @@ jobs:
2222

2323
- name: Link Checker
2424
id: lychee
25-
uses: lycheeverse/lychee-action@v1.8.0
25+
uses: lycheeverse/lychee-action@v2.8.0
2626
with:
2727
args: >-
28-
--base .
28+
--accept 100..=103,200..=299,429
2929
--cache
3030
--max-cache-age 1d .
31+
--exclude-all-private
3132
--exclude 'https://github\.com/datafuselabs/databend/issues/.*'
3233
--exclude 'https?://github\.com/databendlabs/databend/issues/.*'
3334
--exclude 'https?://twitter\.com(?:/.*$)?$'
35+
--exclude-path './src/query/ast/tests/it/testdata/'
36+
--exclude-path './src/query/service/tests/it/storages/testdata/'
37+
3438
- name: Save lychee cache
3539
uses: actions/cache/save@v3
3640
if: always()

Cargo.lock

Lines changed: 13 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ derive-visitor = { version = "0.4.0", features = ["std-types-drive"] }
246246
derive_more = { version = "1.0.0", features = ["full"] }
247247
display-more = { version = "0.2.1" }
248248
divan = "0.1.21"
249-
dtparse = { git = "https://github.com/datafuse-extras/dtparse.git", rev = "30e28ca" }
249+
dtparse = { git = "https://github.com/datafuse-extras/dtparse.git", rev = "7a9e40f" }
250250
dyn-clone = "1.0.9"
251251
educe = { version = "1.0.0", features = ["default", "full"], package = "databend_educe" }
252252
either = "1.9"
@@ -497,6 +497,7 @@ volo-thrift = "0.10"
497497
walkdir = "2.3.2"
498498
wiremock = "0.6"
499499
wkt = "0.14.0"
500+
xorf = "0.12.0"
500501
xorfilter-rs = { version = "0.5", features = ["cbordata"] }
501502
zerocopy = { version = "0.8.26", features = ["derive"] }
502503
zip = "3.0.0"

src/common/base/src/containers/ttlhmap.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,12 +48,12 @@ where K: Eq + Hash
4848
impl<K, V> TtlHashMap<K, V>
4949
where K: Eq + Hash
5050
{
51-
/// Create `TtlHashMap` with time-to-leval, `CleanPolicy::ReadModify` will be take for this initialization
51+
/// Create `TtlHashMap` with time-to-live, `CleanPolicy::ReadModify` will be take for this initialization
5252
pub fn new(ttl: Duration) -> Self {
5353
Self::new_with_clean_policy(ttl, CleanPolicy::ReadModify)
5454
}
5555

56-
/// Create `TtlHashMap` with time-to-leval and `CleanPolicy`
56+
/// Create `TtlHashMap` with time-to-live and `CleanPolicy`
5757
pub fn new_with_clean_policy(ttl: Duration, clean_policy: CleanPolicy) -> Self {
5858
TtlHashMap {
5959
map: HashMap::new(),

src/common/io/src/constants.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ pub const NAN_BYTES_SNAKE: &str = "NaN";
2323
pub const NAN_BYTES_LOWER: &str = "nan";
2424
pub const INF_BYTES_LOWER: &str = "inf";
2525
pub const INF_BYTES_LONG: &str = "Infinity";
26+
pub const NEG_INF_BYTES_LONG: &str = "-Infinity";
2627

2728
// The size of the I/O read/write block buffer by default.
2829
pub const DEFAULT_BLOCK_BUFFER_SIZE: usize = 125 * 1024 * 1024;

src/common/io/src/format_settings.rs

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,32 @@ setting binary_output_format to 'UTF-8-LOSSY'."
8888
}
8989
}
9090

91+
#[derive(Debug, Clone, Copy, PartialEq, Eq, Default)]
92+
pub enum HttpHandlerDataFormat {
93+
#[default]
94+
Display,
95+
Driver,
96+
}
97+
98+
impl HttpHandlerDataFormat {
99+
pub fn parse(s: &str) -> Result<Self, ErrorCode> {
100+
match s.to_ascii_lowercase().as_str() {
101+
"display" => Ok(HttpHandlerDataFormat::Display),
102+
"driver" => Ok(HttpHandlerDataFormat::Driver),
103+
other => Err(ErrorCode::InvalidArgument(format!(
104+
"Invalid http json result mode '{other}', valid values: DISPLAY | DRIVER"
105+
))),
106+
}
107+
}
108+
109+
pub fn as_str(&self) -> &'static str {
110+
match self {
111+
HttpHandlerDataFormat::Display => "display",
112+
HttpHandlerDataFormat::Driver => "driver",
113+
}
114+
}
115+
}
116+
91117
#[derive(Debug, Clone, PartialEq, Eq)]
92118
pub struct InputFormatSettings {
93119
pub jiff_timezone: TimeZone,
@@ -116,6 +142,7 @@ pub struct OutputFormatSettings {
116142
pub jiff_timezone: TimeZone,
117143
pub geometry_format: GeometryDataType,
118144
pub binary_format: BinaryDisplayFormat,
145+
pub http_json_result_mode: HttpHandlerDataFormat,
119146

120147
// used only in http handler response
121148
pub format_null_as_str: bool,
@@ -127,6 +154,7 @@ impl Default for OutputFormatSettings {
127154
jiff_timezone: TimeZone::UTC,
128155
geometry_format: GeometryDataType::default(),
129156
binary_format: BinaryDisplayFormat::Hex,
157+
http_json_result_mode: HttpHandlerDataFormat::Display,
130158
format_null_as_str: false,
131159
}
132160
}

src/common/io/src/prelude.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ pub use crate::binary_write::put_uvarint;
2121
pub use crate::bincode_serialization::*;
2222
pub use crate::borsh_serialization::*;
2323
pub use crate::format_settings::BinaryDisplayFormat;
24+
pub use crate::format_settings::HttpHandlerDataFormat;
2425
pub use crate::format_settings::InputFormatSettings;
2526
pub use crate::format_settings::OutputFormatSettings;
2627
pub use crate::position::*;

src/query/ast/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ enum-as-inner = { workspace = true }
1515
ethnum = { workspace = true }
1616
fast-float2 = { workspace = true }
1717
fastrace = { workspace = true }
18+
hex = { workspace = true }
1819
indent = { workspace = true }
1920
itertools = { workspace = true }
2021
logos = { workspace = true }

src/query/ast/src/ast/expr.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1029,6 +1029,7 @@ pub enum Literal {
10291029
},
10301030
// Quoted string literal value
10311031
String(String),
1032+
Binary(Vec<u8>),
10321033
Boolean(bool),
10331034
Null,
10341035
}
@@ -1077,6 +1078,9 @@ impl Display for Literal {
10771078
Literal::String(val) => {
10781079
write!(f, "{}", QuotedString(val, '\''))
10791080
}
1081+
Literal::Binary(val) => {
1082+
write!(f, "X'{}'", hex::encode_upper(val))
1083+
}
10801084
Literal::Boolean(val) => {
10811085
if *val {
10821086
write!(f, "TRUE")

src/query/ast/src/parser/error.rs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,23 @@ impl From<ParseIntError> for ErrorKind {
183183
}
184184
}
185185

186+
impl From<hex::FromHexError> for ErrorKind {
187+
fn from(err: hex::FromHexError) -> Self {
188+
let msg = match err {
189+
hex::FromHexError::InvalidHexCharacter { .. } => {
190+
"unable to parse hex literal because it contains invalid characters"
191+
}
192+
hex::FromHexError::OddLength => {
193+
"unable to parse hex literal because it has an odd number of digits"
194+
}
195+
hex::FromHexError::InvalidStringLength => {
196+
"unable to parse hex literal because it has an invalid length"
197+
}
198+
};
199+
ErrorKind::Other(msg)
200+
}
201+
}
202+
186203
/// Suggests corrections using intelligent syntax pattern matching
187204
fn suggest_keyword_correction(
188205
_span_text: &str,

0 commit comments

Comments
 (0)