Skip to content

Conversation

pabloem
Copy link
Contributor

@pabloem pabloem commented Oct 2, 2025

TODO

  • Add ClampMaxTests
  • Add ClampMinTests
  • Add Clamp max examples
  • Add clamp min examples

@elasticsearchmachine elasticsearchmachine added v9.3.0 needs:triage Requires assignment of a team area label labels Oct 2, 2025
Copy link
Contributor

github-actions bot commented Oct 2, 2025

Copy link
Contributor

github-actions bot commented Oct 2, 2025

ℹ️ Important: Docs version tagging

👋 Thanks for updating the docs! Just a friendly reminder that our docs are now cumulative. This means all 9.x versions are documented on the same page and published off of the main branch, instead of creating separate pages for each minor version.

We use applies_to tags to mark version-specific features and changes.

Expand for a quick overview

When to use applies_to tags:

✅ At the page level to indicate which products/deployments the content applies to (mandatory)
✅ When features change state (e.g. preview, ga) in a specific version
✅ When availability differs across deployments and environments

What NOT to do:

❌ Don't remove or replace information that applies to an older version
❌ Don't add new information that applies to a specific version without an applies_to tag
❌ Don't forget that applies_to tags can be used at the page, section, and inline level

🤔 Need help?

@pabloem pabloem changed the title Clamp family of functions [wip] Clamp family of functions Oct 2, 2025
@john-wagster john-wagster added the :StorageEngine/ES|QL Timeseries / metrics / logsdb capabilities in ES|QL label Oct 3, 2025
@elasticsearchmachine elasticsearchmachine added Team:StorageEngine and removed needs:triage Requires assignment of a team area label labels Oct 3, 2025
@elasticsearchmachine
Copy link
Collaborator

Pinging @elastic/es-storage-engine (Team:StorageEngine)

@pabloem pabloem changed the title [wip] Clamp family of functions Clamp family of functions Oct 3, 2025
@pabloem pabloem requested review from dnhatn and kkrik-es October 3, 2025 23:24
Copy link
Member

@dnhatn dnhatn left a comment

Choose a reason for hiding this comment

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

I've left some comments. Thank you, Pablo! I will do another detailed review.

@dnhatn dnhatn self-requested a review October 8, 2025 05:42
Copy link
Member

@dnhatn dnhatn left a comment

Choose a reason for hiding this comment

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

It's getting closer. Thanks Pablo!


**Description**

Returns clamps the values of all input samples clamped to have an upper limit of max.
Copy link
Member

Choose a reason for hiding this comment

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

nit: remove returns

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

@dnhatn dnhatn self-requested a review October 8, 2025 05:55
@pabloem
Copy link
Contributor Author

pabloem commented Oct 8, 2025

@dnhatn
Copy link
Member

dnhatn commented Oct 8, 2025

You can disable it here for the ClampTests:

@pabloem
Copy link
Contributor Author

pabloem commented Oct 8, 2025

that's embarrassing. thanks nhat - working on that...

@pabloem pabloem enabled auto-merge (squash) October 9, 2025 02:43
Copy link
Member

@dnhatn dnhatn left a comment

Choose a reason for hiding this comment

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

I left some minor comments; the comments for ClampMax also applies to ClampMin. The PR looks great; please address these before merging. Thanks, Pablo!


@Override
public ExpressionEvaluator.Factory toEvaluator(ToEvaluator toEvaluator) {
// force datatype initialization
Copy link
Member

Choose a reason for hiding this comment

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

leftover comment?

}

var field = children().get(0);
var min = children().get(1);
Copy link
Member

Choose a reason for hiding this comment

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

nit: max?

}
resolution = TypeResolutions.isType(
min,
t -> t.isNumeric() ? fieldDataType.isNumeric() : t.noText() == fieldDataType,
Copy link
Member

Choose a reason for hiding this comment

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

t.noText() == fieldDataType.noText()

var outputType = dataType();

var max = children().get(1);
var maxF = outputType != max.dataType()
Copy link
Member

Choose a reason for hiding this comment

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

Maybe check the element type of both side to avoid the cast? PlannerUtils.toElementType(outputType) != PlannerUtils.toElementType(max.dataType())?

12.125 | 2024-05-10T00:07:19.000Z
12.125 | 2024-05-10T00:17:39.000Z
12.0 | 2024-05-10T00:08:08.000Z
;
Copy link
Member

Choose a reason for hiding this comment

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

another ask - can you ask a test where min/max is another column instead of constant?

@pabloem pabloem merged commit 80a3488 into elastic:main Oct 9, 2025
34 checks passed
@kkrik-es
Copy link
Contributor

kkrik-es commented Oct 9, 2025

Let's make sure Nhat's comments are addressed, in a follow-up. It's a good idea to skip auto-submit.

@pabloem
Copy link
Contributor Author

pabloem commented Oct 9, 2025

yes I will address on a follow-up!

@dnhatn
Copy link
Member

dnhatn commented Oct 9, 2025

No worries, thanks Pablo! They're just minor comments.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

>enhancement :StorageEngine/ES|QL Timeseries / metrics / logsdb capabilities in ES|QL Team:StorageEngine v9.3.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants