asterixdb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jianfeng Jia <jianfeng....@gmail.com>
Subject Undefined behavior for substring-before() and substring-after() in match-not-found case
Date Tue, 29 Sep 2015 01:03:40 GMT
Hi Devs,

Another question about the string functions.

The example code on the http://asterixdb.ics.uci.edu/documentation/aql/functions.html#StringFunctions
<http://asterixdb.ics.uci.edu/documentation/aql/functions.html#StringFunctions> shows
that these two function are suppose to be called after contains(). I wonder what is the expected
behavior if the they can't find the match pattern?

The current result is confusing. 

e.g. 
let $x := "substring"
return [ substring-before($x, "subx"), substring-after($x, “subx”)]

it will return 
[ [ "subst", "" ]
 ]
Should we always return an empty string in such case, or throw an exception like “you shall
filter the result by contain() first” ? 
IMHO, I’d like to return a null string. Any opinion?


Best,

Jianfeng Jia
PhD Candidate of Computer Science
University of California, Irvine


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message