Add quotes around printed domain values#16208
Add quotes around printed domain values#16208mbasmanova merged 1 commit intoprestodb:masterfrom lightseba:master
Conversation
There was a problem hiding this comment.
How about if if have field value as '<min>' or '<max>'? Please add a test for that.
ahmadghazal64
left a comment
There was a problem hiding this comment.
As we talked, please add tests for lower level API range and higher level PlanPrinter. For each, try both cases of x in ('a','b') and x in ('a,b')
|
@lightseba This change has a user-visible impact. Please, add release notes to the PR description. |
There was a problem hiding this comment.
the logic of adding quotes is repeated multiple times; consider adding a helper method that takes a buffer and a value to add and adds the value with quotes.
There was a problem hiding this comment.
move this variable to top of the class; consider adding line breaks for readability, e.g. before .setTimeZoneKey, .setLegacyTimestamp, etc.
The domain intervals can be ambiguous in cases like SELECT * FROM table WHERE col >= 'a' AND col <= 'b' vs. SELECT * FROM table WHERE col = 'a, b' which both have the domain interval [a, b]. This is fixed by adding quotes to the output (["a", "b"] vs. ["a, b"]) and escaping quotes which may appear in the string itself. Also made PlanPrinter.formatDomain() use the formatting code in Range.toString(), which is exactly the same.
The domain intervals can be ambiguous in cases like
SELECT * FROM table WHERE col >= 'a' AND col <= 'b'vs.
SELECT * FROM table WHERE col = 'a, b'which both have the domain interval
[a, b].This is fixed by adding quotes to the output (
["a", "b"]vs.["a, b"])and escaping quotes which may appear in the string itself.
Also made
PlanPrinter.formatDomain()use the formatting code inRange.toString(), which is exactly the same.Test plan
In addition to the unit tests added, I ran
This query should show quotes around the domain intervals.