[DISCUSS] Handling of mismatched types as inputs to Predicates

2023-07-13 Thread Ken Hu
Hi All,

With regard to https://issues.apache.org/jira/browse/TINKERPOP-2375

This issue opens up the conversation of what the behavior should be in
TinkerPop when there are comparisons of two objects with different types.
There are probably three simple approaches that can be taken.

1. Just throw an exception when this happens.
2. Try to cast to the wider type and compare. If there are no compatible
types then throw an exception.
3. Treat two objects of different types as being unequal.

We currently take approach 1 in 3.5.x and a mix of approach 1/3 in 3.6.x
and later. The introduction of ternary boolean starting in 3.6.x causes
certain predicates to filter with a variation of approach 3 and others to
throw like in approach 1. I would argue that it makes the most sense to
extend approach 3 to the rest of the predicates as this seems to be the
approach we've been taking recently to similar issues around filtering.

Any comments on this subject would be appreciated.

Thanks,
Ken


[jira] [Updated] (TINKERPOP-2872) Inconsistency in comparing Elements in JavaScript tests

2023-07-13 Thread Valentyn Kahamlyk (Jira)


 [ 
https://issues.apache.org/jira/browse/TINKERPOP-2872?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Valentyn Kahamlyk updated TINKERPOP-2872:
-
Priority: Major  (was: Critical)

> Inconsistency in comparing Elements in JavaScript tests
> ---
>
> Key: TINKERPOP-2872
> URL: https://issues.apache.org/jira/browse/TINKERPOP-2872
> Project: TinkerPop
>  Issue Type: Improvement
>  Components: javascript
>Affects Versions: 3.7.0
>Reporter: Valentyn Kahamlyk
>Priority: Major
>
> In most GLV's we consider Elements the same when they have the same ID.
> In JavaScript tests used [member wise 
> comparison|https://github.com/apache/tinkerpop/blob/master/gremlin-javascript/src/main/javascript/gremlin-javascript/test/cucumber/feature-steps.js#L176]
> Make it work like the others GLV's, just compare ID.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Commented] (TINKERPOP-2872) Inconsistency in comparing Elements in JavaScript tests

2023-07-13 Thread Valentyn Kahamlyk (Jira)


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

Valentyn Kahamlyk commented on TINKERPOP-2872:
--

the problem is only with tests and it takes time to fix it, so for now I reduce 
the priority

> Inconsistency in comparing Elements in JavaScript tests
> ---
>
> Key: TINKERPOP-2872
> URL: https://issues.apache.org/jira/browse/TINKERPOP-2872
> Project: TinkerPop
>  Issue Type: Improvement
>  Components: javascript
>Affects Versions: 3.7.0
>Reporter: Valentyn Kahamlyk
>Priority: Critical
>
> In most GLV's we consider Elements the same when they have the same ID.
> In JavaScript tests used [member wise 
> comparison|https://github.com/apache/tinkerpop/blob/master/gremlin-javascript/src/main/javascript/gremlin-javascript/test/cucumber/feature-steps.js#L176]
> Make it work like the others GLV's, just compare ID.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Closed] (TINKERPOP-2965) FilterRankingStrategy removing labels it shouldn't in certain conditions

2023-07-13 Thread Stephen Mallette (Jira)


 [ 
https://issues.apache.org/jira/browse/TINKERPOP-2965?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Stephen Mallette closed TINKERPOP-2965.
---
Fix Version/s: 3.7.0
   3.5.7
   3.6.5
   Resolution: Fixed

> FilterRankingStrategy removing labels it shouldn't in certain conditions
> 
>
> Key: TINKERPOP-2965
> URL: https://issues.apache.org/jira/browse/TINKERPOP-2965
> Project: TinkerPop
>  Issue Type: Bug
>  Components: process
>Affects Versions: 3.6.3
>Reporter: Stephen Mallette
>Assignee: Stephen Mallette
>Priority: Critical
> Fix For: 3.7.0, 3.5.7, 3.6.5
>
>
> This traversal demonstrates it:
> {code}
> g.V().as('n').where(
>  __.or(
>   __.select('n').hasLabel('Tag'), 
>   __.select('n').hasLabel('Person')
>  )
> ).select('n').project('n').by(__.valueMap().with('~tinkerpop.valueMap.tokens'))
> {code}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Commented] (TINKERPOP-2965) FilterRankingStrategy removing labels it shouldn't in certain conditions

2023-07-13 Thread ASF GitHub Bot (Jira)


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

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

spmallette merged PR #2124:
URL: https://github.com/apache/tinkerpop/pull/2124




> FilterRankingStrategy removing labels it shouldn't in certain conditions
> 
>
> Key: TINKERPOP-2965
> URL: https://issues.apache.org/jira/browse/TINKERPOP-2965
> Project: TinkerPop
>  Issue Type: Bug
>  Components: process
>Affects Versions: 3.6.3
>Reporter: Stephen Mallette
>Assignee: Stephen Mallette
>Priority: Critical
>
> This traversal demonstrates it:
> {code}
> g.V().as('n').where(
>  __.or(
>   __.select('n').hasLabel('Tag'), 
>   __.select('n').hasLabel('Person')
>  )
> ).select('n').project('n').by(__.valueMap().with('~tinkerpop.valueMap.tokens'))
> {code}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Commented] (TINKERPOP-2967) Add untyped GraphSON 3.0 format

2023-07-13 Thread ASF GitHub Bot (Jira)


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

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

codecov-commenter commented on PR #2138:
URL: https://github.com/apache/tinkerpop/pull/2138#issuecomment-1634751293

   ## 
[Codecov](https://app.codecov.io/gh/apache/tinkerpop/pull/2138?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
 Report
   > Merging 
[#2138](https://app.codecov.io/gh/apache/tinkerpop/pull/2138?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
 (d85d0a7) into 
[master](https://app.codecov.io/gh/apache/tinkerpop/commit/7c94ed923936b934de537a4019bf44202b2b97f8?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
 (7c94ed9) will **decrease** coverage by `4.65%`.
   > The diff coverage is `n/a`.
   
   ```diff
   @@ Coverage Diff  @@
   ## master#2138  +/-   ##
   
   - Coverage 74.79%   70.14%   -4.65% 
   
 Files  1027   24-1003 
 Lines 62181 3524   -58657 
 Branches   68610-6861 
   
   - Hits  46507 2472   -44035 
   + Misses13122  881   -12241 
   + Partials   2552  171-2381 
   ```
   
   
   [see 1003 files with indirect coverage 
changes](https://app.codecov.io/gh/apache/tinkerpop/pull/2138/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
   
   :mega: We’re building smart automated test selection to slash your CI/CD 
build times. [Learn 
more](https://about.codecov.io/iterative-testing/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
   




> Add untyped GraphSON 3.0 format
> ---
>
> Key: TINKERPOP-2967
> URL: https://issues.apache.org/jira/browse/TINKERPOP-2967
> Project: TinkerPop
>  Issue Type: Improvement
>  Components: io
>Affects Versions: 3.6.4
>Reporter: Stephen Mallette
>Assignee: Stephen Mallette
>Priority: Major
>
> Basically just make the 1.0 format available as a 3.0  mime type to maintain 
> consistency. Note that the 2.0 untyped is different and actually kinda bad, 
> but we probably shouldn't "fix" it as it would break things. 



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Commented] (TINKERPOP-2967) Add untyped GraphSON 3.0 format

2023-07-13 Thread ASF GitHub Bot (Jira)


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

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

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

   https://issues.apache.org/jira/browse/TINKERPOP-2967
   
   Essentialy exposes untyped GraphSON 3.0 which is basically the untyped 
GraphSON 1.0. Had to refactor the GraphSONModule slightly to handle this by 
passing TypeInfo through it to the serializers which needed to know whether 
they were serializing that way or not.
   
   VOTE +1




> Add untyped GraphSON 3.0 format
> ---
>
> Key: TINKERPOP-2967
> URL: https://issues.apache.org/jira/browse/TINKERPOP-2967
> Project: TinkerPop
>  Issue Type: Improvement
>  Components: io
>Affects Versions: 3.6.4
>Reporter: Stephen Mallette
>Assignee: Stephen Mallette
>Priority: Major
>
> Basically just make the 1.0 format available as a 3.0  mime type to maintain 
> consistency. Note that the 2.0 untyped is different and actually kinda bad, 
> but we probably shouldn't "fix" it as it would break things. 



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Created] (TINKERPOP-2967) Add untyped GraphSON 3.0 format

2023-07-13 Thread Stephen Mallette (Jira)
Stephen Mallette created TINKERPOP-2967:
---

 Summary: Add untyped GraphSON 3.0 format
 Key: TINKERPOP-2967
 URL: https://issues.apache.org/jira/browse/TINKERPOP-2967
 Project: TinkerPop
  Issue Type: Improvement
  Components: io
Affects Versions: 3.6.4
Reporter: Stephen Mallette
Assignee: Stephen Mallette


Basically just make the 1.0 format available as a 3.0  mime type to maintain 
consistency. Note that the 2.0 untyped is different and actually kinda bad, but 
we probably shouldn't "fix" it as it would break things. 



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Commented] (TINKERPOP-2949) More strict handling of predicates

2023-07-13 Thread ASF GitHub Bot (Jira)


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

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

spmallette commented on code in PR #2134:
URL: https://github.com/apache/tinkerpop/pull/2134#discussion_r1262571183


##
CHANGELOG.asciidoc:
##
@@ -26,6 +26,7 @@ 
image::https://raw.githubusercontent.com/apache/tinkerpop/master/docs/static/ima
 This release also includes changes from <>.
 
 * Removed `connectOnStartup` configuration option from gremlin-javascript.
+* Added marker interface `PBiPredicate` for predefined predicates.

Review Comment:
   should there be provider Upgrade Documentation for this? there are providers 
with custom predicates. knowing this change was available and when to use it, 
might be useful to them?





> More strict handling of predicates
> --
>
> Key: TINKERPOP-2949
> URL: https://issues.apache.org/jira/browse/TINKERPOP-2949
> Project: TinkerPop
>  Issue Type: Improvement
>  Components: process
>Affects Versions: 3.7.0
>Reporter: Valentyn Kahamlyk
>Priority: Critical
>
> P, TextP, ConnectiveP now accept arbitrary `biPredicate` as argument, which 
> can lead to serialization problems. Introduce new interface over  
> `biPredicate` to make predicate naming more strict



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Commented] (TINKERPOP-2949) More strict handling of predicates

2023-07-13 Thread ASF GitHub Bot (Jira)


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

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

spmallette commented on code in PR #2134:
URL: https://github.com/apache/tinkerpop/pull/2134#discussion_r1262568545


##
gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/PBiPredicate.java:
##
@@ -0,0 +1,43 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tinkerpop.gremlin.process.traversal;
+
+import java.util.function.BiPredicate;
+
+/**
+ * Marker interface for predefined {@code BiPredicate} predicates that can be 
used in {@code Predicate}}.

Review Comment:
   could you update the javadoc to say a few words about why this interface was 
needed, what it helps to do, what problems it helps avoid, etc.? 





> More strict handling of predicates
> --
>
> Key: TINKERPOP-2949
> URL: https://issues.apache.org/jira/browse/TINKERPOP-2949
> Project: TinkerPop
>  Issue Type: Improvement
>  Components: process
>Affects Versions: 3.7.0
>Reporter: Valentyn Kahamlyk
>Priority: Critical
>
> P, TextP, ConnectiveP now accept arbitrary `biPredicate` as argument, which 
> can lead to serialization problems. Introduce new interface over  
> `biPredicate` to make predicate naming more strict



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


Re: [DISCUSS] GraphSON 3.0 untyped

2023-07-13 Thread Stephen Mallette
I think I got ahead of things with this one. Doing this will create a bunch
of inconsistencies among versions which just seem weird. I think this
change is now more like:

1. Get out GraphSON 3.0+untyped to consistently have an untyped option
across versions. It will basically match the other untyped versions.
2. Reserve the listed changes for GraphSON 4.0/GraphBinary 2.0. We could
probably use that opportunity to get rid of the JVM types. I'll create a
few JIRAs and leave it at that for now.



On Wed, Jul 12, 2023 at 12:44 PM Stephen Mallette 
wrote:

> As a final thing in the serialization work I picked up, I think we need
> untyped GraphSON 3.0 to go along with 1.0 and 2.0 so basically:
>
> application/vnd.gremlin-v3.0+json;types=false
>
> I think it follows 1.0 untyped more closely than 2.0 untyped because 1.0
> was much easier to consume. The basic premise here will be to follow 1.0
> format:
>
> https://tinkerpop.apache.org/docs/3.6.4/dev/io/#graphson-1d0
>
> with a few changes/additions:
>
> 1. allow for multi-label on vertices as more graphs are allowing that
> these days.
> 2. use our "~" prefix for any structural/reserved keys like T.label or
> T.id for example
> 3. possibly get the Tree right (though we dont even have that for typed
> GraphSON 3.0 - maybe something like:
>
> {
>   "node": {},
>   "children": [{
>   "node": {},
>   "children": []
>   },
>   {
>"node": {},
>"children": []
>   },
>   {
>"node": {},
>"children": [{
>"node": {},
>"children": []
> }]
>   }]
> }
>
> please let me know if there's anything else to include.
>
>
>
>