Skip to content

fix(AttributeTypeUtils): use Double.NEGATIVE_INFINITY instead of Double.MIN_VALUE - #4145

Merged
chenlica merged 4 commits into
apache:mainfrom
carloea2:fix/misleading_min_value_use
Jan 10, 2026
Merged

chenlica merged 4 commits into
apache:mainfrom
carloea2:fix/misleading_min_value_use

Conversation

@carloea2

@carloea2 carloea2 commented Jan 5, 2026

Copy link
Copy Markdown
Contributor

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

carloea2 commented Jan 6, 2026

Copy link
Copy Markdown
Contributor Author

@chenlica

@chenlica

chenlica commented Jan 6, 2026

Copy link
Copy Markdown
Contributor

@Xiao-zhen-Liu Can you review it?

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

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

Copy link
Copy Markdown
Contributor

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
SarahAsad23 pushed a commit to madisonmlin/texera that referenced this pull request May 20, 2026
…le.MIN_VALUE (apache#4145)

### 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.


https://github.com/apache/texera/blob/7711ea51718a024f75f4a7e4d780e148ab5c503d/common/workflow-operator/src/main/scala/org/apache/amber/operator/aggregate/AggregationOperation.scala#L335-L345

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

### Any related issues, documentation, discussions?

Closes apache#4144  
Related discussion: apache#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

---------

Co-authored-by: Xiaozhen Liu <[email protected]>
yangzhang75 pushed a commit to yangzhang75/texera that referenced this pull request Jun 22, 2026
…le.MIN_VALUE (apache#4145)

### 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.


https://github.com/apache/texera/blob/07c35d004a1185e4098b56591166b62cc9ab4856/common/workflow-operator/src/main/scala/org/apache/amber/operator/aggregate/AggregationOperation.scala#L335-L345

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

### Any related issues, documentation, discussions?

Closes apache#4144  
Related discussion: apache#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

---------

Co-authored-by: Xiaozhen Liu <[email protected]>
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