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

ASF GitHub Bot commented on TINKERPOP-2621:
-------------------------------------------

spmallette opened a new pull request #1481:
URL: https://github.com/apache/tinkerpop/pull/1481


   This functionality was allowed by Java/Groovy so it seems to follow that we 
have the same here:
   
   ```text
   gremlin> P.within()
   ==>within([])
   ```
   
   Builds with `mvn clean install` which means that the variants were content 
with this syntax as well. 
   
   VOTE +1


-- 
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: commits-unsubscr...@tinkerpop.apache.org

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


> toString for traversals such as within with empty array returns empty string 
> as argument instead of brackets
> ------------------------------------------------------------------------------------------------------------
>
>                 Key: TINKERPOP-2621
>                 URL: https://issues.apache.org/jira/browse/TINKERPOP-2621
>             Project: TinkerPop
>          Issue Type: Bug
>          Components: language
>    Affects Versions: 3.5.1
>            Reporter: Tal Ron
>            Priority: Major
>
> I use the gremlin Translator to translate bytecode query to script in order 
> to allow sending it to neptune profile/explain endpoints.
> a query which include a steps such as '.within([])'  , notice the empty 
> array, is translated to 
> .within()   which fails in neptune, where  within([])  with empty brackets 
> actually works.
> now I don't know if this is neptune blame which should allow such traversal 
> or gremlin (client) issue, and if gremlin should print empty brackets or 
> empty string..
> see: node_modules/gremlin/lib/process/traversal.js :
> return this.operator + '(' + formatValue(this.value) + ')';
> .toString([])  => ''
>  
>  
> {code:java}
> // 
>   toString() {
>     function formatValue(value){
>       if (Array.isArray(value)) {
>         let acc = [];
>         for (const item of value) {
>           acc.push(formatValue(item));
>         }
>         return acc;
>       }
>       if (value && typeof value === "string"){
>         return "'" + value + "'";
>       }
>       return value;
>     }
>     if (this.other === undefined || this.other === null) {
>       return this.operator + '(' + formatValue(this.value) + ')';
>     }
>     return this.operator + '(' + formatValue(this.value) + ', ' + 
> formatValue(this.other) + ')';
>   } {code}
>  
>  



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to