From 86b9743778837ad503ea2bd711cec8e7bd382365 Mon Sep 17 00:00:00 2001 From: Tobias Weber Date: Thu, 12 Dec 2024 13:24:19 +0100 Subject: [PATCH] Fixes for failing scheduler tests --- .../java/org/polypheny/db/rex/RexLiteral.java | 4 +-- .../adapter/jdbc/rel2sql/SqlImplementor.java | 4 +-- .../db/workflow/dag/WorkflowImpl.java | 12 +++++++++ .../db/workflow/dag/edges/ControlEdge.java | 1 + .../db/workflow/dag/edges/DataEdge.java | 1 + .../engine/scheduler/WorkflowScheduler.java | 2 +- .../storage/reader/CheckpointReader.java | 27 +++---------------- .../engine/scheduler/GlobalSchedulerTest.java | 2 -- 8 files changed, 23 insertions(+), 30 deletions(-) diff --git a/core/src/main/java/org/polypheny/db/rex/RexLiteral.java b/core/src/main/java/org/polypheny/db/rex/RexLiteral.java index 925a87830a..07ce25e716 100644 --- a/core/src/main/java/org/polypheny/db/rex/RexLiteral.java +++ b/core/src/main/java/org/polypheny/db/rex/RexLiteral.java @@ -424,7 +424,7 @@ private static void printAsJava( PolyValue value, PrintWriter pw, PolyType typeN pw.print( value.asBoolean().value ); break; case DECIMAL: - assert value.isBigDecimal(); + assert value.isNumber(); pw.print( value.asBigDecimal().value ); break; case DOUBLE: @@ -432,7 +432,7 @@ private static void printAsJava( PolyValue value, PrintWriter pw, PolyType typeN pw.print( Util.toScientificNotation( value.asNumber().BigDecimalValue() ) ); break; case BIGINT: - assert value.isBigDecimal(); + assert value.isNumber(); pw.print( value.asNumber().bigDecimalValue() ); pw.print( 'L' ); break; diff --git a/plugins/jdbc-adapter-framework/src/main/java/org/polypheny/db/adapter/jdbc/rel2sql/SqlImplementor.java b/plugins/jdbc-adapter-framework/src/main/java/org/polypheny/db/adapter/jdbc/rel2sql/SqlImplementor.java index ebb6768fa6..2459e63863 100644 --- a/plugins/jdbc-adapter-framework/src/main/java/org/polypheny/db/adapter/jdbc/rel2sql/SqlImplementor.java +++ b/plugins/jdbc-adapter-framework/src/main/java/org/polypheny/db/adapter/jdbc/rel2sql/SqlImplementor.java @@ -517,9 +517,9 @@ public SqlNode toSql( RexProgram program, RexNode rex ) { return SqlLiteral.createCharString( literal.value.asString().value, POS ); case NUMERIC: case EXACT_NUMERIC: - return SqlLiteral.createExactNumeric( literal.value.asBigDecimal().value.toString(), POS ); + return SqlLiteral.createExactNumeric( literal.value.asNumber().bigDecimalValue().toString(), POS ); case APPROXIMATE_NUMERIC: - return SqlLiteral.createApproxNumeric( literal.value.asBigDecimal().value.toString(), POS ); + return SqlLiteral.createApproxNumeric( literal.value.asNumber().bigDecimalValue().toString(), POS ); case BOOLEAN: return SqlLiteral.createBoolean( literal.value.asBoolean().value, POS ); case INTERVAL_YEAR_MONTH: diff --git a/plugins/workflow-engine/src/main/java/org/polypheny/db/workflow/dag/WorkflowImpl.java b/plugins/workflow-engine/src/main/java/org/polypheny/db/workflow/dag/WorkflowImpl.java index 746801d800..726c9eaf62 100644 --- a/plugins/workflow-engine/src/main/java/org/polypheny/db/workflow/dag/WorkflowImpl.java +++ b/plugins/workflow-engine/src/main/java/org/polypheny/db/workflow/dag/WorkflowImpl.java @@ -387,4 +387,16 @@ public void validateStructure( StorageManager sm, AttributedDirectedGraph> getIterator() { * @return An iterable that yields tuples as mutable lists. */ public final Iterable> getIterable() { - return new Iterable<>() { - @NotNull - @Override - public Iterator> iterator() { - return getIterator(); - } - }; + return this::getIterator; } @@ -126,14 +119,7 @@ public Pair>> getIteratorFromQuery( Checkp */ public Pair>> getIterableFromQuery( CheckpointQuery query ) { Pair>> pair = getIteratorFromQuery( query, List.of( this ) ); - return Pair.of( pair.left, - new Iterable<>() { - @NotNull - @Override - public Iterator> iterator() { - return pair.right; - } - } ); + return Pair.of( pair.left, () -> pair.right ); } @@ -204,6 +190,7 @@ public Pair>> getIteratorFromQuery( Checkp .query( queryStr ) .language( QueryLanguage.from( query.getQueryLanguage() ) ) .isAnalysed( false ) + .batch( 100 ) // TODO: ensure this has the desired effect, then change to suitable value .origin( StorageManager.ORIGIN ) .namespaceId( entity.getNamespaceId() ) .transactionManager( transaction.getTransactionManager() ) @@ -241,13 +228,7 @@ public Pair>> getIteratorFromQuery( Checkp public Pair>> getIterableFromQuery( CheckpointQuery query, List inputs ) { Pair>> pair = getIteratorFromQuery( query, inputs ); return Pair.of( pair.left, - new Iterable<>() { - @NotNull - @Override - public Iterator> iterator() { - return pair.right; - } - } ); + () -> pair.right ); } diff --git a/plugins/workflow-engine/src/test/java/org/polypheny/db/workflow/engine/scheduler/GlobalSchedulerTest.java b/plugins/workflow-engine/src/test/java/org/polypheny/db/workflow/engine/scheduler/GlobalSchedulerTest.java index d9e3a9a645..a54befc33f 100644 --- a/plugins/workflow-engine/src/test/java/org/polypheny/db/workflow/engine/scheduler/GlobalSchedulerTest.java +++ b/plugins/workflow-engine/src/test/java/org/polypheny/db/workflow/engine/scheduler/GlobalSchedulerTest.java @@ -132,7 +132,6 @@ void executeWorkflowInStepsTest() throws Exception { @Test - @Disabled void simpleFusionTest() throws Exception { Workflow workflow = WorkflowUtils.getSimpleFusion(); List ids = WorkflowUtils.getTopologicalActivityIds( workflow ); @@ -161,7 +160,6 @@ void advancedFusionTest() throws Exception { @Test - @Disabled void RelValuesFusionTest() throws Exception { Workflow workflow = WorkflowUtils.getRelValuesFusion(); List ids = WorkflowUtils.getTopologicalActivityIds( workflow );