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

.include misbehave with @rid #3630

Closed
josegomezr opened this issue Feb 19, 2015 · 10 comments
Closed

.include misbehave with @rid #3630

josegomezr opened this issue Feb 19, 2015 · 10 comments
Assignees
Labels

Comments

@josegomezr
Copy link

Reopening #3587, this time no typos.

Query 1

select *, inE('puntua').include('comida', 'servicio', 'extras') as puntuaciones, inE('puntua') as taster from Sitio

Result:

{
    "result": [
        {
            "@type": "d",
            "@rid": "#13:0",
            "@version": 7,
            "@class": "sitio",
            "in_come": [
                "#14:3",
                "#14:4",
                "#14:7"
            ],
            "nickname": "alejox",
            "nombre": "El Navegante del Sabor",
            "in_puntua": [
                "#15:0"
            ],
            "puntuaciones": [
                {
                    "@type": "d",
                    "@version": 0,
                    "comida": 8,
                    "servicio": 7,
                    "extras": 5
                }
            ],
            "taster": [
                "#15:0"
            ],
            "@fieldTypes": "in_come=g,in_puntua=g,puntuaciones=z,taster=z"
        }
// ....
    ],
    "notification": "Query executed in 0.043 sec. Returned 2 record(s)"
}

Query 2

select *, inE('puntua').include('@rid', 'comida', 'servicio', 'extras') as puntuaciones, inE('puntua') as taster from Sitio

Result:

{
    "result": [
        {
            "@type": "d",
            "@rid": "#13:0",
            "@version": 7,
            "@class": "sitio",
            "in_come": [
                "#14:3",
                "#14:4",
                "#14:7"
            ],
            "nickname": "alejox",
            "nombre": "El Navegante del Sabor",
            "in_puntua": [
                "#15:0"
            ],
            "puntuaciones": [
                "#15:0"
            ],
            "taster": [
                "#15:0"
            ],
            "@fieldTypes": "in_come=g,in_puntua=g,puntuaciones=z,taster=z"
        },
       // ...
        }
    ],
    "notification": "Query executed in 0.057 sec. Returned 2 record(s)"
}

Notice how puntuaciones became an array with only RID, and the other columns where omitted.

@yujinlim
Copy link

yujinlim commented Apr 6, 2015

I have the same issue as well. is there any better way to include @rid in the query results?

@kiejo
Copy link

kiejo commented Apr 23, 2015

Does anyone know a workaround for this?

@red-0ne
Copy link

red-0ne commented Apr 26, 2015

It is very annoying. One could use fetchplan instead, but it is not an option for us. A workaround is very welcome.

@marcelooliveira
Copy link

I got the same issue. My workaround was to create two different columns in SELECT clause: the first one includes the properties I want, and the second includes only the RIDs. In client side (I use C#), I combine properties and RIDs from both columns in the same object.

@lvca lvca added this to the 2.2 milestone May 18, 2015
@martingg88
Copy link

any update to solve this issue?

@salsaysal
Copy link

there seems to be a related issue with 'exclude' method: seems you need to exclude the @Rid so that it works.
I'm trying "select *, out('relation').include('@Rid', 'key') as related from V where @Rid = 'myVertexRid'"
because @Rid and key is all I need, and I'd prefer not to include all the many other properties with subproperties that I get if I use the fetchplan. So, it would be really nice if this worked

@lvca lvca modified the milestones: 2.2.0-beta, 2.2.0-rc1 Dec 13, 2015
@lvca lvca modified the milestones: 2.2.0-rc1, 2.2.0 GA May 7, 2016
@robfrank robfrank modified the milestones: 2.2.0 GA, 2.2.1 May 18, 2016
@robfrank robfrank modified the milestones: 2.2.1, 2.2.x (next hotfix) Jun 8, 2016
@Neglexis
Copy link

Neglexis commented Nov 1, 2017

Any update on this @lvca or @luigidellaquila? There has been no official statement from you guys, and the milestone just gets changed every now and then.

@luigidellaquila
Copy link
Member

Hi guys,

I'm afraid we cannot do much for this in v 2.2.x. Each element in the list is a document, if it has an invalid RID it's considered as an embedded document and it's serialized as it is; if it has a regular RID it's considered a linked document, so only the RID is serialized (except if you have an explicit FETCHPLAN that changes this behavior).

So the solution for now is only to have a proper fetchplan in the query.

Good news is that in V 3.0 we completely changed this logic, we deprecated fetchplans and added nested projections (see http://orientdb.com/docs/3.0.x/sql/SQL-Projections.html#nested-projections), this will hopefully solve the problem once and forever

Thanks

Luigi

@NaveenAlapati
Copy link

Adding toJSON() method should work as a work around for now. Check the sample below
select *, inE('puntua').include('@Rid', 'comida', 'servicio', 'extras').toJSON().replace("}{", "},{") as puntuaciones, inE('puntua') as taster from Sitio

@luigidellaquila
Copy link
Member

OrientDB v 3.0 solves problems related to FETCHPLAN and include() with nested projections
( https://orientdb.com/docs/3.0.x/sql/SQL-Projections.html#nested-projections ), so this issue is no longer relevant.

Closing, thanks

Luigi

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

No branches or pull requests