From 0c883c83bcb098f04e81b7db658d3db477df2292 Mon Sep 17 00:00:00 2001 From: Nicolas Laval Date: Mon, 18 Dec 2023 10:23:12 +0100 Subject: [PATCH 1/2] Fix analytic expressions in tests --- .../vtl/spark/processing/engine/analytic/AnalyticAvgTest.java | 2 +- .../vtl/spark/processing/engine/analytic/AnalyticCountTest.java | 2 +- .../vtl/spark/processing/engine/analytic/AnalyticFirstTest.java | 2 +- .../vtl/spark/processing/engine/analytic/AnalyticLagTest.java | 2 +- .../vtl/spark/processing/engine/analytic/AnalyticLastTest.java | 2 +- .../vtl/spark/processing/engine/analytic/AnalyticMaxTest.java | 2 +- .../spark/processing/engine/analytic/AnalyticMedianTest.java | 2 +- .../vtl/spark/processing/engine/analytic/AnalyticMinTest.java | 2 +- .../spark/processing/engine/analytic/AnalyticStdPopTest.java | 2 +- .../spark/processing/engine/analytic/AnalyticStdSampTest.java | 2 +- .../vtl/spark/processing/engine/analytic/AnalyticSumTest.java | 2 +- .../spark/processing/engine/analytic/AnalyticVarPopTest.java | 2 +- .../spark/processing/engine/analytic/AnalyticVarSampTest.java | 2 +- 13 files changed, 13 insertions(+), 13 deletions(-) diff --git a/vtl-spark/src/test/java/fr/insee/vtl/spark/processing/engine/analytic/AnalyticAvgTest.java b/vtl-spark/src/test/java/fr/insee/vtl/spark/processing/engine/analytic/AnalyticAvgTest.java index 28fd4238a..c774a4c7a 100644 --- a/vtl-spark/src/test/java/fr/insee/vtl/spark/processing/engine/analytic/AnalyticAvgTest.java +++ b/vtl-spark/src/test/java/fr/insee/vtl/spark/processing/engine/analytic/AnalyticAvgTest.java @@ -300,7 +300,7 @@ public void testAnAvgWithPartitionOrderByRangeClause() throws ScriptException { context.setAttribute("ds1", anCountDS1, ScriptContext.ENGINE_SCOPE); - engine.eval("res := avg ( ds1 over ( partition by Id_1 order by Year range between -1 and 1) );"); + engine.eval("res := avg ( ds1 over ( partition by Id_1 order by Year range between -1 preceding and 1 following) );"); assertThat(engine.getContext().getAttribute("res")).isInstanceOf(Dataset.class); /* diff --git a/vtl-spark/src/test/java/fr/insee/vtl/spark/processing/engine/analytic/AnalyticCountTest.java b/vtl-spark/src/test/java/fr/insee/vtl/spark/processing/engine/analytic/AnalyticCountTest.java index 480c64604..4f8cf46d1 100644 --- a/vtl-spark/src/test/java/fr/insee/vtl/spark/processing/engine/analytic/AnalyticCountTest.java +++ b/vtl-spark/src/test/java/fr/insee/vtl/spark/processing/engine/analytic/AnalyticCountTest.java @@ -410,7 +410,7 @@ public void testAnCountWithPartitionOrderByRange() throws ScriptException { context.setAttribute("ds1", anCountDS1, ScriptContext.ENGINE_SCOPE); - engine.eval("res := count ( ds1 over ( partition by Id_1 order by Year range between (-1 and 1)) );"); + engine.eval("res := count ( ds1 over ( partition by Id_1 order by Year range between -1 preceding and 1 following) );"); assertThat(engine.getContext().getAttribute("res")).isInstanceOf(Dataset.class); /* diff --git a/vtl-spark/src/test/java/fr/insee/vtl/spark/processing/engine/analytic/AnalyticFirstTest.java b/vtl-spark/src/test/java/fr/insee/vtl/spark/processing/engine/analytic/AnalyticFirstTest.java index c04190e11..c150caf8d 100644 --- a/vtl-spark/src/test/java/fr/insee/vtl/spark/processing/engine/analytic/AnalyticFirstTest.java +++ b/vtl-spark/src/test/java/fr/insee/vtl/spark/processing/engine/analytic/AnalyticFirstTest.java @@ -194,7 +194,7 @@ public void testAnFirstPartitionOrderByRangeClause() throws ScriptException { context.setAttribute("ds2", ds2, ScriptContext.ENGINE_SCOPE); - engine.eval("res := first_value ( ds2 over ( partition by Id_1 order by Year range between -1 and 1) );"); + engine.eval("res := first_value ( ds2 over ( partition by Id_1 order by Year range between -1 preceding and 1 following) );"); assertThat(engine.getContext().getAttribute("res")).isInstanceOf(Dataset.class); /* diff --git a/vtl-spark/src/test/java/fr/insee/vtl/spark/processing/engine/analytic/AnalyticLagTest.java b/vtl-spark/src/test/java/fr/insee/vtl/spark/processing/engine/analytic/AnalyticLagTest.java index b6b216e7a..a77f252e5 100644 --- a/vtl-spark/src/test/java/fr/insee/vtl/spark/processing/engine/analytic/AnalyticLagTest.java +++ b/vtl-spark/src/test/java/fr/insee/vtl/spark/processing/engine/analytic/AnalyticLagTest.java @@ -102,7 +102,7 @@ public void testAnLag() throws ScriptException { context.setAttribute("ds2", ds2, ScriptContext.ENGINE_SCOPE); - engine.eval("res := lag ( ds2 , 1 over ( partition by Id_1 , Id_2 order by Year ) );"); + engine.eval("res := lag ( ds2 over ( partition by Id_1 , Id_2 order by Year ) );"); assertThat(engine.getContext().getAttribute("res")).isInstanceOf(Dataset.class); /* diff --git a/vtl-spark/src/test/java/fr/insee/vtl/spark/processing/engine/analytic/AnalyticLastTest.java b/vtl-spark/src/test/java/fr/insee/vtl/spark/processing/engine/analytic/AnalyticLastTest.java index c37652080..e2820192b 100644 --- a/vtl-spark/src/test/java/fr/insee/vtl/spark/processing/engine/analytic/AnalyticLastTest.java +++ b/vtl-spark/src/test/java/fr/insee/vtl/spark/processing/engine/analytic/AnalyticLastTest.java @@ -198,7 +198,7 @@ public void testAnLastPartitionOrderByRangeClause() throws ScriptException { context.setAttribute("ds2", ds2, ScriptContext.ENGINE_SCOPE); - engine.eval("res := last_value ( ds1 over ( partition by Id_1, Id_2 order by Year range between -1 and 1) );"); + engine.eval("res := last_value ( ds2 over ( partition by Id_1, Id_2 order by Year range between -1 preceding and 1 following) );"); assertThat(engine.getContext().getAttribute("res")).isInstanceOf(Dataset.class); /* diff --git a/vtl-spark/src/test/java/fr/insee/vtl/spark/processing/engine/analytic/AnalyticMaxTest.java b/vtl-spark/src/test/java/fr/insee/vtl/spark/processing/engine/analytic/AnalyticMaxTest.java index 1edd9dfa1..eb17a6021 100644 --- a/vtl-spark/src/test/java/fr/insee/vtl/spark/processing/engine/analytic/AnalyticMaxTest.java +++ b/vtl-spark/src/test/java/fr/insee/vtl/spark/processing/engine/analytic/AnalyticMaxTest.java @@ -296,7 +296,7 @@ public void testAnMaxWithPartitionOrderByRangeClause() throws ScriptException { context.setAttribute("ds1", anCountDS1, ScriptContext.ENGINE_SCOPE); - engine.eval("res := max ( ds1 over ( partition by Id_1 order by Year range between -1 and 1) );"); + engine.eval("res := max ( ds1 over ( partition by Id_1 order by Year range between -1 preceding and 1 following) );"); assertThat(engine.getContext().getAttribute("res")).isInstanceOf(Dataset.class); /* diff --git a/vtl-spark/src/test/java/fr/insee/vtl/spark/processing/engine/analytic/AnalyticMedianTest.java b/vtl-spark/src/test/java/fr/insee/vtl/spark/processing/engine/analytic/AnalyticMedianTest.java index 6e2d920d6..9695c72f1 100644 --- a/vtl-spark/src/test/java/fr/insee/vtl/spark/processing/engine/analytic/AnalyticMedianTest.java +++ b/vtl-spark/src/test/java/fr/insee/vtl/spark/processing/engine/analytic/AnalyticMedianTest.java @@ -297,7 +297,7 @@ public void testAnMedianWithPartitionOrderByRangeClause() throws ScriptException context.setAttribute("ds1", anCountDS1, ScriptContext.ENGINE_SCOPE); - engine.eval("res := median ( ds1 over ( partition by Id_1 order by Year range between -1 and 1) );"); + engine.eval("res := median ( ds1 over ( partition by Id_1 order by Year range between -1 preceding and 1 following) );"); assertThat(engine.getContext().getAttribute("res")).isInstanceOf(Dataset.class); /* diff --git a/vtl-spark/src/test/java/fr/insee/vtl/spark/processing/engine/analytic/AnalyticMinTest.java b/vtl-spark/src/test/java/fr/insee/vtl/spark/processing/engine/analytic/AnalyticMinTest.java index cc7ab6caf..925de430e 100644 --- a/vtl-spark/src/test/java/fr/insee/vtl/spark/processing/engine/analytic/AnalyticMinTest.java +++ b/vtl-spark/src/test/java/fr/insee/vtl/spark/processing/engine/analytic/AnalyticMinTest.java @@ -348,7 +348,7 @@ public void testAnMinWithPartitionOrderByRangeClause() throws ScriptException { context.setAttribute("ds1", anCountDS1, ScriptContext.ENGINE_SCOPE); - engine.eval("res := min ( ds1 over ( partition by Id_1 order by Year range between -1 and 1) );"); + engine.eval("res := min ( ds1 over ( partition by Id_1 order by Year range between -1 preceding and 1 following) );"); assertThat(engine.getContext().getAttribute("res")).isInstanceOf(Dataset.class); /* diff --git a/vtl-spark/src/test/java/fr/insee/vtl/spark/processing/engine/analytic/AnalyticStdPopTest.java b/vtl-spark/src/test/java/fr/insee/vtl/spark/processing/engine/analytic/AnalyticStdPopTest.java index f34e39666..c7805a884 100644 --- a/vtl-spark/src/test/java/fr/insee/vtl/spark/processing/engine/analytic/AnalyticStdPopTest.java +++ b/vtl-spark/src/test/java/fr/insee/vtl/spark/processing/engine/analytic/AnalyticStdPopTest.java @@ -254,7 +254,7 @@ public void testAnStdPopWithPartitionOrderByRangeClause() throws ScriptException context.setAttribute("ds1", ds1, ScriptContext.ENGINE_SCOPE); - engine.eval("res := stddev_pop ( ds1 over ( partition by Id_1 order by Year range between -1 and 1) );"); + engine.eval("res := stddev_pop ( ds1 over ( partition by Id_1 order by Year range between -1 preceding and 1 following) );"); assertThat(engine.getContext().getAttribute("res")).isInstanceOf(Dataset.class); /* diff --git a/vtl-spark/src/test/java/fr/insee/vtl/spark/processing/engine/analytic/AnalyticStdSampTest.java b/vtl-spark/src/test/java/fr/insee/vtl/spark/processing/engine/analytic/AnalyticStdSampTest.java index f54f5db90..9bcdef456 100644 --- a/vtl-spark/src/test/java/fr/insee/vtl/spark/processing/engine/analytic/AnalyticStdSampTest.java +++ b/vtl-spark/src/test/java/fr/insee/vtl/spark/processing/engine/analytic/AnalyticStdSampTest.java @@ -271,7 +271,7 @@ public void testAnStdSampWithPartitionOrderByRangeClause() throws ScriptExceptio context.setAttribute("ds1", ds1, ScriptContext.ENGINE_SCOPE); - engine.eval("res := stddev_samp ( ds1 over ( partition by Id_1 order by Year range between -1 and 1) );"); + engine.eval("res := stddev_samp ( ds1 over ( partition by Id_1 order by Year range between -1 preceding and 1 following) );"); assertThat(engine.getContext().getAttribute("res")).isInstanceOf(Dataset.class); /* diff --git a/vtl-spark/src/test/java/fr/insee/vtl/spark/processing/engine/analytic/AnalyticSumTest.java b/vtl-spark/src/test/java/fr/insee/vtl/spark/processing/engine/analytic/AnalyticSumTest.java index bdef6cc22..7672a8a77 100644 --- a/vtl-spark/src/test/java/fr/insee/vtl/spark/processing/engine/analytic/AnalyticSumTest.java +++ b/vtl-spark/src/test/java/fr/insee/vtl/spark/processing/engine/analytic/AnalyticSumTest.java @@ -354,7 +354,7 @@ public void testAnSumWithPartitionOrderByRangeClause() throws ScriptException { context.setAttribute("ds1", anCountDS1, ScriptContext.ENGINE_SCOPE); - engine.eval("res := sum ( ds1 over ( partition by Id_1 order by Year range between -1 and 1) );"); + engine.eval("res := sum ( ds1 over ( partition by Id_1 order by Year range between -1 preceding and 1 following) );"); assertThat(engine.getContext().getAttribute("res")).isInstanceOf(Dataset.class); /* diff --git a/vtl-spark/src/test/java/fr/insee/vtl/spark/processing/engine/analytic/AnalyticVarPopTest.java b/vtl-spark/src/test/java/fr/insee/vtl/spark/processing/engine/analytic/AnalyticVarPopTest.java index e5fd31fe8..c4ee569c7 100644 --- a/vtl-spark/src/test/java/fr/insee/vtl/spark/processing/engine/analytic/AnalyticVarPopTest.java +++ b/vtl-spark/src/test/java/fr/insee/vtl/spark/processing/engine/analytic/AnalyticVarPopTest.java @@ -311,7 +311,7 @@ public void testAnVarPopWithPartitionOrderByRangeClause() throws ScriptException context.setAttribute("ds1", anCountDS1, ScriptContext.ENGINE_SCOPE); - engine.eval("res := var_pop ( ds1 over ( partition by Id_1 order by Year range between -1 and 1) );"); + engine.eval("res := var_pop ( ds1 over ( partition by Id_1 order by Year range between -1 preceding and 1 following) );"); assertThat(engine.getContext().getAttribute("res")).isInstanceOf(Dataset.class); /* diff --git a/vtl-spark/src/test/java/fr/insee/vtl/spark/processing/engine/analytic/AnalyticVarSampTest.java b/vtl-spark/src/test/java/fr/insee/vtl/spark/processing/engine/analytic/AnalyticVarSampTest.java index fb5c3ce13..63091c660 100644 --- a/vtl-spark/src/test/java/fr/insee/vtl/spark/processing/engine/analytic/AnalyticVarSampTest.java +++ b/vtl-spark/src/test/java/fr/insee/vtl/spark/processing/engine/analytic/AnalyticVarSampTest.java @@ -207,7 +207,7 @@ public void testAnVarSampWithPartitionOrderByRangeClause() throws ScriptExceptio context.setAttribute("ds1", ds1, ScriptContext.ENGINE_SCOPE); - engine.eval("res := var_pop ( ds1 over ( partition by Id_1 order by Year range between -1 and 1) );"); + engine.eval("res := var_pop ( ds1 over ( partition by Id_1 order by Year range between -1 preceding and 1 following) );"); assertThat(engine.getContext().getAttribute("res")).isInstanceOf(Dataset.class); /* From 76b78d3da5a7b0771a1d0d722886acc6832c4343 Mon Sep 17 00:00:00 2001 From: Nicolas Laval Date: Mon, 18 Dec 2023 10:26:28 +0100 Subject: [PATCH 2/2] Fix engine test --- .../insee/vtl/engine/exceptions/UnimplementedExceptionTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vtl-engine/src/test/java/fr/insee/vtl/engine/exceptions/UnimplementedExceptionTest.java b/vtl-engine/src/test/java/fr/insee/vtl/engine/exceptions/UnimplementedExceptionTest.java index 2d26d4add..6b1b4ad4a 100644 --- a/vtl-engine/src/test/java/fr/insee/vtl/engine/exceptions/UnimplementedExceptionTest.java +++ b/vtl-engine/src/test/java/fr/insee/vtl/engine/exceptions/UnimplementedExceptionTest.java @@ -31,6 +31,6 @@ public void testSimple() { assertThatThrownBy(() -> { engine.eval(vtlExpression); - }).isInstanceOf(UnimplementedException.class); + }).isInstanceOf(UnsupportedOperationException.class); } }