Skip to content

Commit

Permalink
chore: Split jsonpath
Browse files Browse the repository at this point in the history
  • Loading branch information
chubei committed Sep 19, 2023
1 parent e4c559e commit 2e85406
Show file tree
Hide file tree
Showing 17 changed files with 63 additions and 37 deletions.
12 changes: 12 additions & 0 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 Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ members = [
"dozer-log",
"dozer-log-js",
"dozer-log-python",
"dozer-utils"
"dozer-utils",
]
resolver = "2"

Expand Down
13 changes: 7 additions & 6 deletions dozer-sql/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,11 @@ authors = ["getdozer/dozer-dev"]
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
dozer-types = {path = "../dozer-types"}
dozer-storage = {path = "../dozer-storage"}
dozer-core = {path = "../dozer-core"}
dozer-tracing = {path = "../dozer-tracing"}
dozer-types = { path = "../dozer-types" }
dozer-storage = { path = "../dozer-storage" }
dozer-core = { path = "../dozer-core" }
dozer-tracing = { path = "../dozer-tracing" }
jsonpath = { path = "jsonpath" }

ahash = "0.8.3"
enum_dispatch = "0.3.11"
Expand All @@ -23,8 +24,8 @@ num-traits = "0.2.15"
pest = "2.6.0"
pest_derive = "2.5.6"
regex = "1.8.1"
sqlparser = {git = "https://github.com/getdozer/sqlparser-rs.git" }
uuid = {version = "1.3.0", features = ["v1", "v4", "fast-rng"]}
sqlparser = { git = "https://github.com/getdozer/sqlparser-rs.git" }
uuid = { version = "1.3.0", features = ["v1", "v4", "fast-rng"] }
bigdecimal = { version = "0.3", features = ["serde"], optional = true }
ort = { version = "1.15.2", optional = true }
ndarray = { version = "0.15", optional = true }
Expand Down
21 changes: 21 additions & 0 deletions dozer-sql/jsonpath/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
[package]
name = "jsonpath"
description = "The library provides the basic functionality to find the set of the data according to the filtering query."
version = "0.2.6"
authors = ["BorisZhguchev <[email protected]>"]
edition = "2018"
license-file = "LICENSE"
homepage = "https://github.com/besok/jsonpath-rust"
repository = "https://github.com/besok/jsonpath-rust"
readme = "README.md"
keywords = ["json", "json-path", "jsonpath", "jsonpath-rust", "xpath"]
categories = ["development-tools", "parsing", "text-processing"]

[dependencies]
dozer-types = { path = "../../dozer-types" }
regex = "1"
pest = "2.0"
pest_derive = "2.0"

[dev-dependencies]
lazy_static = "1.0"
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
#![allow(clippy::vec_init_then_push)]

use crate::jsonpath::parser::model::JsonPath;
use crate::jsonpath::path::{json_path_instance, PathInstance};
use crate::jsonpath::JsonPathValue::{NewValue, NoValue, Slice};
use crate::parser::model::JsonPath;
use crate::path::{json_path_instance, PathInstance};
use crate::JsonPathValue::{NewValue, NoValue, Slice};
use dozer_types::json_types::JsonValue;
use std::convert::TryInto;
use std::fmt::Debug;
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use crate::jsonpath::parser::parser::parse_json_path;
use crate::parser::parser::parse_json_path;
use dozer_types::json_types::JsonValue;
use std::convert::TryFrom;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
use crate::jsonpath::parser::model::FilterExpression::{And, Or};
use crate::jsonpath::parser::model::{
use crate::parser::model::FilterExpression::{And, Or};
use crate::parser::model::{
FilterExpression, FilterSign, Function, JsonPath, JsonPathIndex, Operand,
};
use dozer_types::json_types::JsonValue;
use pest::error::Error;
use pest::iterators::{Pair, Pairs};
use pest::Parser;
use pest_derive::Parser;

#[derive(Parser)]
#[grammar = "jsonpath/parser/grammar/json_path.pest"]
#[grammar = "parser/grammar/json_path.pest"]
pub struct JsonPathParser;

/// the parsing function.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
use crate::jsonpath::parser::model::{FilterExpression, FilterSign, JsonPath};
use crate::jsonpath::path::json::{any_of, eq, inside, less, regex, size, sub_set_of};
use crate::jsonpath::path::top::ObjectField;
use crate::jsonpath::path::{json_path_instance, process_operand, Path, PathInstance};
use crate::jsonpath::JsonPathValue;
use crate::jsonpath::JsonPathValue::{NoValue, Slice};
use crate::parser::model::{FilterExpression, FilterSign, JsonPath};
use crate::path::json::{any_of, eq, inside, less, regex, size, sub_set_of};
use crate::path::top::ObjectField;
use crate::path::{json_path_instance, process_operand, Path, PathInstance};
use crate::JsonPathValue;
use crate::JsonPathValue::{NoValue, Slice};
use dozer_types::json_types::JsonValue;
use dozer_types::json_types::JsonValue::Array;

Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
use crate::jsonpath::parser::model::{Function, JsonPath, JsonPathIndex, Operand};
use crate::jsonpath::path::index::{ArrayIndex, ArraySlice, Current, FilterPath, UnionIndex};
use crate::jsonpath::path::top::{
use crate::parser::model::{Function, JsonPath, JsonPathIndex, Operand};
use crate::path::index::{ArrayIndex, ArraySlice, Current, FilterPath, UnionIndex};
use crate::path::top::{
Chain, DescentObject, DescentWildcard, FnPath, IdentityPath, ObjectField, RootPointer, Wildcard,
};
use crate::jsonpath::JsonPathValue;
use crate::JsonPathValue;
use dozer_types::json_types::JsonValue;

/// The module is in charge of processing [[JsonPathIndex]] elements
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use crate::jsonpath::parser::model::*;
use crate::jsonpath::path::JsonPathValue::{NewValue, NoValue, Slice};
use crate::jsonpath::path::{json_path_instance, JsonPathValue, Path, PathInstance};
use crate::parser::model::*;
use crate::path::JsonPathValue::{NewValue, NoValue, Slice};
use crate::path::{json_path_instance, JsonPathValue, Path, PathInstance};
use dozer_types::json_types::JsonValue::{Array, Object};
use dozer_types::json_types::{serde_json_to_json_value, JsonValue};
use dozer_types::serde_json::json;
Expand Down
7 changes: 0 additions & 7 deletions dozer-sql/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,4 @@
extern crate core;

// Re-export sqlparser
pub use sqlparser;

pub mod jsonpath;
pub mod pipeline;

#[macro_use]
extern crate pest_derive;
extern crate pest;
2 changes: 1 addition & 1 deletion dozer-sql/src/pipeline/expression/json_functions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ use crate::pipeline::errors::PipelineError::{
};
use crate::pipeline::expression::execution::Expression;

use crate::jsonpath::{JsonPathFinder, JsonPathInst};
use dozer_types::json_types::JsonValue;
use dozer_types::types::Record;
use dozer_types::types::{Field, Schema};
use jsonpath::{JsonPathFinder, JsonPathInst};
use std::fmt::{Display, Formatter};
use std::str::FromStr;

Expand Down

0 comments on commit 2e85406

Please sign in to comment.