Skip to content

Commit

Permalink
added some exceptions for textual alg representation
Browse files Browse the repository at this point in the history
  • Loading branch information
datomo committed Dec 11, 2024
1 parent 4e1f61b commit 6238f74
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,11 @@ private void attachPolyAlgPlan( AlgNode alg ) {
InformationPolyAlg infoPolyAlg = new InformationPolyAlg( group, jsonString, PlanType.LOGICAL );
if ( shouldAttachTextualPolyAlg() ) {
// when testing, we want to access the human-readable form
infoPolyAlg.setTextualPolyAlg( alg.buildPolyAlgebra( (String) null ) );
String serialized = alg.buildPolyAlgebra( (String) null );
if ( serialized == null ) {
throw new GenericRuntimeException( "Could not serialize PolyAlgebra" );
}
infoPolyAlg.setTextualPolyAlg( serialized );
}

queryAnalyzer.registerInformation( infoPolyAlg );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,11 @@ private static void addRoutedPolyPlanPage( AlgNode routedNode, InformationManage
queryAnalyzer.addGroup( group );
InformationPolyAlg infoPolyAlg = new InformationPolyAlg( group, jsonString, isPhysical ? PlanType.PHYSICAL : PlanType.ALLOCATION );
if ( attachTextualPlan ) {
infoPolyAlg.setTextualPolyAlg( routedNode.buildPolyAlgebra( (String) null ) );
String serialized = routedNode.buildPolyAlgebra( (String) null );
if ( serialized == null ) {
throw new GenericRuntimeException( "Unable to serialize routing plan" );
}
infoPolyAlg.setTextualPolyAlg( serialized );
}
queryAnalyzer.registerInformation( infoPolyAlg );
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,12 +79,12 @@ public class PolyAlgParsingTest {
private static final String GRAPH_NAME = "polyAlgGraph";
private static final String DOC_NAME = MqlTestTemplate.namespace;
private static final String DOC_COLL = "polyalgdocs";
private static TestHelper testHelper;


@BeforeAll
public static void start() throws SQLException {
testHelper = TestHelper.getInstance();
//noinspection ResultOfMethodCallIgnored
TestHelper.getInstance();
addTestData();

}
Expand Down Expand Up @@ -197,7 +197,7 @@ private static void testQueryRoundTrip( String query, QueryLanguage ql, String n
}

for ( Information info : transaction.getQueryAnalyzer().getInformationArray() ) {
if ( info instanceof InformationPolyAlg polyInfo ) {
if ( info instanceof InformationPolyAlg polyInfo && polyInfo.getTextualPolyAlg() != null ) {
switch ( PlanType.valueOf( polyInfo.planType ) ) {
case LOGICAL -> logical = polyInfo.getTextualPolyAlg();
case ALLOCATION -> allocation = polyInfo.getTextualPolyAlg();
Expand Down

0 comments on commit 6238f74

Please sign in to comment.