-
Notifications
You must be signed in to change notification settings - Fork 25.6k
backwards compatible deserialization of SqlQueryResponse and fix SQL bwc tests #78467
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -6,26 +6,27 @@ | |
| */ | ||
| package org.elasticsearch.xpack.sql.action; | ||
|
|
||
| import java.io.IOException; | ||
| import java.time.ZonedDateTime; | ||
| import java.util.ArrayList; | ||
| import java.util.List; | ||
| import java.util.Objects; | ||
|
|
||
| import org.elasticsearch.Version; | ||
| import org.elasticsearch.action.ActionResponse; | ||
| import org.elasticsearch.core.Nullable; | ||
| import org.elasticsearch.common.Strings; | ||
| import org.elasticsearch.common.io.stream.StreamInput; | ||
| import org.elasticsearch.common.io.stream.StreamOutput; | ||
| import org.elasticsearch.common.xcontent.ToXContentObject; | ||
| import org.elasticsearch.common.xcontent.XContentBuilder; | ||
| import org.elasticsearch.core.Nullable; | ||
| import org.elasticsearch.xpack.ql.async.QlStatusResponse; | ||
| import org.elasticsearch.xpack.sql.proto.ColumnInfo; | ||
| import org.elasticsearch.xpack.sql.proto.Mode; | ||
| import org.elasticsearch.xpack.sql.proto.Protocol; | ||
| import org.elasticsearch.xpack.sql.proto.SqlVersion; | ||
| import org.elasticsearch.xpack.sql.proto.StringUtils; | ||
|
|
||
| import java.io.IOException; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. have these been reordered automatically by the editor?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yes. I think that follows the default imports layout. |
||
| import java.time.ZonedDateTime; | ||
| import java.util.ArrayList; | ||
| import java.util.List; | ||
| import java.util.Objects; | ||
|
|
||
| import static java.util.Collections.unmodifiableList; | ||
| import static org.elasticsearch.Version.CURRENT; | ||
| import static org.elasticsearch.xpack.sql.action.AbstractSqlQueryRequest.CURSOR; | ||
|
|
@@ -81,10 +82,16 @@ public SqlQueryResponse(StreamInput in) throws IOException { | |
| } | ||
| } | ||
| this.rows = unmodifiableList(rows); | ||
| columnar = in.readBoolean(); | ||
| asyncExecutionId = in.readOptionalString(); | ||
| isPartial = in.readBoolean(); | ||
| isRunning = in.readBoolean(); | ||
| if (in.getVersion().onOrAfter(Version.V_7_14_0)) { | ||
| columnar = in.readBoolean(); | ||
| asyncExecutionId = in.readOptionalString(); | ||
| isPartial = in.readBoolean(); | ||
| isRunning = in.readBoolean(); | ||
| } else { | ||
| asyncExecutionId = null; | ||
| isPartial = false; | ||
| isRunning = false; | ||
| } | ||
|
Comment on lines
+85
to
+94
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why this change and why is
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It hadn't been serialised before the given version: https://github.com/elastic/elasticsearch/pull/73991/files#diff-3c77d10764f4a72e650dfabe508e5d372bf024a776ca17b81c2f4666f859fe01R187 , which was probably an oversight.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The fact that we discovered this in a BWC test and not when the async search was introduced is troubling. At some point in future we will need a set of tests that should cover the serialization differences between bwc versions for both the request and response objects. I did something similar for EQL here: #68339. @Luegg please open an issue for improving the tests coverage in this area.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. My initial question still stands.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
True, but that's the version that added it to the serialisation.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks @bpintea, I was getting confused myself. |
||
| } | ||
|
|
||
| public SqlQueryResponse( | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.