Skip to content

Adds support for parsing queries with boolean value comparisons#2432

Merged
sougou merged 1 commit intovitessio:masterfrom
HubSpot:parse_equal_true
Jan 4, 2017
Merged

Adds support for parsing queries with boolean value comparisons#2432
sougou merged 1 commit intovitessio:masterfrom
HubSpot:parse_equal_true

Conversation

@bbeaudreault
Copy link
Copy Markdown
Contributor

true and false are treated as numbers in MySQL so, the usual comparators (such as foo = true) are valid SQL. Admittedly, greater than, less than, etc make less sense than equal and not equal, but I added them for completeness because they too are valid syntax.

Added tests for all comparators and values

@sougou
Copy link
Copy Markdown
Contributor

sougou commented Jan 4, 2017

I think this change will cause yacc conflicts. Can you verify?

@bbeaudreault
Copy link
Copy Markdown
Contributor Author

bbeaudreault commented Jan 4, 2017

@sougou I broke out the boolean_value part specifically to fix a resulting yacc conflict from earlier iterations. Here's the output of my yacc command against the above code:

(vitess)➜  vitess git:(parse_equal_true) ✗ go tool yacc -o ./go/vt/sqlparser/sql.go ./go/vt/sqlparser/sql.y
(vitess)➜  vitess git:(parse_equal_true) ✗ make build
Tue Jan 3 19:52:37 EST 2017: Building source tree
(vitess)➜  vitess git:(parse_equal_true) ✗ go test ./go/sqltypes
ok  	github.com/youtube/vitess/go/sqltypes	0.029s

I'm new to yacc, so if there's another way I should be testing please let me know and I'd be more than happy to.

@sougou
Copy link
Copy Markdown
Contributor

sougou commented Jan 4, 2017

LGTM

Cool! I missed that part.

Approved with PullApprove

@sougou sougou merged commit 294622d into vitessio:master Jan 4, 2017
@bbeaudreault bbeaudreault deleted the parse_equal_true branch January 4, 2017 01:01
dispalt added a commit to dispalt/vitess that referenced this pull request Jan 9, 2017
* 'master' of https://github.com/youtube/vitess: (220 commits)
  vtgate/vindexes: Do not run testfiles.Locate() from init() (2nd time).
  Add comment to document when new fields are included in response
  publish site Fri Jan  6 08:02:30 PST 2017
  Updating doc.
  Optionally send additional C API fields through in responses
  Fixing explorer to handle empty files.
  MultiRow Insert Optimization (vitessio#2422)
  Now the local examples use 'zk2' topology.
  Adding Consul 0.7.2 to base docker image.
  etcd2topo: using lease ID in lock filenames.
  Implementing the Consul topology client.
  test: vtgate_buffer.py: Add second test for vtctl TabletExternallyReparented.
  test: vtgate_buffer.py: Stop the the two threads in case of a test error.
  test: vtgate_buffer.py: Move setup code from setUp to setUpModule.
  test: Add "demote_master_commands" to MysqlFlavor class.
  Include on clauses in impossible queries, to avoid only_full_group_by in aggregations with joins (vitessio#2433)
  Adds support for parsing queries with boolean value comparisons, i.e. true/false and =, !=, >, <, >=, <= (vitessio#2432)
  V3 Engine Code Refactor (vitessio#2423)
  Refactor impossible query generation, and support group by - (vitessio#2409)
  docker/test/run: Avoid using non-universal --tmpdir flag on mktemp (vitessio#2429)
  ...
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.

3 participants