gqlite 1.2.2 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/ext/Cargo.toml +20 -0
- data/ext/gqlitedb/Cargo.toml +77 -0
- data/ext/{gqliterb/vendor/gqlitedb → gqlitedb}/benches/common/pokec.rs +30 -20
- data/ext/gqlitedb/gqlite_bench_data/README.MD +6 -0
- data/ext/gqlitedb/gqlite_bench_data/scripts/generate_smaller_pokec.rb +85 -0
- data/ext/gqlitedb/gqlite_bench_data/scripts/to_efficient_pokec.rb +34 -0
- data/ext/{gqliterb/vendor/gqlitedb → gqlitedb}/release.toml +2 -2
- data/ext/{gqliterb/vendor/gqlitedb → gqlitedb}/src/aggregators/arithmetic.rs +1 -0
- data/ext/{gqliterb/vendor/gqlitedb → gqlitedb}/src/aggregators/stats.rs +27 -49
- data/ext/{gqliterb/vendor/gqlitedb → gqlitedb}/src/aggregators.rs +7 -7
- data/ext/{gqliterb/vendor/gqlitedb → gqlitedb}/src/capi.rs +34 -10
- data/ext/{gqliterb/vendor/gqlitedb → gqlitedb}/src/compiler/expression_analyser.rs +10 -4
- data/ext/{gqliterb/vendor/gqlitedb → gqlitedb}/src/compiler/variables_manager.rs +36 -39
- data/ext/{gqliterb/vendor/gqlitedb → gqlitedb}/src/compiler.rs +46 -41
- data/ext/gqlitedb/src/connection.rs +300 -0
- data/ext/{gqliterb/vendor/gqlitedb → gqlitedb}/src/error.rs +113 -50
- data/ext/{gqliterb/vendor/gqlitedb → gqlitedb}/src/functions/containers.rs +21 -26
- data/ext/{gqliterb/vendor/gqlitedb → gqlitedb}/src/functions/edge.rs +3 -3
- data/ext/{gqliterb/vendor/gqlitedb → gqlitedb}/src/functions/math.rs +3 -3
- data/ext/{gqliterb/vendor/gqlitedb → gqlitedb}/src/functions/node.rs +2 -2
- data/ext/gqlitedb/src/functions/path.rs +75 -0
- data/ext/{gqliterb/vendor/gqlitedb → gqlitedb}/src/functions/scalar.rs +3 -3
- data/ext/{gqliterb/vendor/gqlitedb → gqlitedb}/src/functions/string.rs +1 -1
- data/ext/{gqliterb/vendor/gqlitedb → gqlitedb}/src/functions/value.rs +7 -7
- data/ext/{gqliterb/vendor/gqlitedb → gqlitedb}/src/functions.rs +29 -31
- data/ext/gqlitedb/src/graph.rs +11 -0
- data/ext/{gqliterb/vendor/gqlitedb → gqlitedb}/src/interpreter/evaluators.rs +178 -224
- data/ext/{gqliterb/vendor/gqlitedb → gqlitedb}/src/interpreter/instructions.rs +8 -2
- data/ext/{gqliterb/vendor/gqlitedb → gqlitedb}/src/lib.rs +9 -5
- data/ext/{gqliterb/vendor/gqlitedb → gqlitedb}/src/parser/ast.rs +54 -76
- data/ext/{gqliterb/vendor/gqlitedb → gqlitedb}/src/parser/gql.pest +9 -4
- data/ext/{gqliterb/vendor/gqlitedb/src/parser/parser.rs → gqlitedb/src/parser/parser_impl.rs} +86 -34
- data/ext/gqlitedb/src/parser.rs +4 -0
- data/ext/{gqliterb/vendor/gqlitedb → gqlitedb}/src/prelude.rs +3 -2
- data/ext/gqlitedb/src/query_result.rs +88 -0
- data/ext/{gqliterb/vendor/gqlitedb → gqlitedb}/src/store/redb.rs +260 -170
- data/ext/{gqliterb/vendor/gqlitedb → gqlitedb}/src/store/sqlite.rs +157 -142
- data/ext/{gqliterb/vendor/gqlitedb → gqlitedb}/src/store.rs +30 -23
- data/ext/{gqliterb/vendor/gqlitedb → gqlitedb}/src/tests/evaluators.rs +41 -85
- data/ext/{gqliterb/vendor/gqlitedb → gqlitedb}/src/tests/store/redb.rs +12 -5
- data/ext/{gqliterb/vendor/gqlitedb → gqlitedb}/src/tests/store/sqlite.rs +12 -5
- data/ext/{gqliterb/vendor/gqlitedb → gqlitedb}/src/tests/store.rs +106 -114
- data/ext/{gqliterb/vendor/gqlitedb → gqlitedb}/src/tests/templates/ast.rs +29 -29
- data/ext/{gqliterb/vendor/gqlitedb → gqlitedb}/src/tests/templates/programs.rs +4 -4
- data/ext/{gqliterb/vendor/gqlitedb → gqlitedb}/src/value/compare.rs +13 -20
- data/ext/{gqliterb/vendor/gqlitedb → gqlitedb}/src/value/contains.rs +2 -2
- data/ext/gqlitedb/src/value.rs +225 -0
- data/ext/{gqliterb/vendor/gqlitedb → gqlitedb}/src/value_table.rs +22 -18
- data/ext/gqliterb/Cargo.toml +12 -34
- data/ext/gqliterb/src/lib.rs +67 -39
- data/ext/graphcore/Cargo.toml +19 -0
- data/ext/graphcore/README.MD +4 -0
- data/ext/graphcore/release.toml +1 -0
- data/ext/graphcore/src/error.rs +28 -0
- data/ext/{gqliterb/vendor/gqlitedb → graphcore}/src/graph.rs +146 -35
- data/ext/graphcore/src/lib.rs +16 -0
- data/ext/graphcore/src/prelude.rs +4 -0
- data/ext/{gqliterb/vendor/gqlitedb → graphcore}/src/serialize_with.rs +2 -2
- data/ext/graphcore/src/table.rs +272 -0
- data/ext/{gqliterb/vendor/gqlitedb → graphcore}/src/value/value_map.rs +44 -49
- data/ext/graphcore/src/value.rs +413 -0
- metadata +94 -83
- data/ext/gqliterb/.cargo/config.toml +0 -2
- data/ext/gqliterb/Cargo.lock +0 -1109
- data/ext/gqliterb/vendor/gqlitedb/Cargo.lock +0 -2060
- data/ext/gqliterb/vendor/gqlitedb/Cargo.toml +0 -132
- data/ext/gqliterb/vendor/gqlitedb/src/connection.rs +0 -208
- data/ext/gqliterb/vendor/gqlitedb/src/functions/path.rs +0 -48
- data/ext/gqliterb/vendor/gqlitedb/src/parser.rs +0 -4
- data/ext/gqliterb/vendor/gqlitedb/src/value.rs +0 -559
- /data/ext/{gqliterb/vendor/gqlitedb → gqlitedb}/askama.toml +0 -0
- /data/ext/{gqliterb/vendor/gqlitedb → gqlitedb}/benches/common/mod.rs +0 -0
- /data/ext/{gqliterb/vendor/gqlitedb → gqlitedb}/benches/pokec_divan.rs +0 -0
- /data/ext/{gqliterb/vendor/gqlitedb → gqlitedb}/benches/pokec_iai.rs +0 -0
- /data/ext/{gqliterb/vendor/gqlitedb → gqlitedb}/src/aggregators/containers.rs +0 -0
- /data/ext/{gqliterb/vendor/gqlitedb → gqlitedb}/src/aggregators/count.rs +0 -0
- /data/ext/{gqliterb/vendor/gqlitedb → gqlitedb}/src/consts.rs +0 -0
- /data/ext/{gqliterb/vendor/gqlitedb → gqlitedb}/src/interpreter/mod.rs +0 -0
- /data/ext/{gqliterb/vendor/gqlitedb → gqlitedb}/src/store/pgql.rs +0 -0
- /data/ext/{gqliterb/vendor/gqlitedb → gqlitedb}/src/tests/compiler.rs +0 -0
- /data/ext/{gqliterb/vendor/gqlitedb → gqlitedb}/src/tests/parser.rs +0 -0
- /data/ext/{gqliterb/vendor/gqlitedb → gqlitedb}/src/tests/templates.rs +0 -0
- /data/ext/{gqliterb/vendor/gqlitedb → gqlitedb}/src/tests.rs +0 -0
- /data/ext/{gqliterb/vendor/gqlitedb → gqlitedb}/src/utils.rs +0 -0
- /data/ext/{gqliterb/vendor/gqlitedb → gqlitedb}/templates/sql/sqlite/call_stats.sql +0 -0
- /data/ext/{gqliterb/vendor/gqlitedb → gqlitedb}/templates/sql/sqlite/edge_count_for_node.sql +0 -0
- /data/ext/{gqliterb/vendor/gqlitedb → gqlitedb}/templates/sql/sqlite/edge_create.sql +0 -0
- /data/ext/{gqliterb/vendor/gqlitedb → gqlitedb}/templates/sql/sqlite/edge_delete.sql +0 -0
- /data/ext/{gqliterb/vendor/gqlitedb → gqlitedb}/templates/sql/sqlite/edge_delete_by_nodes.sql +0 -0
- /data/ext/{gqliterb/vendor/gqlitedb → gqlitedb}/templates/sql/sqlite/edge_select.sql +0 -0
- /data/ext/{gqliterb/vendor/gqlitedb → gqlitedb}/templates/sql/sqlite/edge_update.sql +0 -0
- /data/ext/{gqliterb/vendor/gqlitedb → gqlitedb}/templates/sql/sqlite/graph_create.sql +0 -0
- /data/ext/{gqliterb/vendor/gqlitedb → gqlitedb}/templates/sql/sqlite/graph_delete.sql +0 -0
- /data/ext/{gqliterb/vendor/gqlitedb → gqlitedb}/templates/sql/sqlite/metadata_create_table.sql +0 -0
- /data/ext/{gqliterb/vendor/gqlitedb → gqlitedb}/templates/sql/sqlite/metadata_get.sql +0 -0
- /data/ext/{gqliterb/vendor/gqlitedb → gqlitedb}/templates/sql/sqlite/metadata_set.sql +0 -0
- /data/ext/{gqliterb/vendor/gqlitedb → gqlitedb}/templates/sql/sqlite/node_create.sql +0 -0
- /data/ext/{gqliterb/vendor/gqlitedb → gqlitedb}/templates/sql/sqlite/node_delete.sql +0 -0
- /data/ext/{gqliterb/vendor/gqlitedb → gqlitedb}/templates/sql/sqlite/node_select.sql +0 -0
- /data/ext/{gqliterb/vendor/gqlitedb → gqlitedb}/templates/sql/sqlite/node_update.sql +0 -0
- /data/ext/{gqliterb/vendor/gqlitedb → gqlitedb}/templates/sql/sqlite/table_exists.sql +0 -0
- /data/ext/{gqliterb/vendor/gqlitedb → gqlitedb}/templates/sql/sqlite/upgrade_from_1_01.sql +0 -0
- /data/ext/{gqliterb/vendor/gqlitedb → gqlitedb}/templates/sql/sqlite/upgrade_graph_from_1_01.sql +0 -0
@@ -6,6 +6,7 @@ pub(super) struct Head {}
|
|
6
6
|
|
7
7
|
impl Head
|
8
8
|
{
|
9
|
+
#[allow(clippy::ptr_arg)]
|
9
10
|
fn call_impl(array: &Vec<value::Value>) -> FResult<value::Value>
|
10
11
|
{
|
11
12
|
Ok(
|
@@ -34,20 +35,17 @@ impl Keys
|
|
34
35
|
match container
|
35
36
|
{
|
36
37
|
value::Value::Map(obj) => Ok(obj.keys().map(|x| x.to_owned().into()).collect()),
|
37
|
-
value::Value::Node(n) => Ok(n.properties.keys().map(|x| x.to_owned().into()).collect()),
|
38
|
-
value::Value::Edge(e) => Ok(e.properties.keys().map(|x| x.to_owned().into()).collect()),
|
39
|
-
_ =>
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
.into(),
|
49
|
-
)
|
50
|
-
}
|
38
|
+
value::Value::Node(n) => Ok(n.properties().keys().map(|x| x.to_owned().into()).collect()),
|
39
|
+
value::Value::Edge(e) => Ok(e.properties().keys().map(|x| x.to_owned().into()).collect()),
|
40
|
+
_ => Err(
|
41
|
+
RunTimeError::InvalidArgument {
|
42
|
+
function_name: "keys",
|
43
|
+
index: 0,
|
44
|
+
expected_type: "map, node or relationship",
|
45
|
+
value: format!("{:?}", container),
|
46
|
+
}
|
47
|
+
.into(),
|
48
|
+
),
|
51
49
|
}
|
52
50
|
}
|
53
51
|
}
|
@@ -88,18 +86,15 @@ impl super::FunctionTrait for Size
|
|
88
86
|
value::Value::Array(arr) => Ok((arr.len() as i64).into()),
|
89
87
|
value::Value::Map(obj) => Ok((obj.len() as i64).into()),
|
90
88
|
value::Value::Path(..) => Ok(1.into()),
|
91
|
-
_ =>
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
.into(),
|
101
|
-
)
|
102
|
-
}
|
89
|
+
_ => Err(
|
90
|
+
RunTimeError::InvalidArgument {
|
91
|
+
function_name: "size",
|
92
|
+
index: 0,
|
93
|
+
expected_type: "array or map",
|
94
|
+
value: format!("{:?}", container),
|
95
|
+
}
|
96
|
+
.into(),
|
97
|
+
),
|
103
98
|
}
|
104
99
|
}
|
105
100
|
fn validate_arguments(&self, _: Vec<ExpressionType>) -> Result<ExpressionType>
|
@@ -1,6 +1,6 @@
|
|
1
1
|
use crate::prelude::*;
|
2
2
|
|
3
|
-
use super::
|
3
|
+
use super::FResult;
|
4
4
|
|
5
5
|
#[derive(Debug, Default)]
|
6
6
|
pub(super) struct Type {}
|
@@ -10,9 +10,9 @@ impl Type
|
|
10
10
|
fn call_impl(edge: &graph::Edge) -> FResult<String>
|
11
11
|
{
|
12
12
|
edge
|
13
|
-
.labels
|
13
|
+
.labels()
|
14
14
|
.first()
|
15
|
-
.
|
15
|
+
.ok_or(RunTimeError::MissingEdgeLabel)
|
16
16
|
.map(|v| v.to_owned())
|
17
17
|
}
|
18
18
|
}
|
@@ -2,7 +2,7 @@ use rand::Rng;
|
|
2
2
|
|
3
3
|
use crate::prelude::*;
|
4
4
|
|
5
|
-
use super::
|
5
|
+
use super::FResult;
|
6
6
|
|
7
7
|
#[derive(Debug, Default)]
|
8
8
|
pub(super) struct Rand {}
|
@@ -24,7 +24,7 @@ impl Ceil
|
|
24
24
|
{
|
25
25
|
fn call_impl(value: &f64) -> FResult<f64>
|
26
26
|
{
|
27
|
-
Ok(value.ceil()
|
27
|
+
Ok(value.ceil())
|
28
28
|
}
|
29
29
|
}
|
30
30
|
|
@@ -37,7 +37,7 @@ impl Floor
|
|
37
37
|
{
|
38
38
|
fn call_impl(value: &f64) -> FResult<f64>
|
39
39
|
{
|
40
|
-
Ok(value.floor()
|
40
|
+
Ok(value.floor())
|
41
41
|
}
|
42
42
|
}
|
43
43
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
use crate::prelude::*;
|
2
2
|
|
3
|
-
use super::
|
3
|
+
use super::FResult;
|
4
4
|
|
5
5
|
#[derive(Debug, Default)]
|
6
6
|
pub(super) struct Labels {}
|
@@ -9,7 +9,7 @@ impl Labels
|
|
9
9
|
{
|
10
10
|
fn call_impl(node: &graph::Node) -> FResult<Vec<String>>
|
11
11
|
{
|
12
|
-
Ok(node.labels.to_owned())
|
12
|
+
Ok(node.labels().to_owned())
|
13
13
|
}
|
14
14
|
}
|
15
15
|
|
@@ -0,0 +1,75 @@
|
|
1
|
+
use super::ExpressionType;
|
2
|
+
use crate::{functions::FResult, prelude::*};
|
3
|
+
|
4
|
+
#[derive(Debug, Default)]
|
5
|
+
pub(super) struct Length {}
|
6
|
+
|
7
|
+
impl super::FunctionTrait for Length
|
8
|
+
{
|
9
|
+
fn call(&self, arguments: Vec<value::Value>) -> crate::Result<value::Value>
|
10
|
+
{
|
11
|
+
let container = arguments
|
12
|
+
.first()
|
13
|
+
.ok_or_else(|| RunTimeError::InvalidNumberOfArguments {
|
14
|
+
function_name: "length",
|
15
|
+
got: arguments.len(),
|
16
|
+
expected: 1,
|
17
|
+
})?;
|
18
|
+
|
19
|
+
match container
|
20
|
+
{
|
21
|
+
value::Value::Array(arr) => Ok((arr.len() as i64).into()),
|
22
|
+
value::Value::Map(obj) => Ok((obj.len() as i64).into()),
|
23
|
+
value::Value::Path(..) => Ok(1.into()),
|
24
|
+
_ => Err(
|
25
|
+
RunTimeError::InvalidArgument {
|
26
|
+
function_name: "length",
|
27
|
+
index: 0,
|
28
|
+
expected_type: "array or map",
|
29
|
+
value: format!("{:?}", container),
|
30
|
+
}
|
31
|
+
.into(),
|
32
|
+
),
|
33
|
+
}
|
34
|
+
}
|
35
|
+
fn validate_arguments(&self, _: Vec<ExpressionType>) -> crate::Result<ExpressionType>
|
36
|
+
{
|
37
|
+
Ok(ExpressionType::Variant)
|
38
|
+
}
|
39
|
+
fn is_deterministic(&self) -> bool
|
40
|
+
{
|
41
|
+
true
|
42
|
+
}
|
43
|
+
}
|
44
|
+
|
45
|
+
super::declare_function!(length, Length, custom_trait);
|
46
|
+
|
47
|
+
#[derive(Debug, Default)]
|
48
|
+
pub(super) struct Nodes {}
|
49
|
+
|
50
|
+
impl Nodes
|
51
|
+
{
|
52
|
+
fn call_impl(path: &graph::Path) -> FResult<Vec<graph::Node>>
|
53
|
+
{
|
54
|
+
Ok(vec![path.source().clone(), path.destination().clone()])
|
55
|
+
}
|
56
|
+
}
|
57
|
+
|
58
|
+
super::declare_function!(nodes, Nodes, call_impl(crate::graph::Path) -> Vec<graph::Node>);
|
59
|
+
|
60
|
+
#[derive(Debug, Default)]
|
61
|
+
pub(super) struct Edges {}
|
62
|
+
|
63
|
+
impl Edges
|
64
|
+
{
|
65
|
+
fn call_impl(path: &graph::Path) -> FResult<Vec<graph::Edge>>
|
66
|
+
{
|
67
|
+
Ok(vec![graph::Edge::new(
|
68
|
+
path.key(),
|
69
|
+
path.labels().clone(),
|
70
|
+
path.properties().clone(),
|
71
|
+
)])
|
72
|
+
}
|
73
|
+
}
|
74
|
+
|
75
|
+
super::declare_function!(edges, Edges, call_impl(crate::graph::Path) -> Vec<graph::Edge>);
|
@@ -59,7 +59,7 @@ impl ToInteger
|
|
59
59
|
}
|
60
60
|
}
|
61
61
|
|
62
|
-
super::declare_function!(
|
62
|
+
super::declare_function!(tointeger, ToInteger, call_impl(crate::value::Value) -> i64);
|
63
63
|
|
64
64
|
#[derive(Debug, Default)]
|
65
65
|
pub(super) struct Properties {}
|
@@ -70,8 +70,8 @@ impl Properties
|
|
70
70
|
{
|
71
71
|
match value
|
72
72
|
{
|
73
|
-
value::Value::Node(n) => Ok(n.properties.to_owned()),
|
74
|
-
value::Value::Edge(e) => Ok(e.properties.to_owned()),
|
73
|
+
value::Value::Node(n) => Ok(n.properties().to_owned()),
|
74
|
+
value::Value::Edge(e) => Ok(e.properties().to_owned()),
|
75
75
|
value::Value::Map(m) => Ok(m.to_owned()),
|
76
76
|
_ => Err(RunTimeError::InvalidArgument {
|
77
77
|
function_name: "properties",
|
@@ -25,4 +25,4 @@ impl ToString
|
|
25
25
|
}
|
26
26
|
}
|
27
27
|
|
28
|
-
super::declare_function!(
|
28
|
+
super::declare_function!(tostring, ToString, call_impl(crate::value::Value) -> String, validate_args(ExpressionType::Boolean | ExpressionType::Integer | ExpressionType::Float | ExpressionType::String | ExpressionType::Null));
|
@@ -1,6 +1,6 @@
|
|
1
1
|
use crate::prelude::*;
|
2
2
|
|
3
|
-
use super::{ExpressionType, FResult
|
3
|
+
use super::{ExpressionType, FResult};
|
4
4
|
|
5
5
|
#[derive(Debug, Default)]
|
6
6
|
pub(super) struct HasLabel {}
|
@@ -11,8 +11,8 @@ impl HasLabel
|
|
11
11
|
{
|
12
12
|
match value
|
13
13
|
{
|
14
|
-
value::Value::Edge(e) => Ok(e.labels.contains(label)),
|
15
|
-
value::Value::Node(n) => Ok(n.labels.contains(label)),
|
14
|
+
value::Value::Edge(e) => Ok(e.labels().contains(label)),
|
15
|
+
value::Value::Node(n) => Ok(n.labels().contains(label)),
|
16
16
|
_ => Err(RunTimeError::InvalidArgument {
|
17
17
|
function_name: "has_label",
|
18
18
|
index: 0,
|
@@ -45,11 +45,11 @@ impl super::FunctionTrait for HasLabels
|
|
45
45
|
}
|
46
46
|
else
|
47
47
|
{
|
48
|
-
let mut it = arguments.
|
48
|
+
let mut it = arguments.iter();
|
49
49
|
let labels = match it.next().unwrap()
|
50
50
|
{
|
51
|
-
value::Value::Edge(e) => e.labels,
|
52
|
-
value::Value::Node(n) => n.labels,
|
51
|
+
value::Value::Edge(e) => e.labels(),
|
52
|
+
value::Value::Node(n) => n.labels(),
|
53
53
|
value::Value::Null => return Ok(value::Value::Null),
|
54
54
|
_ => Err(RunTimeError::InvalidArgument {
|
55
55
|
function_name: "has_labels",
|
@@ -64,7 +64,7 @@ impl super::FunctionTrait for HasLabels
|
|
64
64
|
{
|
65
65
|
value::Value::String(l) =>
|
66
66
|
{
|
67
|
-
if !labels.contains(
|
67
|
+
if !labels.contains(l)
|
68
68
|
{
|
69
69
|
return Ok(false.into());
|
70
70
|
}
|
@@ -133,56 +133,53 @@ impl Manager
|
|
133
133
|
Self {
|
134
134
|
inner: ManagerInner {
|
135
135
|
functions: HashMap::from([
|
136
|
-
containers::Head::
|
137
|
-
containers::Keys::
|
138
|
-
containers::Range::
|
139
|
-
containers::Size::
|
140
|
-
edge::Type::
|
141
|
-
math::Ceil::
|
142
|
-
math::Floor::
|
143
|
-
math::Rand::
|
144
|
-
node::Labels::
|
145
|
-
path::Length::
|
146
|
-
|
147
|
-
|
148
|
-
scalar::
|
149
|
-
|
150
|
-
|
151
|
-
|
136
|
+
containers::Head::create(),
|
137
|
+
containers::Keys::create(),
|
138
|
+
containers::Range::create(),
|
139
|
+
containers::Size::create(),
|
140
|
+
edge::Type::create(),
|
141
|
+
math::Ceil::create(),
|
142
|
+
math::Floor::create(),
|
143
|
+
math::Rand::create(),
|
144
|
+
node::Labels::create(),
|
145
|
+
path::Length::create(),
|
146
|
+
path::Nodes::create(),
|
147
|
+
path::Edges::create(),
|
148
|
+
scalar::Coalesce::create(),
|
149
|
+
scalar::Properties::create(),
|
150
|
+
scalar::ToInteger::create(),
|
151
|
+
string::ToString::create(),
|
152
|
+
value::HasLabel::create(),
|
153
|
+
value::HasLabels::create(),
|
152
154
|
]),
|
153
155
|
aggregators: aggregators::init_aggregators(),
|
154
156
|
}
|
155
157
|
.into(),
|
156
158
|
}
|
157
159
|
}
|
158
|
-
pub(crate) fn get_function<E: error::GenericErrors>(
|
159
|
-
&self,
|
160
|
-
name: impl Into<String>,
|
161
|
-
) -> Result<Function>
|
160
|
+
pub(crate) fn get_function<E: error::GenericErrors>(&self, name: &str) -> Result<Function>
|
162
161
|
{
|
163
|
-
let name = name.into();
|
164
162
|
Ok(
|
165
163
|
self
|
166
164
|
.inner
|
167
165
|
.read()?
|
168
166
|
.functions
|
169
|
-
.get(&name)
|
167
|
+
.get(&name.to_lowercase())
|
170
168
|
.ok_or_else(|| E::unknown_function(name).into())?
|
171
169
|
.clone(),
|
172
170
|
)
|
173
171
|
}
|
174
172
|
pub(crate) fn get_aggregator<E: error::GenericErrors>(
|
175
173
|
&self,
|
176
|
-
name:
|
174
|
+
name: &str,
|
177
175
|
) -> Result<aggregators::Aggregator>
|
178
176
|
{
|
179
|
-
let name = name.into();
|
180
177
|
Ok(
|
181
178
|
self
|
182
179
|
.inner
|
183
180
|
.read()?
|
184
181
|
.aggregators
|
185
|
-
.get(&name)
|
182
|
+
.get(&name.to_lowercase())
|
186
183
|
.ok_or_else(|| E::unknown_function(name).into())?
|
187
184
|
.clone(),
|
188
185
|
)
|
@@ -190,13 +187,13 @@ impl Manager
|
|
190
187
|
pub(crate) fn is_deterministic(&self, name: impl Into<String>) -> Result<bool>
|
191
188
|
{
|
192
189
|
let name = name.into();
|
193
|
-
let fun = self.get_function::<crate::error::CompileTimeError>(name
|
190
|
+
let fun = self.get_function::<crate::error::CompileTimeError>(&name);
|
194
191
|
match fun
|
195
192
|
{
|
196
193
|
Ok(fun) => Ok(fun.is_deterministic()),
|
197
194
|
Err(_) =>
|
198
195
|
{
|
199
|
-
self.get_aggregator::<crate::error::CompileTimeError>(name)?;
|
196
|
+
self.get_aggregator::<crate::error::CompileTimeError>(&name)?;
|
200
197
|
Ok(false)
|
201
198
|
}
|
202
199
|
}
|
@@ -213,12 +210,12 @@ impl Manager
|
|
213
210
|
) -> Result<ExpressionType>
|
214
211
|
{
|
215
212
|
let name = name.into();
|
216
|
-
let fun = self.get_function::<crate::error::CompileTimeError>(name
|
213
|
+
let fun = self.get_function::<crate::error::CompileTimeError>(&name);
|
217
214
|
match fun
|
218
215
|
{
|
219
216
|
Ok(fun) => fun.validate_arguments(arguments),
|
220
217
|
Err(_) => self
|
221
|
-
.get_aggregator::<crate::error::CompileTimeError>(name)?
|
218
|
+
.get_aggregator::<crate::error::CompileTimeError>(&name)?
|
222
219
|
.validate_arguments(arguments),
|
223
220
|
}
|
224
221
|
}
|
@@ -288,6 +285,7 @@ macro_rules! default_validate_ {
|
|
288
285
|
-> crate::Result<$crate::compiler::expression_analyser::ExpressionType>
|
289
286
|
{
|
290
287
|
// TODO
|
288
|
+
use $crate::functions::FunctionTypeTrait;
|
291
289
|
Ok(<$ret_type>::result_type())
|
292
290
|
}
|
293
291
|
};
|
@@ -325,7 +323,7 @@ macro_rules! declare_function_ {
|
|
325
323
|
($function_name: ident, $type_name: ty, $f_name: ident ( $( $arg_type: ty $(,)? )* ) -> $ret_type: ty, $allow_null: expr, $validator: block ) => {
|
326
324
|
impl $type_name
|
327
325
|
{
|
328
|
-
pub(super) fn
|
326
|
+
pub(super) fn create() -> (String, crate::functions::Function)
|
329
327
|
{
|
330
328
|
(
|
331
329
|
stringify!($function_name).to_string(),
|
@@ -391,7 +389,7 @@ macro_rules! declare_function {
|
|
391
389
|
($function_name: ident, $type_name: ty, custom_trait ) => {
|
392
390
|
impl $type_name
|
393
391
|
{
|
394
|
-
pub(super) fn
|
392
|
+
pub(super) fn create() -> (String, crate::functions::Function)
|
395
393
|
{
|
396
394
|
(
|
397
395
|
stringify!($function_name).to_string(),
|