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

Reference memory java $ unable to do math operators. Resulting in ref java memory #1723

Open
eisenhaus335 opened this issue Sep 16, 2024 · 4 comments
Assignees
Labels
bug Something isn't working workaround-provided

Comments

@eisenhaus335
Copy link

ArcadeDB Version:

"version": "24.1.1 (build 5ecb28ea54dc3e109336645e64794e5eb5ca8ddf/1709313171626/main)"

OS and JDK Version:

Linux 5.15.133.1-microsoft-standard-WSL2 - OpenJDK 64-Bit Server VM 11.0.22

Expected behavior

Doing operators into $ ref memory should been work correctly

Actual behavior

The sql result show is weird java ref memory "com.arcadedb.query.sql.executor.InternalResultSet@52806f961"

Steps to reproduce

begin; let max = SELECT max(seqid) FROM Invoice; let invoice = CREATE VERTEX Invoice (seqid) VALUES ($max + 1); commit retry 100; return $invoice;

@gramian
Copy link
Collaborator

gramian commented Sep 16, 2024

Reproduced, using:

CREATE VERTEX TYPE Invoice;
CREATE PROPERTY Invoice.seqid INTEGER;

@gramian
Copy link
Collaborator

gramian commented Sep 16, 2024

Here is a workaround:

LET $maxid = SELECT 1 + max(seqid) AS id FROM Invoice;
LET $invoice = INSERT INTO Invoice SET seqid = $maxid.id[0];
RETURN $invoice;

Nonetheless, the above behavior needs to be fixed.

WRT the original code, this works:

begin;
let $maxid = SELECT max(seqid) AS id FROM Invoice;
let $invoice = CREATE VERTEX Invoice (seqid) VALUES ($maxid.id[0] + 1);
commit retry 100;
return $invoice;

@gramian gramian self-assigned this Sep 16, 2024
@gramian gramian added bug Something isn't working workaround-provided labels Sep 16, 2024
@gramian
Copy link
Collaborator

gramian commented Sep 16, 2024

This seems to reproduce the problem minimally:

let maxid = SELECT max(seqid) FROM Invoice;
return $maxid.asString()

@eisenhaus335
Copy link
Author

eisenhaus335 commented Sep 16, 2024

begin;
let max = SELECT max(seqid) as id FROM Invoice;
let invoice = CREATE VERTEX Invoice (seqid) VALUES ($max.id[0].asInteger() + 1);
commit retry 100;
return $invoice;

Using this also works. I think arcade query is quite particular that we stores reference as QuerySet. That we need to do with first()/x[0]. The bug seems resulted in query transaction are not converting the value or reference the value. So they operate with the object QuerySet. Maybe, there is no default or dynamic operators that deal between sqlscript expression lines when doing operators

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working workaround-provided
Projects
None yet
Development

No branches or pull requests

2 participants