From 87ee2ea505f2863876fd78493e420ea1c7a25074 Mon Sep 17 00:00:00 2001 From: shirly121 Date: Wed, 27 Sep 2023 14:38:48 +0800 Subject: [PATCH] [GIE Compiler] minor fix --- .../graphscope/cypher/antlr4/WithTest.java | 3 +-- .../gremlin/antlr4x/GraphBuilderTest.java | 16 +++++++++++++--- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/interactive_engine/compiler/src/test/java/com/alibaba/graphscope/cypher/antlr4/WithTest.java b/interactive_engine/compiler/src/test/java/com/alibaba/graphscope/cypher/antlr4/WithTest.java index 6eb36f2acf51..9076848fdd25 100644 --- a/interactive_engine/compiler/src/test/java/com/alibaba/graphscope/cypher/antlr4/WithTest.java +++ b/interactive_engine/compiler/src/test/java/com/alibaba/graphscope/cypher/antlr4/WithTest.java @@ -211,8 +211,7 @@ public void with_12_test() { RelNode project = Utils.eval("Match (a:person)-[]-(b:person) Return [a.name, b.age, 1]").build(); Assert.assertEquals( - "GraphLogicalProject($f0=[ARRAY_VALUE_CONSTRUCTOR(a.name, b.age, 1)]," - + " isAppend=[false])\n" + "GraphLogicalProject($f0=[ARRAY(a.name, b.age, 1)], isAppend=[false])\n" + " GraphLogicalSingleMatch(input=[null]," + " sentence=[GraphLogicalGetV(tableConfig=[{isAll=false, tables=[person]}]," + " alias=[b], opt=[OTHER])\n" diff --git a/interactive_engine/compiler/src/test/java/com/alibaba/graphscope/gremlin/antlr4x/GraphBuilderTest.java b/interactive_engine/compiler/src/test/java/com/alibaba/graphscope/gremlin/antlr4x/GraphBuilderTest.java index d49960742de6..6e718fd1fa8b 100644 --- a/interactive_engine/compiler/src/test/java/com/alibaba/graphscope/gremlin/antlr4x/GraphBuilderTest.java +++ b/interactive_engine/compiler/src/test/java/com/alibaba/graphscope/gremlin/antlr4x/GraphBuilderTest.java @@ -135,7 +135,7 @@ public void g_V_has_name_eq_marko_test() { @Test public void g_V_has_name_neq_marko_test() { - RelNode node = eval("g.V().has('name', eq('marko'))"); + RelNode node = eval("g.V().has('name', neq('marko'))"); Assert.assertEquals( "GraphLogicalSource(tableConfig=[{isAll=true, tables=[software, person]}]," + " alias=[DEFAULT], fusedFilter=[[<>(DEFAULT.name, _UTF-8'marko')]]," @@ -152,6 +152,16 @@ public void g_V_has_age_gt_17_test() { node.explain().trim()); } + // hasNot('age') -> age is null + @Test + public void g_V_hasNot_age_test() { + RelNode node = eval("g.V().hasNot('age')"); + Assert.assertEquals( + "GraphLogicalSource(tableConfig=[{isAll=true, tables=[software, person]}]," + + " alias=[DEFAULT], fusedFilter=[[IS NULL(DEFAULT.age)]], opt=[VERTEX])", + node.explain().trim()); + } + // todo: convert SEARCH operator to ir core structure @Test public void g_V_has_age_inside_17_20_test() { @@ -178,8 +188,8 @@ public void g_V_has_age_within_test() { RelNode node = eval("g.V().has('age', within(17, 20))"); Assert.assertEquals( "GraphLogicalSource(tableConfig=[{isAll=true, tables=[software, person]}]," - + " alias=[DEFAULT], fusedFilter=[[SEARCH(DEFAULT.age, Sarg[17, 20])]]," - + " opt=[VERTEX])", + + " alias=[DEFAULT], fusedFilter=[[SEARCH(DEFAULT.age, Sarg[17, 20])]]," + + " opt=[VERTEX])", node.explain().trim()); }