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

sql: propagate bytea_output to distsql processors #27951

Merged
merged 1 commit into from
Jul 26, 2018

Conversation

knz
Copy link
Contributor

@knz knz commented Jul 26, 2018

Fixes #27950.

It was not propagated previously, causing distributed queries to
improperly convert byte arrays to strings.

Release note (bug fix): the parameter bytea_output is now properly
effective for distributed queries.

@knz knz requested review from jordanlewis, rjnn and a team July 26, 2018 11:51
@cockroach-teamcity
Copy link
Member

This change is Reviewable

Copy link
Member

@BramGruneir BramGruneir left a comment

Choose a reason for hiding this comment

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

:lgtm:

Reviewed 6 of 6 files at r1.
Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (and 1 stale)


pkg/sql/distsqlrun/server.go, line 341 at r1 (raw file):

	}

	var be sessiondata.BytesEncodeFormat

You do this more than once. DRY it up?


pkg/sql/distsqlrun/server.go, line 360 at r1 (raw file):

		SearchPath:        sessiondata.MakeSearchPath(req.EvalContext.SearchPath),
		SequenceState:     sessiondata.NewSequenceState(),
		BytesEncodeFormat: be,

If you're alphabetizing location, why not move bytesencodeformat as well.


pkg/sql/logictest/testdata/logic_test/bytes, line 122 at r1 (raw file):

SELECT e'a\\01'::STRING::BYTEA

# Regression test for #27950.

make this a subtest and drop the table at the end of it

Copy link
Contributor Author

@knz knz left a comment

Choose a reason for hiding this comment

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

Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (and 1 stale)


pkg/sql/distsqlrun/server.go, line 341 at r1 (raw file):

Previously, BramGruneir (Bram Gruneir) wrote…

You do this more than once. DRY it up?

Nope, these are two different patterns (conversion in opposite directions).


pkg/sql/distsqlrun/server.go, line 360 at r1 (raw file):

Previously, BramGruneir (Bram Gruneir) wrote…

If you're alphabetizing location, why not move bytesencodeformat as well.

Nope, because the follow-up PR #27952 rewrites this part altogether.


pkg/sql/logictest/testdata/logic_test/bytes, line 122 at r1 (raw file):

Previously, BramGruneir (Bram Gruneir) wrote…

make this a subtest and drop the table at the end of it

Done.

optional BytesEncodeFormat bytes_encode_format = 10 [(gogoproto.nullable) = false];
}

// BytesEncodeFormat is the configurationf or bytes to string conversions.
Copy link
Member

Choose a reason for hiding this comment

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

typo

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good catch! Fixed.

It was not propagated previously, causing distributed queries to
improperly convert byte arrays to strings.

Release note (bug fix): the parameter `bytea_output` is now properly
effective for distributed queries.
@knz
Copy link
Contributor Author

knz commented Jul 26, 2018

bors r+

craig bot pushed a commit that referenced this pull request Jul 26, 2018
27951: sql: propagate bytea_output to distsql processors r=knz a=knz

Fixes  #27950.

It was not propagated previously, causing distributed queries to
improperly convert byte arrays to strings.

Release note (bug fix): the parameter `bytea_output` is now properly
effective for distributed queries.

Co-authored-by: Raphael 'kena' Poss <knz@cockroachlabs.com>
@craig
Copy link
Contributor

craig bot commented Jul 26, 2018

Build succeeded

@craig craig bot merged commit f21f3c6 into cockroachdb:master Jul 26, 2018
@knz knz deleted the 20180726-distsql-bug branch July 26, 2018 16:01
craig bot pushed a commit that referenced this pull request Jul 26, 2018
27952: sql: complete the implementation of extra_float_digits r=knz a=knz

First commit from #27951.

The code previously recognized the name of the session variable but
completely ignored the value that was specified. This would cause
silently invalid results to be processed in conversions from float to
string, and when float values are returned over pgwire.

This patch fixes the situation by making the setting work as intended
by clients.

Release note (sql change): The support for `extra_float_digits` is
extended for compatibility with PostgreSQL.

Co-authored-by: Raphael 'kena' Poss <knz@cockroachlabs.com>
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.

distsql: sessiondata fields are not properly initialized for processors
4 participants