Skip to content

[SQL] tanh function#639

Open
kbatuigas wants to merge 2 commits into
mainfrom
DOC-2263-document-feature-sql-tanh-document-on-docs-oxla
Open

[SQL] tanh function#639
kbatuigas wants to merge 2 commits into
mainfrom
DOC-2263-document-feature-sql-tanh-document-on-docs-oxla

Conversation

@kbatuigas

@kbatuigas kbatuigas commented Jul 18, 2026

Copy link
Copy Markdown
Contributor

Description

This pull request updates the SQL function documentation to standardize function names to lowercase and adds documentation for the tanh function. The changes improve consistency and clarity across the docs, ensuring that function references, examples, and descriptions use lowercase names to match SQL syntax and conventions.

Standardization of SQL function names to lowercase:

  • Updated all references, descriptions, and examples for the following functions to use lowercase: greatest, least, coalesce, and nullif (modules/reference/pages/sql/sql-functions/math-functions/greatest.adoc, modules/reference/pages/sql/sql-functions/math-functions/least.adoc, modules/reference/pages/sql/sql-functions/other-functions/coalesce.adoc, modules/reference/pages/sql/sql-functions/other-functions/nullif.adoc, modules/reference/pages/sql/sql-functions/math-functions/index.adoc, modules/reference/pages/sql/sql-functions/other-functions/index.adoc) [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13] [14] [15] [16] [17] [18] [19]

Addition of new function documentation:

  • Added documentation for the tanh (hyperbolic tangent) mathematical function, including syntax, arguments, return type, and usage examples (modules/reference/pages/sql/sql-functions/math-functions/tanh.adoc, modules/ROOT/nav.adoc, modules/reference/pages/sql/sql-functions/math-functions/index.adoc) [1] [2] [3]

Other improvements:

  • Updated documentation to use lowercase for other function names in navigation and table of contents references (modules/ROOT/nav.adoc, modules/reference/pages/sql/sql-data-types/text.adoc, modules/reference/pages/sql/sql-data-types/interval.adoc) [1] [2] [3]

These changes make the documentation more consistent with SQL syntax and easier for users to follow.

Resolves https://github.com/redpanda-data/documentation-private/issues/DOC-2263
Review deadline:

Page previews

Checks

  • New feature
  • Content gap
  • Support Follow-up
  • Small fix (typos, links, copyedits, etc)

When in prose or page titles/headings, use lowercase for function names
regardless of whether they follow SQL-standard constructs/grammar
@kbatuigas
kbatuigas requested a review from a team as a code owner July 18, 2026 02:15
@netlify

netlify Bot commented Jul 18, 2026

Copy link
Copy Markdown

Deploy Preview for rp-cloud ready!

Name Link
🔨 Latest commit aeb60cc
🔍 Latest deploy log https://app.netlify.com/projects/rp-cloud/deploys/6a5ae1a5967cb700084b42fc
😎 Deploy Preview https://deploy-preview-639--rp-cloud.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@coderabbitai

coderabbitai Bot commented Jul 18, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

Adds a new tanh SQL function reference page with syntax, type details, and examples, then registers it in the math-function index and navigation. Normalizes function names to lowercase across math, timestamp, string, interval, text, coalesce, and nullif documentation, including titles, descriptions, tables, and example headings. SQL queries and outputs remain unchanged.

Estimated code review effort: 2 (Simple) | ~10 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title is concise and matches the main change, highlighting the new tanh SQL function.
Description check ✅ Passed The description matches the template structure and covers the key changes; only page previews and review deadline remain unfilled.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch DOC-2263-document-feature-sql-tanh-document-on-docs-oxla

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot 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.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@modules/reference/pages/sql/sql-functions/math-functions/index.adoc`:
- Around line 17-18: Update the greatest and least table labels to use lowercase
function-call notation, preserving the trailing parentheses, so they match the
surrounding function references while leaving the descriptions unchanged.

In `@modules/reference/pages/sql/sql-functions/math-functions/tanh.adoc`:
- Line 16: Update the `x` argument description for `TANH` to include zero by
describing it as a number of type `real` or `double precision`, while preserving
the existing type information.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 69dcaa12-1942-46d2-aff8-295232c5ed04

📥 Commits

Reviewing files that changed from the base of the PR and between 4824c0b and aeb60cc.

📒 Files selected for processing (16)
  • modules/ROOT/nav.adoc
  • modules/reference/pages/sql/sql-data-types/interval.adoc
  • modules/reference/pages/sql/sql-data-types/text.adoc
  • modules/reference/pages/sql/sql-functions/math-functions/greatest.adoc
  • modules/reference/pages/sql/sql-functions/math-functions/index.adoc
  • modules/reference/pages/sql/sql-functions/math-functions/least.adoc
  • modules/reference/pages/sql/sql-functions/math-functions/tanh.adoc
  • modules/reference/pages/sql/sql-functions/other-functions/coalesce.adoc
  • modules/reference/pages/sql/sql-functions/other-functions/index.adoc
  • modules/reference/pages/sql/sql-functions/other-functions/nullif.adoc
  • modules/reference/pages/sql/sql-functions/string-functions/index.adoc
  • modules/reference/pages/sql/sql-functions/string-functions/position.adoc
  • modules/reference/pages/sql/sql-functions/string-functions/strpos.adoc
  • modules/reference/pages/sql/sql-functions/string-functions/substring.adoc
  • modules/reference/pages/sql/sql-functions/timestamp-functions/extract.adoc
  • modules/reference/pages/sql/sql-functions/timestamp-functions/index.adoc

Comment on lines +17 to +18
|xref:reference:sql/sql-functions/math-functions/greatest.adoc[`greatest`] |This function extracts the greatest or largest value from a set of values.
|xref:reference:sql/sql-functions/math-functions/least.adoc[`least`] |This function returns the least or smallest value in a list of values

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.

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Retain the function-call notation in the table labels.

Lowercase the names without removing (), so these entries remain consistent with the surrounding function references.

Proposed fix
-|xref:reference:sql/sql-functions/math-functions/greatest.adoc[`greatest`] |
-|xref:reference:sql/sql-functions/math-functions/least.adoc[`least`] |
+|xref:reference:sql/sql-functions/math-functions/greatest.adoc[`greatest()`] |
+|xref:reference:sql/sql-functions/math-functions/least.adoc[`least()`] |
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
|xref:reference:sql/sql-functions/math-functions/greatest.adoc[`greatest`] |This function extracts the greatest or largest value from a set of values.
|xref:reference:sql/sql-functions/math-functions/least.adoc[`least`] |This function returns the least or smallest value in a list of values
|xref:reference:sql/sql-functions/math-functions/greatest.adoc[`greatest()`] |This function extracts the greatest or largest value from a set of values.
|xref:reference:sql/sql-functions/math-functions/least.adoc[`least()`] |This function returns the least or smallest value in a list of values
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@modules/reference/pages/sql/sql-functions/math-functions/index.adoc` around
lines 17 - 18, Update the greatest and least table labels to use lowercase
function-call notation, preserving the trailing parentheses, so they match the
surrounding function references while leaving the descriptions unchanged.


== Arguments

* `x`: A positive or negative number of type `real` or `double precision`.

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.

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Include zero in the argument description.

The page documents TANH(0) below, but “positive or negative” excludes zero. Describe x as a number, or explicitly include zero.

Proposed fix
-* `x`: A positive or negative number of type `real` or `double precision`.
+* `x`: A number of type `real` or `double precision`, including zero.
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
* `x`: A positive or negative number of type `real` or `double precision`.
* `x`: A number of type `real` or `double precision`, including zero.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@modules/reference/pages/sql/sql-functions/math-functions/tanh.adoc` at line
16, Update the `x` argument description for `TANH` to include zero by describing
it as a number of type `real` or `double precision`, while preserving the
existing type information.


=== Negative value

`tanh` is an odd function, so `TANH(-x)` returns the negative of `TANH(x)`:

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

I had to ask Claude what "odd function" means:

A function f is odd if it satisfies: f(-x) = -f(x)

For tanh specifically: since tanh(x) = sinh(x)/cosh(x), and sinh is odd while cosh is even, you get:

tanh(-x) = sinh(-x)/cosh(-x) = -sinh(x)/cosh(x) = -tanh(x)

which is exactly the property the sentence describes.

A couple of contrasts that might help pin down the concept:

Even function: f(-x) = f(x) — symmetric about the y-axis. cos(x) and x² are classic examples.
Odd function: f(-x) = -f(x) — symmetric about the origin. sin(x), x³, and tanh(x) are examples.
Most functions are neither even nor odd (e.g., eˣ).

While "odd" has this technical meaning, I doubt many users will know it, and it will just confuse the users that don't. I think you should remove the "odd" terminology.

For reference, the sinh/cosh documentation doesn't say that sinh is odd and cosh is even, so I don't think we should use that terminology here.

|xref:reference:sql/sql-functions/string-functions/ends-with.adoc[`ends_with()`] |Checks if a string ends with a specified substring
|xref:reference:sql/sql-functions/string-functions/concat.adoc[`concat()`] |Adds two or more strings together
|xref:reference:sql/sql-functions/string-functions/substring.adoc[`SUBSTRING`] |Extracts a substring from a string. `SUBSTR` is an alias.
|xref:reference:sql/sql-functions/string-functions/substring.adoc[`substring`] |Extracts a substring from a string. `substr` is an alias.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

In the first column, substring should have parentheses after it (substring()) to be consistent with the rest of the column.

|xref:reference:sql/sql-functions/string-functions/regex/regexp-replace.adoc[`regexp_replace()`] |Substitutes new text for substrings that match POSIX regular expression patterns
|xref:reference:sql/sql-functions/string-functions/replace.adoc[`replace()`] |Finds and replace occurrences of a substring in a string
|xref:reference:sql/sql-functions/string-functions/position.adoc[`POSITION`] |Returns the position of the first occurrence of a substring in a string
|xref:reference:sql/sql-functions/string-functions/position.adoc[`position`] |Returns the position of the first occurrence of a substring in a string

@rsamuels-panda rsamuels-panda Jul 20, 2026

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

In the first column, position should have parentheses after it (position()) to be consistent with the rest of the column.

|xref:reference:sql/sql-functions/timestamp-functions/timestamp-micros.adoc[`timestamp_micros()`] |Converts a UNIX timestamp in microseconds to a timestamp.
|xref:reference:sql/sql-functions/timestamp-functions/timestamp-trunc.adoc[`timestamp_trunc()`] |Truncates a given timestamp to the nearest time part. Supported time parts are YEAR, MONTH, DAY, HOUR, MINUTE, and SECOND
|xref:reference:sql/sql-functions/timestamp-functions/extract.adoc[`EXTRACT`] |Extracts some part of a specified timestamp or interval.
|xref:reference:sql/sql-functions/timestamp-functions/extract.adoc[`extract`] |Extracts some part of a specified timestamp or interval.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

In the first column, extract should have parentheses after it (extract()) to be consistent with the rest of the column.

|===
|Function |Description
|xref:reference:sql/sql-functions/other-functions/coalesce.adoc[`COALESCE`] |Returns the first argument that is not NULL, while the remaining arguments from the first non-null argument are not evaluated.
|xref:reference:sql/sql-functions/other-functions/coalesce.adoc[`coalesce`] |Returns the first argument that is not NULL, while the remaining arguments from the first non-null argument are not evaluated.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

In the first column, coalesce should have parentheses after it (coalesce()) to be consistent with the rest of the column. Also, note the formatting: this has backticks around "coalesce" so it shows up in monospace font, but the other rows in this table don't have backticks in the first column and render in plain font.

|xref:reference:sql/sql-functions/other-functions/current-schema.adoc[current_schema()] |Returns the schema's name (first in the search path).
|xref:reference:sql/sql-functions/other-functions/has-schema-privilege.adoc[has_schema_privilege()] |Checks whether the current user has specific privileges on a schema.
|xref:reference:sql/sql-functions/other-functions/nullif.adoc[`NULLIF`] |Replaces a given value with NULL if it matches a specific criterion.
|xref:reference:sql/sql-functions/other-functions/nullif.adoc[`nullif`] |Replaces a given value with NULL if it matches a specific criterion.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Same issue here as with "coalesce"

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants