Skip to content

Conversation

@ishaoxy
Copy link
Contributor

@ishaoxy ishaoxy commented Jul 31, 2025

Description

Added some missing functions in v2 and v3.

  • add
  • subtract
  • multiply
  • divide
  • cosh
  • sinh
  • rint
  • signum
  • expm1
  • modulus

Added related IT and doc.

Related Issues

Resolves #3898

Check List

  • New functionality includes testing.
  • New functionality has been documented.
  • New functionality has javadoc added.
  • New functionality has a user manual doc added.
  • API changes companion pull request created.
  • Commits are signed per the DCO using --signoff.
  • Public documentation issue/PR created.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

Signed-off-by: Xinyu Hao <[email protected]>
ishaoxy added 3 commits August 1, 2025 13:34
Signed-off-by: Xinyu Hao <[email protected]>
Signed-off-by: Xinyu Hao <[email protected]>
Signed-off-by: Xinyu Hao <[email protected]>
ishaoxy added 2 commits August 1, 2025 16:01
Signed-off-by: Xinyu Hao <[email protected]>
Signed-off-by: Xinyu Hao <[email protected]>
registerOperator(RAND, SqlStdOperatorTable.RAND);
registerOperator(ROUND, SqlStdOperatorTable.ROUND);
registerOperator(SIGN, SqlStdOperatorTable.SIGN);
registerOperator(SIGNUM, SqlStdOperatorTable.SIGN);
Copy link
Collaborator

Choose a reason for hiding this comment

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

The return type of SqlStdOperatorTable.SIGN (ARG0) seems to be different with SIGNUM (INTEGER) described in the documentation.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Now the behavior is exactly the same as the existing function sign. Let me keep these changes first.

PLUS_FUCTION: 'ADD';
MINUS_FUCTION: 'SUBTRACT';
STAR_FUNCTION: 'MULTIPLY';
DIVIDE_FUNCTION: 'DIVIDE';
Copy link
Collaborator

Choose a reason for hiding this comment

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

I'm a little unsure about whether should we explicitly add these functions or keep them as is.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I added them with reference to this issue #1339. If you think they are inappropriate, I can delete these functions.

Signed-off-by: Xinyu Hao <[email protected]>
Signed-off-by: Xinyu Hao <[email protected]>
Copy link
Collaborator

@yuancu yuancu left a comment

Choose a reason for hiding this comment

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

Looks good to me

@LantaoJin LantaoJin added the enhancement New feature or request label Aug 4, 2025
LantaoJin
LantaoJin previously approved these changes Aug 4, 2025
};
}

public static ImplementorUDF adaptMathFunctionToUDF(
Copy link
Member

Choose a reason for hiding this comment

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

Can you add a Javadoc for this class?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Of course. Added.

Signed-off-by: Xinyu Hao <[email protected]>
@qianheng-aws qianheng-aws merged commit d6aac3c into opensearch-project:main Aug 8, 2025
25 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport 2.19-dev enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[RFC] Missing UDFs in both v2 and v3

4 participants