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
6 changes: 5 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,11 @@ byteorder = "1.5.0"
fast-float2 = "0.2.3"
itoa = "1.0"
nom = "7.1.3"
num-traits = "0.2.19"
ordered-float = { version = "4.5", default-features = false }
rand = { version = "0.8.5", features = ["small_rng"] }
ryu = "1.0"
serde = "1.0"
serde_json = { version = "1.0", default-features = false, features = ["std"] }

[dev-dependencies]
Expand All @@ -44,7 +46,9 @@ mockalloc = "0.1.2"
criterion = "0.5.1"

[features]
default = ["serde_json/preserve_order"]
default = ["databend", "serde_json/preserve_order"]
databend = []
sqlite = []

[[bench]]
name = "parser"
Expand Down
3 changes: 1 addition & 2 deletions benches/get_path.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,9 @@ fn jsonb_get(data: &[u8], paths: &[&str], expected: &str) {
.map(|p| jsonb::jsonpath::Path::DotField(std::borrow::Cow::Borrowed(p)))
.collect::<Vec<_>>();
let json_path = jsonb::jsonpath::JsonPath { paths };
let mode = jsonb::jsonpath::Mode::Mixed;

let raw_jsonb = jsonb::RawJsonb::new(data);
let result_jsonb = raw_jsonb.get_by_path_opt(&json_path, mode).unwrap();
let result_jsonb = raw_jsonb.select_value_by_path(&json_path).unwrap();
assert!(result_jsonb.is_some());
let result_jsonb = result_jsonb.unwrap();
let result_raw_jsonb = result_jsonb.as_raw();
Expand Down
204 changes: 0 additions & 204 deletions src/builder.rs

This file was deleted.

36 changes: 0 additions & 36 deletions src/constants.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,41 +12,6 @@
// See the License for the specific language governing permissions and
// limitations under the License.

// JSONB header constants
pub(crate) const ARRAY_PREFIX: u8 = 0x80;
pub(crate) const OBJECT_PREFIX: u8 = 0x40;
pub(crate) const SCALAR_PREFIX: u8 = 0x20;

pub(crate) const ARRAY_CONTAINER_TAG: u32 = 0x80000000;
pub(crate) const OBJECT_CONTAINER_TAG: u32 = 0x40000000;
pub(crate) const SCALAR_CONTAINER_TAG: u32 = 0x20000000;

pub(crate) const CONTAINER_HEADER_TYPE_MASK: u32 = 0xE0000000;
pub(crate) const CONTAINER_HEADER_LEN_MASK: u32 = 0x1FFFFFFF;

// JSONB JEntry constants
pub(crate) const NULL_TAG: u32 = 0x00000000;
pub(crate) const STRING_TAG: u32 = 0x10000000;
pub(crate) const NUMBER_TAG: u32 = 0x20000000;
pub(crate) const FALSE_TAG: u32 = 0x30000000;
pub(crate) const TRUE_TAG: u32 = 0x40000000;
pub(crate) const CONTAINER_TAG: u32 = 0x50000000;

// JSONB number constants
pub(crate) const NUMBER_ZERO: u8 = 0x00;
pub(crate) const NUMBER_NAN: u8 = 0x10;
pub(crate) const NUMBER_INF: u8 = 0x20;
pub(crate) const NUMBER_NEG_INF: u8 = 0x30;
pub(crate) const NUMBER_INT: u8 = 0x40;
pub(crate) const NUMBER_UINT: u8 = 0x50;
pub(crate) const NUMBER_FLOAT: u8 = 0x60;

// @todo support offset mode
#[allow(dead_code)]
pub(crate) const JENTRY_IS_OFF_FLAG: u32 = 0x80000000;
pub(crate) const JENTRY_TYPE_MASK: u32 = 0x70000000;
pub(crate) const JENTRY_OFF_LEN_MASK: u32 = 0x0FFFFFFF;

// JSON text constants
pub(crate) const UNICODE_LEN: usize = 4;

Expand All @@ -68,7 +33,6 @@ pub(crate) const STRING_LEVEL: u8 = 4;
pub(crate) const NUMBER_LEVEL: u8 = 3;
pub(crate) const TRUE_LEVEL: u8 = 2;
pub(crate) const FALSE_LEVEL: u8 = 1;
pub(crate) const INVALID_LEVEL: u8 = 0;

pub(crate) const TYPE_STRING: &str = "string";
pub(crate) const TYPE_NULL: &str = "null";
Expand Down
Loading