Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ simd-json = "0.15.0"
mockalloc = "0.1.2"
criterion = "0.5.1"
proptest = "1.7"
json-five = "0.3.0"

[features]
default = ["databend", "preserve_order", "arbitrary_precision"]
Expand Down
2 changes: 1 addition & 1 deletion src/core/databend/de.rs
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ impl<'de> Deserializer<'de> {
Ok(Cow::Borrowed(s))
}

fn read_payload_extension(&mut self, length: usize) -> Result<ExtensionValue> {
fn read_payload_extension(&mut self, length: usize) -> Result<ExtensionValue<'_>> {
let start = self.index;
let end = self.index + length;
let val = ExtensionValue::decode(&self.raw.data[start..end])?;
Expand Down
2 changes: 1 addition & 1 deletion src/core/databend/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -439,7 +439,7 @@ impl ExtensionValue<'_> {
}

#[inline]
pub(crate) fn decode(bytes: &[u8]) -> Result<ExtensionValue> {
pub(crate) fn decode(bytes: &[u8]) -> Result<ExtensionValue<'_>> {
let mut len = bytes.len();
assert!(len > 0);
len -= 1;
Expand Down
8 changes: 8 additions & 0 deletions src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ pub enum ParseErrorCode {
InvalidSurrogateInHexEscape(u16),
UnexpectedEndOfHexEscape,
ObjectDuplicateKey(String),
ObjectKeyInvalidNumber,
ObjectKeyInvalidCharacter,
}

pub type Result<T> = std::result::Result<T, Error>;
Expand Down Expand Up @@ -72,6 +74,12 @@ impl Display for ParseErrorCode {
ParseErrorCode::ObjectDuplicateKey(key) => {
write!(f, "duplicate object attribute \"{}\"", key)
}
ParseErrorCode::ObjectKeyInvalidNumber => {
f.write_str("object attribute name cannot be a number")
}
ParseErrorCode::ObjectKeyInvalidCharacter => {
f.write_str("object attribute name cannot be invalid character")
}
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/functions/scalar.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1499,7 +1499,7 @@ impl RawJsonb<'_> {
/// let raw_jsonb = RawJsonb::new(&buf);
/// assert_eq!(raw_jsonb.as_extension_value().unwrap(), Some(ExtensionValue::Binary(&[1,2,3])));
/// ```
pub fn as_extension_value(&self) -> Result<Option<ExtensionValue>> {
pub fn as_extension_value(&self) -> Result<Option<ExtensionValue<'_>>> {
let jsonb_item = JsonbItem::from_raw_jsonb(*self)?;
match jsonb_item {
JsonbItem::Extension(data) => {
Expand Down
Loading