diff --git a/core/src/main/java/org/polypheny/db/algebra/metadata/AlgMetadataQuery.java b/core/src/main/java/org/polypheny/db/algebra/metadata/AlgMetadataQuery.java index a4bb7ee9d9..73c6a391b3 100644 --- a/core/src/main/java/org/polypheny/db/algebra/metadata/AlgMetadataQuery.java +++ b/core/src/main/java/org/polypheny/db/algebra/metadata/AlgMetadataQuery.java @@ -57,6 +57,7 @@ import org.polypheny.db.rex.RexNode; import org.polypheny.db.rex.RexTableIndexRef.AlgTableRef; import org.polypheny.db.util.ImmutableBitSet; +import javax.annotation.Nullable; /** @@ -232,7 +233,7 @@ public Optional getTupleCount( AlgNode alg ) { for ( ; ; ) { try { Double result = rowCountHandler.getTupleCount( alg, this ); - return Optional.of( validateResult( result ) ); + return Optional.ofNullable( validateResult( result ) ); } catch ( JaninoRelMetadataProvider.NoHandler e ) { rowCountHandler = revise( e.algClass, TupleCount.DEF ); } catch ( CyclicMetadataException e ) { @@ -408,7 +409,7 @@ public Entity getTableOrigin( AlgNode alg ) { return null; } final Set colOrigins = getColumnOrigins( alg, 0 ); - if ( colOrigins == null || colOrigins.size() == 0 ) { + if ( colOrigins == null || colOrigins.isEmpty() ) { return null; } return colOrigins.iterator().next().getOriginTable(); @@ -811,6 +812,7 @@ private static boolean isNonNegative( Double result, boolean fail ) { } + @Nullable private static Double validateResult( Double result ) { if ( result == null ) { return null;