Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding studentt_cdf UDF #421

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fixed argument types
  • Loading branch information
dqmis committed Jun 7, 2024
commit 8f85a7cf90c530521abd0c9cfcb926fa0484009a
4 changes: 2 additions & 2 deletions udfs/community/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ SELECT bqutil.fn.int(1.684)
* [random_int](#random_intmin-any-type-max-any-type)
* [random_string](#random_stringlength-int64)
* [random_value](#random_valuearr-any-type)
* [studentt_cdf](#studentt_cdfx-float64-dof-int64)
* [studentt_cdf](#studentt_cdfx-float64-dof-float64)
* [sure_cond](#sure_cond)
* [sure_like](#sure_like)
* [sure_nonnull](#sure_nonnull)
Expand Down Expand Up @@ -2360,7 +2360,7 @@ Results:

---

### [studentt_cdf(x FLOAT64, dof INT64)](studentt_cdf.sqlx)
### [studentt_cdf(x FLOAT64, dof FLOAT64)](studentt_cdf.sqlx)

Returns the value of x in the cdf of the Student's T distribution with dof degrees of freedom.

Expand Down
2 changes: 1 addition & 1 deletion udfs/community/studentt_cdf.sqlx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ config { hasOutput: true }
*/


CREATE OR REPLACE FUNCTION ${self()}(x FLOAT64, dof INT64)
CREATE OR REPLACE FUNCTION ${self()}(x FLOAT64, dof FLOAT64)
RETURNS FLOAT64
LANGUAGE js AS """
return jstat['jStat']['studentt']['cdf']( x, dof )
Expand Down
2 changes: 1 addition & 1 deletion udfs/community/test_cases.js
Original file line number Diff line number Diff line change
Expand Up @@ -1209,7 +1209,7 @@ generate_udf_test("studentt_cdf", [
{
inputs: [
`CAST(1.0 AS FLOAT64)`,
`CAST(2 AS INT64)`
`CAST(2.0 AS FLOAT64)`
],
expected_output: `CAST(0.788675134594813 AS FLOAT64)`
},
Expand Down