[ 
https://issues.apache.org/jira/browse/ATLAS-1284?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15709030#comment-15709030
 ] 

Neeru Gupta edited comment on ATLAS-1284 at 12/1/16 5:31 PM:
-------------------------------------------------------------

[~shwetaag] I double checked and found that queries like you mentioned still 
does not work.  But queries like following work. 

from src as s select s.name orderby s.name 

I debugged the scala code and found the issue. Basically we apply the order by 
clause before select clause. So orderby clause does not have information about 
select clause and alias. Please look at generate gremlin below for a similar 
query. Please let me know if you think, I should spend time on ATLAS-1007. 

  "gremlin": "import java.util.function.Function;import static 
org.apache.tinkerpop.gremlin.process.traversal.P.*;def g = 
graph.traversal();L:{def _var_0 = [] as Set;g.V().has(\"__typeName\", 
\"OMAS_OMRSAsset\").fill(_var_0);g.V().has(\"__superTypeNames\", 
\"OMAS_OMRSAsset\").fill(_var_0);(_var_0.isEmpty() ? g.V('') : g.V(_var_0 as 
Object[])).has('__is_graphdb_vertex',eq(true)).order().by({((String)property(\"OMAS_OMRSCommonObject.name\").orElse(null))}
 as Function,{ a,b -> (a.toString().toLowerCase()) <=> 
(b.toString().toLowerCase()) 
}).as(\"_src1\").select(\"_src1\").by({[((String)((it as Vertex[]) as 
List<Vertex>).last().property(\"OMAS_OMRSCommonObject.name\").orElse(null))]} 
as Function).toList()}",



was (Author: guptaneeru):
[~shwetaag] I double checked and found that queries like you mentioned still 
does not work.  But queries like following works. 

from src as s select s.name orderby s.name 

I debugged the scala code and found the issue. Basically we apply the order by 
clause before select clause. So orderby clause does not have information about 
select clause and alias. Please look at generate gremlin below for a similar 
query. Please let me know if you think, I should spend time on ATLAS-1007. 

  "gremlin": "import java.util.function.Function;import static 
org.apache.tinkerpop.gremlin.process.traversal.P.*;def g = 
graph.traversal();L:{def _var_0 = [] as Set;g.V().has(\"__typeName\", 
\"OMAS_OMRSAsset\").fill(_var_0);g.V().has(\"__superTypeNames\", 
\"OMAS_OMRSAsset\").fill(_var_0);(_var_0.isEmpty() ? g.V('') : g.V(_var_0 as 
Object[])).has('__is_graphdb_vertex',eq(true)).order().by({((String)property(\"OMAS_OMRSCommonObject.name\").orElse(null))}
 as Function,{ a,b -> (a.toString().toLowerCase()) <=> 
(b.toString().toLowerCase()) 
}).as(\"_src1\").select(\"_src1\").by({[((String)((it as Vertex[]) as 
List<Vertex>).last().property(\"OMAS_OMRSCommonObject.name\").orElse(null))]} 
as Function).toList()}",


> Fix order by clause to be able to order on super type attributes and with 
> alias.
> --------------------------------------------------------------------------------
>
>                 Key: ATLAS-1284
>                 URL: https://issues.apache.org/jira/browse/ATLAS-1284
>             Project: Atlas
>          Issue Type: Bug
>    Affects Versions: 0.7-incubating
>            Reporter: Neeru Gupta
>            Assignee: Neeru Gupta
>
> Noticed issues with order by to work with alias and while sorting on super 
> type attributes. 



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to