Equivalent to INSTR(<string>, <string>) function for virtual graph mapping

Hi!
Trying to map a data source column via Impala within a virtual graph, I fail to see how I can replace this perfectly working query part into Stardog SMS2:

SUBSTR(location_id, INSTR(location_id, line_number)+4, 4) AS station_number

SUBSTR -> SUBSTRING (that one I figured)
INSTR -> ?

1 Like

STRLEN(STRBEFORE(location_id, line_number))+1 is equivalent to INSTR

If the error you're getting looks something like:

No match found for function signature instr(<CHARACTER>, <CHARACTER>)

... then the error is happening because Stardog's SQL parser doesn't know about the INSTR function. You can work around this by adding the following to your virtual graph options:

sql.functions=instr:varchar

-Paul

1 Like

My apologies. I just noticed I made an error. The element after the colon is the return type, so the option should be:

sql.functions=instr:integer

Having the wrong return type can appear to work for simple queries, which is why my test passed.

-Paul

1 Like