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

Already on GitHub? Sign in to your account

REST returns broken JSON and sometimes misses some data [moved] #1195

Closed
lvca opened this Issue Dec 10, 2012 · 7 comments

Comments

Projects
None yet
3 participants
Owner

lvca commented Dec 10, 2012

This is Issue 1195 moved from a Google Code project.
Added by 2012-12-03T22:20:18.000Z by infected...@gmail.com.
Please review that bug for more context and additional comments, but update this bug.

Original labels: Type-Defect, Priority-Medium, v1.3.0

Original description

OrientDB release? 1.3.0-SNAPSHOT r7353


<b>What steps will reproduce the problem?</b>
1. Install the sample database.
2. Open the gremlin console and run this command: 
3. gremlin> m = [test: ['1', '2'], test2 : ['3']]; x = [b: '2']; for(item in m){ x.a = item.value.size();}; x;

Note the result:
==>b=2
==>a=1

4. Now, run the same gremlin query over REST:
$ curl -X POST -u admin:admin 'http://localhost:2480/command/test/gremlin/m+%3D+%5Btest%3A+%5B%271%27%2C+%272%27%5D%2C+test2+%3A+%5B%273%27%5D%5D%3B+x+%3D+%5Bb%3A+%272%27%5D%3B+for+%28item+in+m%29%7B+x.a+%3D+item.value.size%28%29%3B%7D%3B+x%3B/20'

Note the broken JSON and missing data

{
  &quot;result&quot;: [,
  ]
}

5. Now, run this gremlin command in the console:
gremlin> result = []; process = {item -> return [items: item, test: &quot;test&quot;, testinteger: 1]}; g.v('8:0').out('stream').gather.each{result += process(it)}; return result;

Note the result
==>{items=[v[#8:6], v[#8:7], v[#8:5], v[#8:4]], test=test, testinteger=1}

6. Now, run the exact same gremlin query over REST:
$ curl -X POST -u admin:admin 'http://localhost:2480/command/test/gremlin/result+%3D+%5B%5D%3B+process+%3D+%7Bitem+%2D%3E+return+%5Bitems%3A+item%2C+test%3A+%22test%22%2C+testinteger%3A+1%5D%7D%3B+g.v%28%278%3A0%27%29.out%28%27stream%27%29.gather.each%7Bresult+%2B%3D+process%28it%29%7D%3B+return+result%3B/20'

Note that the result is missing parts of the map:

{
  &quot;result&quot;: [{
      &quot;@type&quot;: &quot;d&quot;, &quot;@version&quot;: 0,
  &quot;value&quot;: [
    {
      &quot;items&quot;: [
      &quot;#8:6&quot;,
      &quot;#8:7&quot;,
      &quot;#8:5&quot;,
      &quot;#8:4&quot;]
    }]
    }
  ]
}

<b>What is the expected output? What do you see instead?</b>

Returned JSON should not be broken. Maps should not have missing children.

Comment 1 by project member l.garu...@gmail.com, Dec 8 (46 hours ago)

First is fixed, second one not yet. But the second goes in StackOverflow. Is it the same for you?

Comment 2 by infected...@gmail.com, Yesterday (20 hours ago)

Hi Luca, I just tested in r7415 and I do not get a stackoverflow for the second one. I am only seeing that the returned result's map has missing children.

Let me know if I can provide more info :)

And this is a copy of the database that was not migrated over:

test.zip

Owner

lvca commented Dec 19, 2012

Postponed to 1.4, sorry.

F21 commented Jan 1, 2013

Any update for this and #1183? These 2 issues are currently blockers in our app as well.

Cheers :)

Owner

lvca commented Jan 5, 2013

In order to close this can you resume where is the broken json with latest 1.4.0-SNAPSHOT please?

F21 commented Jan 5, 2013

I just tried the latest 1.4.0-SNAPSHOT in the master and here are my results:

I downloaded test.zip provided by the reporter of the bug and extracted it. I then started orientdb.

The issue with broken JSON has been fixed. However, the problem with missing data still persist.

To repeat:

1 . Start gremlin console and run the command from step 5 of the bug report:

gremlin> result = []; process = {item -> return [items: item, test: "test", testinteger: 1]}; g.v('8:0').out('stream').gather.each{result += process(it)}; return result;

Result:

==>{items=[v[#8:6], v[#8:7], v[#8:5], v[#8:4]], test=test, testinteger=1}

2 . Run the same command over REST:

$ curl -X POST -u admin:admin 'http://localhost:2480/command/test/gremlin/result+%3D+%5B%5D%3B+process+%3D+%7Bitem+%2D%3E+return+%5Bitems%3A+item%2C+test%3A+%22test%22%2C+testinteger%3A+1%5D%7D%3B+g.v%28%278%3A0%27%29.out%28%27stream%27%29.gather.each%7Bresult+%2B%3D+process%28it%29%7D%3B+return+result%3B/20'

Notice the result is missing some of the data:

{
  "result": [{
      "@type": "d", "@version": 0, 
  "value": [
    {
      "items": [
      "#8:6", 
      "#8:7", 
      "#8:5", 
      "#8:4"]
    }]
    }
  ]
}

I hope that clarifies things :)

Let me know if there's anything else I can do :)

Owner

lvca commented Mar 28, 2014

Fixed long time ago.

@lvca lvca closed this Mar 28, 2014

@lvca lvca removed this from the 2.0 milestone Mar 28, 2014

@lvca lvca added the bug label Aug 28, 2014

@lvca lvca self-assigned this Aug 28, 2014

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