For multiple rows will it be ? :
.returns(regexMatch("id=\\p{Graph}+; a=1"),
regexMatch("id=\\p{Graph}+; a=2")); // ordered
.returnsUnordered(regexMatch("id=\\p{Graph}+; a=1"),
regexMatch("id=\\p{Graph}+; a=2")); // unordered
On Wed, Jan 2, 2019 at 8:57 PM Michael Mior <[email protected]> wrote:
> +1 to what Julian said.
>
> --
> Michael Mior
> [email protected]
>
>
> Le mer. 2 janv. 2019 à 19:57, Julian Hyde <[email protected]> a écrit :
>
> > I wouldn’t do regex by default. Quite a few characters are regex meta
> > characters (e.g. “(“ and “.”) and it’s a pain to have to remember to
> escape
> > them when copy-pasting output into the test.
> >
> > So, my vote is for
> >
> > > .returns(regexMatch("id=\\p{Graph}+; a=1")) // separate consumer
> >
> > I don’t have an opinion on group capturing.
> >
> > > On Jan 2, 2019, at 4:26 PM, Andrei Sereda <[email protected]> wrote:
> > >
> > > Hello,
> > >
> > >
> > > As part of [CALCITE-2755](
> > https://issues.apache.org/jira/browse/CALCITE-2755)
> > > ([982](https://github.com/apache/calcite/pull/982)) I needed to
> perform
> > > regex comparison of result (since it is not known in advance).
> > >
> > > The assertion looks like:
> > >
> > > ```java
> > > assertThat()
> > > .query("select id, a from view")
> > > .returns(regexMatch("id=\\p{Graph}+; a=1"))
> > > ```
> > > Do you think CalciteAssert might benefit from regular expressions ?
> > Should
> > > it support expressions natively or as standalone Consumer
> implementation
> > ?
> > > Should it also support [group capturing](
> > > https://docs.oracle.com/javase/tutorial/essential/regex/groups.html) ?
> > If
> > > so, what is recommended syntax ?
> > >
> > > ### Syntax examples
> > > ```java
> > > .returns(regexMatch("id=\\p{Graph}+; a=1")) // separate consumer
> > > .returns("id=\\p{Graph}+; a=1") // native support
> > > .returns("id=REGEX{\\p{Graph}+}; a=1") // special syntax
> > > .returns("id=(\\p{Graph}+); a=$1-test") // group capturing ?
> > > ```
> > >
> > > Regards,
> > > Andrei.
> >
> >
>