Skip to content

Conversation

@carloea2
Copy link
Contributor

@carloea2 carloea2 commented Jan 5, 2026

What changes were proposed in this PR?

This PR fixes the value returned by minValue for AttributeType.DOUBLE in AggregationOperation.scala.

Previously, the code used Double.MIN_VALUE, which is the smallest positive non-zero double, not the most-negative value.

private def minValue(attributeType: AttributeType): Object =
attributeType match {
case AttributeType.INTEGER => Integer.MIN_VALUE.asInstanceOf[Object]
case AttributeType.DOUBLE => java.lang.Double.MIN_VALUE.asInstanceOf[Object]
case AttributeType.LONG => java.lang.Long.MIN_VALUE.asInstanceOf[Object]
case AttributeType.TIMESTAMP => new Timestamp(0)
case _ =>
throw new UnsupportedOperationException(
"Unsupported attribute type for min value: " + attributeType
)
}

The fix replaces Double.MIN_VALUE with Double.NEGATIVE_INFINITY and add new testing.

Any related issues, documentation, discussions?

Closes #4144
Related discussion: #4049 (Clarify minValue intent in AggregationOperation)

How was this PR tested?

  • AggregateOpSpec.scala
  • AttributeTypeUtilsSpec.scala
  • Frontend Manual Test

Was this PR authored or co-authored using generative AI tooling?

No

@carloea2
Copy link
Contributor Author

carloea2 commented Jan 6, 2026

@chenlica

@chenlica
Copy link
Contributor

chenlica commented Jan 6, 2026

@Xiao-zhen-Liu Can you review it?

@chenlica chenlica requested a review from Xiao-zhen-Liu January 6, 2026 04:45
Copy link
Contributor

@Xiao-zhen-Liu Xiao-zhen-Liu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

@chenlica chenlica merged commit ab3317b into apache:main Jan 10, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

minValue uses Double.MIN_VALUE instead of Double.NEGATIVE_INFINITY

3 participants