Allow adding a node to a list. by iddm · Pull Request #2726 · RedisGraph/RedisGraph · GitHub
Skip to content

Allow adding a node to a list. - #2726

Open
iddm wants to merge 5 commits into
RedisGraph:masterfrom
iddm:2291-fix-adding-a-node-to-a-list
Open

iddm wants to merge 5 commits into
RedisGraph:masterfrom
iddm:2291-fix-adding-a-node-to-a-list

Conversation

@iddm

@iddm iddm commented Nov 21, 2022

Copy link
Copy Markdown
Collaborator

The aforementioned operation was not allowed to be performed earlier.
This commit brings a change by allowing node objects to be added to
a list.

Resolves: #2291

@iddm
iddm requested a review from AviAvni November 21, 2022 12:52

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why not use SI_ALL?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what happen if adding int to node?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure if all the types listed in SI_ALL Neo4j supports to be added to a list. I'll check.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what happen if adding int to node?

Overlooked, fixed. Thanks for noticing this.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what about adding edge or path to array?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As said, still checking. I have already confirmed that edge works in Neo4J. I'll update you once I finish checking.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So paths also work. Now I really wonder whether we can use all objects here or not cuz I guess we should be able to.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed to SI_ALL. Neo4J seems to be easily working with any type of object when adding to a list. However, this same function is used for addition with other types, so I had to blacklist paths, nodes and edges from being added to anything else, which also is logical and conforms with Neo4J behaviour. In the meantime though, I have found that:

  • true + 2 causes an error in Neo4J, but in RG works (result 3).
  • point() + 2 causes an error in Neo4J, but in RG works (the result is some number).

Other types like datetime/time/duration/etc either aren't supported by RG (though defined in the enum) and/or work as in Neo4J.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Forbade addition of a point with any other type rather than an array as well. Leaving boolean additions in place as it would be a breaking behaviour (discussed privately).

@iddm
iddm force-pushed the 2291-fix-adding-a-node-to-a-list branch 2 times, most recently from 15e6786 to b97e82e Compare November 21, 2022 15:10
@codecov

codecov Bot commented Nov 21, 2022 •

Copy link
Copy Markdown

Codecov Report

Base: 92.49% // Head: 92.47% // Decreases project coverage by -0.02% ⚠️

Coverage data is based on head (1d58054) compared to base (469508e).
Patch coverage: 95.83% of modified lines in pull request are covered.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2726      +/-   ##
==========================================
- Coverage   92.49%   92.47%   -0.03%     
==========================================
  Files         263      263              
  Lines       25054    25074      +20     
==========================================
+ Hits        23174    23187      +13     
- Misses       1880     1887       +7     
Impacted Files Coverage Δ
src/graph/entities/graph_entity.c 39.09% <0.00%> (ø)
src/arithmetic/numeric_funcs/numeric_funcs.c 100.00% <100.00%> (ø)
src/value.c 89.82% <100.00%> (-0.49%) ⬇️
src/procedures/proc_sp_paths.c 95.12% <0.00%> (-1.15%) ⬇️
src/execution_plan/ops/op.c 90.65% <0.00%> (-0.94%) ⬇️
src/execution_plan/ops/op_aggregate.c 97.53% <0.00%> (-0.62%) ⬇️
src/arithmetic/arithmetic_expression.c 93.16% <0.00%> (-0.23%) ⬇️
src/procedures/proc_ss_paths.c 91.56% <0.00%> (+0.29%) ⬆️
src/util/heap.c 90.00% <0.00%> (+1.42%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@iddm
iddm force-pushed the 2291-fix-adding-a-node-to-a-list branch from b97e82e to a39c152 Compare November 21, 2022 16:36
@iddm
iddm marked this pull request as draft November 21, 2022 20:59
@iddm
iddm force-pushed the 2291-fix-adding-a-node-to-a-list branch 2 times, most recently from 81326de to bb12a4a Compare November 22, 2022 08:08
@iddm
iddm marked this pull request as ready for review November 22, 2022 08:09
@iddm
iddm force-pushed the 2291-fix-adding-a-node-to-a-list branch 2 times, most recently from 2303ad3 to 483c2a0 Compare November 22, 2022 08:13
Comment thread tests/flow/test_function_calls.py Outdated
@iddm
iddm marked this pull request as draft November 22, 2022 13:13
@iddm
iddm force-pushed the 2291-fix-adding-a-node-to-a-list branch 2 times, most recently from 26407d8 to 27b9ab8 Compare November 23, 2022 10:27
@iddm
iddm marked this pull request as ready for review November 23, 2022 10:27
@iddm
iddm force-pushed the 2291-fix-adding-a-node-to-a-list branch from 27b9ab8 to b97bfe4 Compare November 23, 2022 10:33
iddm added 5 commits November 23, 2022 14:52
The aforementioned operation was not allowed to be performed earlier.
This commit brings a change by allowing node objects to be added to
a list.

Resolves: RedisGraph#2291
A bug appeared whenever a node would be printed out with its properties and
there was a prefix in the string. It was caused by not taking into account
the number of bytes having already been written to the string before printing
out the properties of a node.

This commit changes the behaviour so that the number of bytes is taken into
account and properly writes the properties map into a string.
The only allowed type of addition with the objects of aforementioned types is
with T_ARRAY, what means appending or prepending to a list.

This commit makes sure the objects of the aforementioned types can only be
"added" this way.
Also adds a few more test cases with other types for addition with the node,
edge and path objects.
@iddm
iddm force-pushed the 2291-fix-adding-a-node-to-a-list branch from b97bfe4 to 1d58054 Compare November 23, 2022 13:52

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Error appending node to list

2 participants