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

More blocking functions #292

Merged
merged 5 commits into from
May 26, 2022

Conversation

navinrathore
Copy link
Contributor

@navinrathore
Copy link
Contributor Author

Tested findTrainingData, Train etc. with 1 field for integer, double.
separate commits for different type of blocking functions. They can be views commit wise.


public class TruncateDouble extends HashFunction implements UDF1<Double, Double> {
int numDecimalPlaces;
static final int[] POWERS_OF_10 = {1, 10, 100, 1000, 10000, 100000};
Copy link
Member

Choose a reason for hiding this comment

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

why use this? just say 10 exp the argument.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

RangeDbl value = new RangeBetween0And10Dbl();
assertEquals(0, value.call((double) 867));
value = new RangeBetween10And100Dbl();
assertEquals(0, value.call((double) 867));
Copy link
Member

Choose a reason for hiding this comment

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

saying 867d makes the code more readable..upto you if you feel that way.

Copy link
Contributor Author

@navinrathore navinrathore May 26, 2022

Choose a reason for hiding this comment

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

Updated


import org.junit.jupiter.api.Test;

import static org.junit.jupiter.api.Assertions.assertEquals;
Copy link
Member

Choose a reason for hiding this comment

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

tests for different classes should be in different junit classes. multiple asserts should not go into same unit test, as you dont know then which one broke. If you think it is too much to write junits for the derived classes, just test the main base class.

Copy link
Contributor Author

@navinrathore navinrathore May 26, 2022

Choose a reason for hiding this comment

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

Changes made

public class TestRangeInt {

@Test
public void testRangeForValueZero() {
Copy link
Member

Choose a reason for hiding this comment

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

same comment as earlier

Copy link
Contributor Author

@navinrathore navinrathore May 26, 2022

Choose a reason for hiding this comment

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

Changes Made

@sonalgoyal sonalgoyal merged commit 9204493 into zinggAI:main May 26, 2022
@navinrathore navinrathore deleted the MoreBlockingFunctions261 branch June 1, 2022 04:21
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