github-actions[bot] commented on code in PR #3544:
URL: https://github.com/apache/doris-website/pull/3544#discussion_r3072249992
##########
docs/sql-manual/sql-functions/aggregate-functions/regr-intercept.md:
##########
@@ -29,52 +25,40 @@ REGR_INTERCEPT(<y>, <x>)
## Return Value
-Returns a Double value representing the intercept of the univariate linear
regression line for non-null pairs in a group. If there are no rows, or only
rows that contain nulls, the function returns NULL.
+Returns a Double value representing the intercept of the linear regression
line.
+If there are no rows in the group, or all rows contain NULLs for the
expressions, the function returns `NULL`.
-## Examples
+## Example
```sql
--- Create sample table
-CREATE TABLE test_regr_intercept (
+CREATE TABLE test_regr (
`id` int,
- `x` int,
- `y` int
+ `x` double,
+ `y` double
) DUPLICATE KEY (`id`)
DISTRIBUTED BY HASH(`id`) BUCKETS AUTO
PROPERTIES (
"replication_allocation" = "tag.location.default: 1"
);
--- Insert sample data
-INSERT INTO test_regr_intercept VALUES
-(1, 18, 13),
-(2, 14, 27),
-(3, 12, 2),
-(4, 5, 6),
-(5, 10, 20);
-
--- Calculate the linear regression intercept of x and y
-SELECT REGR_INTERCEPT(y, x) FROM test_regr_intercept;
-```
-
-```text
-+----------------------+
-| REGR_INTERCEPT(y, x) |
-+----------------------+
-| 5.512931034482759 |
-+----------------------+
+INSERT INTO test_regr VALUES
+(1, 0, NULL),
+(2, 1, 3),
+(2, 2, 5),
+(2, 3, 7),
+(2, 4, 9),
+(2, 5, NULL);
```
```sql
-SELECT REGR_INTERCEPT(y, x) FROM test_regr_intercept where x>100;
+SELECT id, REGR_INTERCEPT(y, x) FROM test_regr GROUP BY id ORDER BY id;
```
-When there are no rows in the group, the function returns `NULL`.
-
```text
-+----------------------+
-| REGR_INTERCEPT(y, x) |
-+----------------------+
-| NULL |
-+----------------------+
++------+------------------------+
+| id | REGR_INTERCEPT(y, x) |
++------+------------------------+
Review Comment:
**Table alignment issue**: the header row `| id | REGR_INTERCEPT(y, x) |`
has 22 characters in the second column, but the border
`+------+------------------------+` has 24 dashes. It should have one more
trailing space:
```
| id | REGR_INTERCEPT(y, x) |
```
##########
docs/sql-manual/sql-functions/aggregate-functions/regr-intercept.md:
##########
@@ -29,52 +25,40 @@ REGR_INTERCEPT(<y>, <x>)
## Return Value
-Returns a Double value representing the intercept of the univariate linear
regression line for non-null pairs in a group. If there are no rows, or only
rows that contain nulls, the function returns NULL.
+Returns a Double value representing the intercept of the linear regression
line.
+If there are no rows in the group, or all rows contain NULLs for the
expressions, the function returns `NULL`.
-## Examples
+## Example
```sql
--- Create sample table
-CREATE TABLE test_regr_intercept (
+CREATE TABLE test_regr (
`id` int,
- `x` int,
- `y` int
+ `x` double,
+ `y` double
) DUPLICATE KEY (`id`)
DISTRIBUTED BY HASH(`id`) BUCKETS AUTO
PROPERTIES (
"replication_allocation" = "tag.location.default: 1"
);
--- Insert sample data
-INSERT INTO test_regr_intercept VALUES
-(1, 18, 13),
-(2, 14, 27),
-(3, 12, 2),
-(4, 5, 6),
-(5, 10, 20);
-
--- Calculate the linear regression intercept of x and y
-SELECT REGR_INTERCEPT(y, x) FROM test_regr_intercept;
-```
-
-```text
-+----------------------+
-| REGR_INTERCEPT(y, x) |
-+----------------------+
-| 5.512931034482759 |
-+----------------------+
+INSERT INTO test_regr VALUES
+(1, 0, NULL),
+(2, 1, 3),
+(2, 2, 5),
+(2, 3, 7),
+(2, 4, 9),
+(2, 5, NULL);
```
```sql
-SELECT REGR_INTERCEPT(y, x) FROM test_regr_intercept where x>100;
+SELECT id, REGR_INTERCEPT(y, x) FROM test_regr GROUP BY id ORDER BY id;
```
-When there are no rows in the group, the function returns `NULL`.
-
```text
-+----------------------+
-| REGR_INTERCEPT(y, x) |
-+----------------------+
-| NULL |
-+----------------------+
++------+------------------------+
+| id | REGR_INTERCEPT(y, x) |
++------+------------------------+
+| 1 | NULL |
+| 2 | 1.0 |
++------+------------------------+
Review Comment:
**Table alignment issue**: the data row `| 2 | 1.0 |`
has only 20 characters in the second column vs the required 24 (border width).
It should be:
```
| 2 | 1.0 |
```
##########
docs/sql-manual/sql-functions/aggregate-functions/regr-avgx.md:
##########
@@ -0,0 +1,64 @@
+---
+{
+ "title": "REGR_AVGX",
+ "language": "en",
+ "description": "Returns the average of the independent variable (x) for
non-null pairs in a group."
+}
+---
+
+## Description
+
+Returns the average of the independent variable `x` over non-null `(y, x)`
pairs in a group, where `x` is the independent variable and `y` is the
dependent variable.
+
+## Syntax
+
+```sql
+REGR_AVGX(<y>, <x>)
+```
+
+## Parameters
+
+| Parameter | Description |
+| -- | -- |
+| `<y>` | The dependent variable. Supported type: Double. |
+| `<x>` | The independent variable. Supported type: Double. |
+
+## Return Value
+
+Returns a Double value representing the average of `x` for non-null `(y, x)`
pairs.
+If there are no rows in the group, or all rows contain NULLs for the
expressions, the function returns `NULL`.
+
+## Example
+
+```sql
+CREATE TABLE test_regr (
+ `id` int,
+ `x` double,
+ `y` double
+) DUPLICATE KEY (`id`)
+DISTRIBUTED BY HASH(`id`) BUCKETS AUTO
+PROPERTIES (
+ "replication_allocation" = "tag.location.default: 1"
+);
+
+INSERT INTO test_regr VALUES
+(1, 0, NULL),
+(2, 1, 3),
+(2, 2, 5),
+(2, 3, 7),
+(2, 4, 9),
+(2, 5, NULL);
+```
+
+```sql
+SELECT id, REGR_AVGX(y, x) FROM test_regr GROUP BY id ORDER BY id;
+```
+
+```text
++------+--------------------+
+| id | REGR_AVGX(y, x) |
++------+--------------------+
Review Comment:
**Minor table alignment**: the header row `| id | REGR_AVGX(y, x) |` is
1 character shorter than the border `+------+--------------------+` (20
dashes). Add one trailing space:
```
| id | REGR_AVGX(y, x) |
```
The same 1-character header misalignment affects all other new English
`docs/` files (`regr-avgy`, `regr-count`, `regr-r2`, `regr-slope`, `regr-sxx`,
`regr-sxy`, `regr-syy`). The corresponding zh-CN current files are correctly
aligned.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]