Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,8 @@ public static void regrIntercept(@AggregationState RegressionState state, BlockB
public static void regrSxy(@AggregationState RegressionState state, BlockBuilder out)
{
double result = getRegressionSxy(state);
if (Double.isFinite(result)) {
double count = getRegressionCount(state);
if (Double.isFinite(result) && Double.isFinite(count) && count > 0) {
Copy link
Contributor

Choose a reason for hiding this comment

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

If the count is not finite, should it throw?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If the count is not finite, the result should be null, which is consistent with the behavior of the regr_count function.

DOUBLE.writeDouble(out, result);
}
else {
Expand All @@ -97,7 +98,8 @@ public static void regrSxy(@AggregationState RegressionState state, BlockBuilder
public static void regrSxx(@AggregationState RegressionState state, BlockBuilder out)
{
double result = getRegressionSxx(state);
if (Double.isFinite(result)) {
double count = getRegressionCount(state);
if (Double.isFinite(result) && Double.isFinite(count) && count > 0) {
DOUBLE.writeDouble(out, result);
}
else {
Expand All @@ -110,7 +112,8 @@ public static void regrSxx(@AggregationState RegressionState state, BlockBuilder
public static void regrSyy(@AggregationState RegressionState state, BlockBuilder out)
{
double result = getRegressionSyy(state);
if (Double.isFinite(result)) {
double count = getRegressionCount(state);
if (Double.isFinite(result) && Double.isFinite(count) && count > 0) {
DOUBLE.writeDouble(out, result);
}
else {
Expand All @@ -136,7 +139,7 @@ public static void regrR2(@AggregationState RegressionState state, BlockBuilder
public static void regrCount(@AggregationState RegressionState state, BlockBuilder out)
{
double result = getRegressionCount(state);
if (Double.isFinite(result)) {
if (Double.isFinite(result) && result > 0) {
DOUBLE.writeDouble(out, result);
}
else {
Expand All @@ -149,7 +152,8 @@ public static void regrCount(@AggregationState RegressionState state, BlockBuild
public static void regrAvgy(@AggregationState RegressionState state, BlockBuilder out)
{
double result = getRegressionAvgy(state);
if (Double.isFinite(result)) {
double count = getRegressionCount(state);
if (Double.isFinite(result) && Double.isFinite(count) && count > 0) {
DOUBLE.writeDouble(out, result);
}
else {
Expand All @@ -162,7 +166,8 @@ public static void regrAvgy(@AggregationState RegressionState state, BlockBuilde
public static void regrAvgx(@AggregationState RegressionState state, BlockBuilder out)
{
double result = getRegressionAvgx(state);
if (Double.isFinite(result)) {
double count = getRegressionCount(state);
if (Double.isFinite(result) && Double.isFinite(count) && count > 0) {
DOUBLE.writeDouble(out, result);
}
else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,8 @@ public static void regrIntercept(@AggregationState RegressionState state, BlockB
public static void regrSxy(@AggregationState RegressionState state, BlockBuilder out)
{
double result = getRegressionSxy(state);
if (Double.isFinite(result)) {
double count = getRegressionCount(state);
if (Double.isFinite(result) && Double.isFinite(count) && count > 0) {
REAL.writeLong(out, floatToRawIntBits((float) result));
}
else {
Expand All @@ -97,7 +98,8 @@ public static void regrSxy(@AggregationState RegressionState state, BlockBuilder
public static void regrSxx(@AggregationState RegressionState state, BlockBuilder out)
{
double result = getRegressionSxx(state);
if (Double.isFinite(result)) {
double count = getRegressionCount(state);
if (Double.isFinite(result) && Double.isFinite(count) && count > 0) {
REAL.writeLong(out, floatToRawIntBits((float) result));
}
else {
Expand All @@ -110,7 +112,8 @@ public static void regrSxx(@AggregationState RegressionState state, BlockBuilder
public static void regrSyy(@AggregationState RegressionState state, BlockBuilder out)
{
double result = getRegressionSyy(state);
if (Double.isFinite(result)) {
double count = getRegressionCount(state);
if (Double.isFinite(result) && Double.isFinite(count) && count > 0) {
REAL.writeLong(out, floatToRawIntBits((float) result));
}
else {
Expand All @@ -136,7 +139,7 @@ public static void regrR2(@AggregationState RegressionState state, BlockBuilder
public static void regrCount(@AggregationState RegressionState state, BlockBuilder out)
{
double result = getRegressionCount(state);
if (Double.isFinite(result)) {
if (Double.isFinite(result) && result > 0) {
REAL.writeLong(out, floatToRawIntBits((float) result));
}
else {
Expand All @@ -149,7 +152,8 @@ public static void regrCount(@AggregationState RegressionState state, BlockBuild
public static void regrAvgy(@AggregationState RegressionState state, BlockBuilder out)
{
double result = getRegressionAvgy(state);
if (Double.isFinite(result)) {
double count = getRegressionCount(state);
if (Double.isFinite(result) && Double.isFinite(count) && count > 0) {
REAL.writeLong(out, floatToRawIntBits((float) result));
}
else {
Expand All @@ -162,7 +166,8 @@ public static void regrAvgy(@AggregationState RegressionState state, BlockBuilde
public static void regrAvgx(@AggregationState RegressionState state, BlockBuilder out)
{
double result = getRegressionAvgx(state);
if (Double.isFinite(result)) {
double count = getRegressionCount(state);
if (Double.isFinite(result) && Double.isFinite(count) && count > 0) {
REAL.writeLong(out, floatToRawIntBits((float) result));
}
else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ protected String getFunctionName()
public Object getExpectedValue(int start, int length)
{
if (length == 0) {
return 0.0;
return null;
}

double expected = 0.0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ protected String getFunctionName()
public Object getExpectedValue(int start, int length)
{
if (length == 0) {
return 0.0;
return null;
}

double expected = 0.0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,10 @@ protected String getFunctionName()
@Override
public Object getExpectedValue(int start, int length)
{
if (length <= 1) {
if (length == 0) {
return null;
}
else if (length == 1) {
return (double) length;
}
else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,10 @@ protected String getFunctionName()
@Override
public Object getExpectedValue(int start, int length)
{
if (length <= 1) {
if (length == 0) {
return null;
}
else if (length == 1) {
return (double) 0;
}
else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,10 @@ protected String getFunctionName()
@Override
public Object getExpectedValue(int start, int length)
{
if (length <= 1) {
if (length == 0) {
return null;
}
else if (length == 1) {
return (double) 0;
}
else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,10 @@ protected String getFunctionName()
@Override
public Object getExpectedValue(int start, int length)
{
if (length <= 1) {
if (length == 0) {
return null;
}
else if (length <= 1) {
return (double) 0;
}
else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ protected String getFunctionName()
public Object getExpectedValue(int start, int length)
{
if (length == 0) {
return 0.0f;
return null;
}

float expected = 0.0f;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ protected String getFunctionName()
public Object getExpectedValue(int start, int length)
{
if (length == 0) {
return 0.0f;
return null;
}

float expected = 0.0f;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,10 @@ protected String getFunctionName()
@Override
public Object getExpectedValue(int start, int length)
{
if (length <= 1) {
if (length == 0) {
return null;
}
else if (length == 1) {
return (float) length;
}
else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,10 @@ protected String getFunctionName()
@Override
public Object getExpectedValue(int start, int length)
{
if (length <= 1) {
if (length == 0) {
return null;
}
else if (length == 1) {
return (float) 0;
}
else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,10 @@ protected String getFunctionName()
@Override
public Object getExpectedValue(int start, int length)
{
if (length <= 1) {
if (length == 0) {
return null;
}
else if (length == 1) {
return (float) 0;
}
else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,10 @@ protected String getFunctionName()
@Override
public Object getExpectedValue(int start, int length)
{
if (length <= 1) {
if (length == 0) {
return null;
}
else if (length <= 1) {
return (float) 0;
}
else {
Expand Down