Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

left(), right(): Remove NULL from valid 2nd arg types #2966

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

nafraf
Copy link
Contributor

@nafraf nafraf commented Mar 17, 2023

This patch is to solve this small bug:

GRAPH.QUERY g "RETURN left('abc', 0.5)"
(error) Type mismatch: expected Integer or Null but was Float
GRAPH.QUERY g "RETURN left('abc', null)"
(error) length must be a non-negative integer

The reply to the first call states that Null is a valid type for the second parameter, while actually it is not.
Same for right().
When passing Null we should receive Type mismatch: expected Integer.

After applying the patch:

GRAPH.QUERY g "RETURN left('abc', 0.5)"
(error) Type mismatch: expected Integer but was Float
GRAPH.QUERY g "RETURN left('abc', null)"
(error) Type mismatch: expected Integer but was Null

@nafraf nafraf marked this pull request as ready for review March 17, 2023 15:38
@@ -702,7 +702,7 @@ void Register_StringFuncs() {

types = array_new(SIType, 2);
array_append(types, (T_STRING | T_NULL));
array_append(types, T_INT64 | T_NULL);
array_append(types, T_INT64);
Copy link
Collaborator

Choose a reason for hiding this comment

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

now need to fix the function itself

@codecov
Copy link

codecov bot commented Mar 19, 2023

Codecov Report

Patch coverage: 83.33% and no project coverage change.

Comparison is base (fb9e46c) 90.34% compared to head (2b8a01a) 90.34%.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #2966   +/-   ##
=======================================
  Coverage   90.34%   90.34%           
=======================================
  Files         283      283           
  Lines       28042    28044    +2     
=======================================
+ Hits        25334    25336    +2     
  Misses       2708     2708           
Impacted Files Coverage Δ
src/arithmetic/string_funcs/string_funcs.c 96.85% <83.33%> (-0.41%) ⬇️

... and 4 files with indirect coverage changes

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 in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

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.

None yet

2 participants