Skip to content

Commit

Permalink
small adjustment to handle potential null value on rowcount
Browse files Browse the repository at this point in the history
  • Loading branch information
datomo committed Dec 11, 2024
1 parent aa7e405 commit 4e1f61b
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;


/**
Expand Down Expand Up @@ -232,7 +233,7 @@ public Optional<Double> 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 ) {
Expand Down Expand Up @@ -408,7 +409,7 @@ public Entity getTableOrigin( AlgNode alg ) {
return null;
}
final Set<AlgColumnOrigin> colOrigins = getColumnOrigins( alg, 0 );
if ( colOrigins == null || colOrigins.size() == 0 ) {
if ( colOrigins == null || colOrigins.isEmpty() ) {
return null;
}
return colOrigins.iterator().next().getOriginTable();
Expand Down Expand Up @@ -811,6 +812,7 @@ private static boolean isNonNegative( Double result, boolean fail ) {
}


@Nullable
private static Double validateResult( Double result ) {
if ( result == null ) {
return null;
Expand Down

0 comments on commit 4e1f61b

Please sign in to comment.