Kelvin R. Lawrence created TINKERPOP-2375:
---------------------------------------------
Summary: Text Predicates fail if they encounter non strings
Key: TINKERPOP-2375
URL: https://issues.apache.org/jira/browse/TINKERPOP-2375
Project: TinkerPop
Issue Type: Bug
Components: process
Affects Versions: 3.4.6
Environment: MacOS + TinkerPop 3.4.6 , Gremlin Console, TinkerGraph
Reporter: Kelvin R. Lawrence
This issue comes from investigating the report on Stack Overflow here:
[https://stackoverflow.com/questions/62013568/how-to-do-gremlin-contain-search-for-both-number-and-string]
It was reported against Neptune but I see the same behavior with TinkerGraph.
As best I can tell the poster has overloaded a property key so that it is
sometimes a float and sometimes a string. There is no error if the number
matches exactly but if it does not and the TextP part of the {{or}} step
triggers then an exception is thrown as {{TextP.containing}} tries to work
against a float value. I guess the question is, should the text predicates be
smart enough to ignore non String property values?
Here is a simple reproducer
gremlin> graph = TinkerGraph.open()
==>tinkergraph[vertices:0 edges:0]
gremlin> g = graph.traversal()
==>graphtraversalsource[tinkergraph[vertices:0 edges:0], standard]
gremlin> g.addV('test').property('x',12.5)
==>v[0]
gremlin> g.addV('test').property('x','ABCDEF')
==>v[2]
gremlin>
g.V().hasLabel('test').or(has('x',12.3),has('x',TextP.containing('CDE')))
java.math.BigDecimal cannot be cast to java.lang.String
Type ':help' or ':h' for help.
Display stack trace? [yN]
--
This message was sent by Atlassian Jira
(v8.3.4#803005)