Skip to content

Commit

Permalink
Avoid unnecessary downcast
Browse files Browse the repository at this point in the history
  • Loading branch information
martint committed Mar 15, 2024
1 parent dbc037e commit 2008196
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1641,10 +1641,10 @@ private FrameOffsetPlanAndSymbol planFrameOffset(PlanBuilder subPlan, Optional<S

Expression offsetToBigint;

if (offsetType instanceof DecimalType && !((DecimalType) offsetType).isShort()) {
if (offsetType instanceof DecimalType decimalType && !decimalType.isShort()) {
String maxBigint = Long.toString(Long.MAX_VALUE);
int maxBigintPrecision = maxBigint.length();
int actualPrecision = ((DecimalType) offsetType).getPrecision();
int actualPrecision = decimalType.getPrecision();

if (actualPrecision < maxBigintPrecision) {
offsetToBigint = new Cast(offsetSymbol.toSymbolReference(), BIGINT);
Expand Down

0 comments on commit 2008196

Please sign in to comment.