You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@age.apache.org by GitBox <gi...@apache.org> on 2022/07/11 16:40:14 UTC

[GitHub] [age] selendym opened a new issue, #240: Negative indices on arrays seem to return nothing/null

selendym opened a new issue, #240:
URL: https://github.com/apache/age/issues/240

   **Describe the bug**
   Negative indices on arrays seem to return nothing/null.
   
   **How are you accessing AGE (Command line, driver, etc.)?**
   With `psql` from the docker image. One container for the server and another one for the client.
   
   **What data setup do we need to do?**
   ```pgsql
   select * from ag_catalog.create_graph('g');
   ```
   
   **What is the necessary configuration info needed?**
   Just the docker image built from master branch.
   
   **What is the command that caused the error?**
   ```pgsql
   select * from ag_catalog.cypher('g', $$ with [0, 1, 2, 3] as l return l[-1] $$) as (r0 ag_catalog.agtype);
   ```
   The above returns (note the empty line):
   ```text
    r0 
   ----
    
   (1 row)
   ```
   
   Compare with:
   ```pgsql
   select * from ag_catalog.cypher('g', $$ with [0, 1, 2, 3] as l return l[3] $$) as (r0 ag_catalog.agtype);
   select * from ag_catalog.cypher('g', $$ with [0, 1, 2, 3] as l return l[-1..] $$) as (r0 ag_catalog.agtype);
   ```
   which return:
   ```text
    r0 
   ----
    3
   (1 row)
   ```
   and:
   ```
    r0  
   -----
    [3]
   (1 row)
   ```
   
   **Expected behavior**
   The negative index should work as described in: https://age.apache.org/docs/master/intro/types.html#negative-index-access
   
   **Environment (please complete the following information):**
   - env: docker
   - branch: master
   - commit: 6fbdfa83d467981fb52f4318f9464bb2c9a031d9
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@age.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [age] selendym commented on issue #240: Negative indices on arrays seem to return nothing/null

Posted by GitBox <gi...@apache.org>.
selendym commented on issue #240:
URL: https://github.com/apache/age/issues/240#issuecomment-1181428543

   Thanks for the quick fix!


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@age.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [age] jrgemignani commented on issue #240: Negative indices on arrays seem to return nothing/null

Posted by GitBox <gi...@apache.org>.
jrgemignani commented on issue #240:
URL: https://github.com/apache/age/issues/240#issuecomment-1182021051

   Yeah, it is in the same access operator functions. It is getting the wrong size of the returned array, since it is in a binary format.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@age.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [age] selendym commented on issue #240: Negative indices on arrays seem to return nothing/null

Posted by GitBox <gi...@apache.org>.
selendym commented on issue #240:
URL: https://github.com/apache/age/issues/240#issuecomment-1182885944

   Thanks. Feel free to close this ticket when that gets merged.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@age.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [age] selendym commented on issue #240: Negative indices on arrays seem to return nothing/null

Posted by GitBox <gi...@apache.org>.
selendym commented on issue #240:
URL: https://github.com/apache/age/issues/240#issuecomment-1181794454

   Not sure if this is related, but seems very similar:
   ```sql
   select * from ag_catalog.cypher('g', $$ with {k0: [{k0: 'v0'}, {k1: 'v1'}]} as m return m.k0[1] $$) as (r0 ag_catalog.agtype);
   --       r0
   -- --------------
   --  {"k1": "v1"}
   -- (1 row)
   
   select * from ag_catalog.cypher('g', $$ with {k0: [{k0: 'v0'}, {k1: 'v1'}]} as m return m.k0[-1] $$) as (r0 ag_catalog.agtype);
   --  r0
   -- ----
   --
   -- (1 row)
   
   select * from ag_catalog.cypher('g', $$ with {k0: [{k0: 'v0'}, {k1: 'v1'}]} as m return m.k0[-1..] $$) as (r0 ag_catalog.agtype);
   -- ERROR:  slice must access a list
   ```
   Note the second part, where the result is missing, and the third, which results in an error (while it likely should not).
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@age.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [age] jrgemignani commented on issue #240: Negative indices on arrays seem to return nothing/null

Posted by GitBox <gi...@apache.org>.
jrgemignani commented on issue #240:
URL: https://github.com/apache/age/issues/240#issuecomment-1180756889

   I will take a look


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@age.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [age] selendym closed issue #240: Negative indices on arrays seem to return nothing/null

Posted by GitBox <gi...@apache.org>.
selendym closed issue #240: Negative indices on arrays seem to return nothing/null
URL: https://github.com/apache/age/issues/240


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@age.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [age] jrgemignani commented on issue #240: Negative indices on arrays seem to return nothing/null

Posted by GitBox <gi...@apache.org>.
jrgemignani commented on issue #240:
URL: https://github.com/apache/age/issues/240#issuecomment-1180813781

   This has been corrected, and is available, in the master branch -
   
   ```
   psql-11.5-5432-pgsql=# select * from ag_catalog.cypher('g', $$ with [0, 1, 2, 3] as l return l[-1] $$) as (r0 ag_catalog.agtype);
    r0
   ----
    3
   (1 row)
   ```
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@age.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [age] jrgemignani commented on issue #240: Negative indices on arrays seem to return nothing/null

Posted by GitBox <gi...@apache.org>.
jrgemignani commented on issue #240:
URL: https://github.com/apache/age/issues/240#issuecomment-1183402416

   The patch was applied and this should be corrected. 
   
   If this fixes the problem for you, go ahead and close the ticket. It is preferred that those who open tickets close them when the issue is resolved.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@age.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [age] selendym commented on issue #240: Negative indices on arrays seem to return nothing/null

Posted by GitBox <gi...@apache.org>.
selendym commented on issue #240:
URL: https://github.com/apache/age/issues/240#issuecomment-1183555978

   Yes, this fixes the issue. Thanks again.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@age.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [age] selendym closed issue #240: Negative indices on arrays seem to return nothing/null

Posted by GitBox <gi...@apache.org>.
selendym closed issue #240: Negative indices on arrays seem to return nothing/null
URL: https://github.com/apache/age/issues/240


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@age.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [age] selendym commented on issue #240: Negative indices on arrays seem to return nothing/null

Posted by GitBox <gi...@apache.org>.
selendym commented on issue #240:
URL: https://github.com/apache/age/issues/240#issuecomment-1181830254

   Nested arrays seem to have similar problems:
   ```sql
   select * from ag_catalog.cypher('g', $$ with [[0, 1], [2, 3]] as l return l[0][1] $$) as (r0 ag_catalog.agtype);
   --  r0 
   -- ----
   --  1
   -- (1 row)
   
   select * from ag_catalog.cypher('g', $$ with [[0, 1], [2, 3]] as l return l[0][-1] $$) as (r0 ag_catalog.agtype);
   --  r0 
   -- ----
   --  
   -- (1 row)
   
   select * from ag_catalog.cypher('g', $$ with [[0, 1], [2, 3]] as l return l[0][-1..] $$) as (r0 ag_catalog.agtype);
   --     r0    
   -- ----------
   --  [[0, 1]]
   -- (1 row)
   ```
   Note the second part, where the result is missing, and the third, which doesn't seem to make sense.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@age.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [age] jrgemignani commented on issue #240: Negative indices on arrays seem to return nothing/null

Posted by GitBox <gi...@apache.org>.
jrgemignani commented on issue #240:
URL: https://github.com/apache/age/issues/240#issuecomment-1182467386

   The other issue, with the slice operator, needs to be fixed as well. It was do to some inadvertent code changes.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@age.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [age] jrgemignani commented on issue #240: Negative indices on arrays seem to return nothing/null

Posted by GitBox <gi...@apache.org>.
jrgemignani commented on issue #240:
URL: https://github.com/apache/age/issues/240#issuecomment-1180777509

   I'm not sure how this happened. There will be a patch to fix this shortly.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@age.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [age] jrgemignani commented on issue #240: Negative indices on arrays seem to return nothing/null

Posted by GitBox <gi...@apache.org>.
jrgemignani commented on issue #240:
URL: https://github.com/apache/age/issues/240#issuecomment-1182589685

   There is a pending patch to correct this. It should be applied within the next few days.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@age.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org