If at compile we can figure out that an  expression is an empty string than
I agree and we should move that at the semantic check step. But I am afraid
we evaluate expressions much later in the process. Am I wrong?
On Feb 10, 2014 4:58 PM, "Chris Leishman" <notifications@github.com> wrote:

> In
> community/cypher/cypher-compiler-2.0/src/main/scala/org/neo4j/cypher/internal/compiler/v2_0/commands/expressions/StringFunctions.scala:
>
> > @@ -190,6 +190,46 @@ case class ReplaceFunction(orig: Expression, search: Expression, replaceWith: Ex
> >                                  search.symbolTableDependencies ++
> >                                  replaceWith.symbolTableDependencies
> >  }
> > +case class SplitFunction(orig: Expression, splitPattern: Expression)
> > +  extends NullInNullOutExpression(orig) with StringHelper {
> > +  def compute(value: Any, m: ExecutionContext)(implicit state: QueryState): Any = {
> > +    val origVal = asString(orig(m))
> > +    val splitPatternVal = asString(splitPattern(m))
> > +
> > +    if (origVal == null || splitPatternVal == null) {
> > +      null
> > +    } else {
> > +      if (splitPatternVal.length > 0) {
> > +        split(origVal, splitPatternVal)
> > +      } else {
> > +        throw new IllegalArgumentException("The split pattern must not be an empty string")
>
> Won't this be user visible? We should probably wrap it the right cypher
> exception (and possibly pick it up during semantic checking?).
>
> --
> Reply to this email directly or view it on GitHub<https://github.com/neo4j/neo4j/pull/1926/files#r9588680>
> .
>