Skip to content

Remove test skip after backport #70890

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

Merged
merged 1 commit into from
Mar 26, 2021
Merged
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 @@ -8,6 +8,7 @@
package org.elasticsearch.xpack.sql.qa.mixed_node;

import org.apache.http.HttpHost;
import org.apache.lucene.document.HalfFloatPoint;
import org.elasticsearch.Version;
import org.elasticsearch.client.Request;
import org.elasticsearch.client.Response;
Expand Down Expand Up @@ -94,7 +95,7 @@ public void testAllTypesWithRequestToOldNodes() throws Exception {
columns -> {
columns.add(columnInfo("geo_point_field", "geo_point"));
columns.add(columnInfo("float_field", "float"));
// Until #70653 is backported we won't assert that the half_float is returned with any kind of precision
columns.add(columnInfo("half_float_field", "half_float"));
},
(builder, fieldValues) -> {
Float randomFloat = randomFloat();
Expand All @@ -113,9 +114,18 @@ public void testAllTypesWithRequestToOldNodes() throws Exception {
builder.append("\"geo_point_field\":{\"lat\":\"37.386483\", \"lon\":\"-122.083843\"},");
fieldValues.put("geo_point_field", "POINT (-122.083843 37.386483)");
builder.append("\"float_field\":" + randomFloat + ",");
/*
* Double.valueOf(float.toString) gets a `double` representing
* the `float` that we'd get by going through json which is
* base 10. just casting the `float` to a `double` will get
* a lower number with a lot more trailing digits because
* the cast adds *binary* 0s to the end. And those binary
* 0s don't translate the same as json's decimal 0s.
*/
fieldValues.put("float_field", Double.valueOf(Float.valueOf(randomFloat).toString()));
builder.append("\"half_float_field\":\"123.456\"");
// Until #70653 is backported we won't assert that the half_float is returned with any kind of precision
float roundedHalfFloat = HalfFloatPoint.sortableShortToHalfFloat(HalfFloatPoint.halfFloatToSortableShort(randomFloat));
builder.append("\"half_float_field\":\"" + randomFloat + "\"");
fieldValues.put("half_float_field", Double.valueOf(Float.toString(roundedHalfFloat)));
}
}
);
Expand All @@ -127,7 +137,7 @@ public void testAllTypesWithRequestToUpgradedNodes() throws Exception {
columns -> {
columns.add(columnInfo("geo_point_field", "geo_point"));
columns.add(columnInfo("float_field", "float"));
// Until #70653 is backported we won't assert that the half_float is returned with any kind of precision
columns.add(columnInfo("half_float_field", "half_float"));
},
(builder, fieldValues) -> {
Float randomFloat = randomFloat();
Expand All @@ -143,9 +153,18 @@ public void testAllTypesWithRequestToUpgradedNodes() throws Exception {
builder.append("\"geo_point_field\":{\"lat\":\"37.386483\", \"lon\":\"-122.083843\"},");
fieldValues.put("geo_point_field", "POINT (-122.083843 37.386483)");
builder.append("\"float_field\":" + randomFloat + ",");
/*
* Double.valueOf(float.toString) gets a `double` representing
* the `float` that we'd get by going through json which is
* base 10. just casting the `float` to a `double` will get
* a lower number with a lot more trailing digits because
* the cast adds *binary* 0s to the end. And those binary
* 0s don't translate the same as json's decimal 0s.
*/
fieldValues.put("float_field", Double.valueOf(Float.valueOf(randomFloat).toString()));
builder.append("\"half_float_field\":\"123.456\"");
// Until #70653 is backported we won't assert that the half_float is returned with any kind of precision
float roundedHalfFloat = HalfFloatPoint.sortableShortToHalfFloat(HalfFloatPoint.halfFloatToSortableShort(randomFloat));
builder.append("\"half_float_field\":\"" + randomFloat + "\"");
fieldValues.put("half_float_field", Double.valueOf(Float.toString(roundedHalfFloat)));
}
}
);
Expand Down