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

Clipping functions #49

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

lakshmanok
Copy link
Contributor

Avoids the need to repeat complex expressions as in:

IF( some_complex_expr < 1, some_complex_expr, 1 )

Avoids the need to repeat complex expressions as in:
 
```IF( some_complex_expr < 1, some_complex_expr, 1 )```
Comment on lines +17 to +27
CREATE OR REPLACE FUNCTION fn.clip_less(x FLOAT64, a FLOAT64) AS (
IF (x < a, a, x)
);

CREATE OR REPLACE FUNCTION fn.clip_gt(x FLOAT64, b FLOAT64) AS (
IF (x > b, b, x)
);

CREATE OR REPLACE FUNCTION fn.clip(x FLOAT64, a FLOAT64, b FLOAT64) AS (
fn.clip_gt(fn.clip_less(x, a), b)
);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please split these out into their own files: clip_less.sql, clip_gt.sql, clip.sql

@danieldeleo
Copy link
Collaborator

Please complete remaining steps (step 2 and step 3) from CONTRIBUTING guide

Copy link
Collaborator

@danieldeleo danieldeleo left a comment

Choose a reason for hiding this comment

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

Please address comments

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