featurebase/sql3/planner
seebs b7e9879526
forward-port tests from SQL1 tree (#2261)
This forward-ports a number of tests from the previous SQL
implementation. The porting is approximate in a number of ways,
and not all tests are implemented/tested yet.

In particular, several tests are currently disabled because
we don't support `limit n` constructs.

The tests that were primarily tests of the parser have been
brought forward as parser tests. One of them has been altered
to add parentheses, because our parser interprets
	fld1 between 1 and 3 and fld2 = 2
as:
	fld1 between (1 and 3) and (fld2 = 2)
which is invalid, while the old parser apparently interpreted it
as:
	(fld1 between 1 and 3) and (fld2 = 2)

We have not yet verified the SQL spec's requirements here, but
sqlite agrees with our old parser, not our new parser, so this
may be a regression.

The old tests expected an INNER JOIN to suppress duplicate
values. Our new code does not, which is consistent with other
SQL implementations. This is a change, but the old behavior
appears to have been wrong. (You can still suppress duplicate
values by specifying DISTINCT.)

In the previous implementations, a value like `count(*)` had
`count(*)` as its column name. In the new implementation,
it has an empty string as its column name.

Related to this, the prior implementation allowed you to
write
	select age, count(*) from grouper group by age having count > 1
but the new implementationt requires that to be spelled as
	having count(*) > 1

This is consistent with other SQL implementations, so I think
the new behavior is correct.

The behavior of SHOW COLUMNS and SHOW TABLES has changed, in
that the specific results returned are significantly different.
Perhaps more significantly, the old system spelled the former
query as SHOW FIELDS, rather than SHOW COLUMNS. This may be
considered a regression, in that `SHOW FIELDS` no longer works,
and we should consider whether any hypothetical users might
have been relying on the output of either of these. (I hope
not, the new output is much better.)

Some of the old tests (the ones in handler_test) were accommodated
by adding a couple of specific test cases to existing tests,
specifically:
	* handling timestamp values with `Z` rather than `+00:00`
	* a join with a WHERE clause referring to fields in both
	  source tables

We introduce a new "partial" comparison type, because there's
no way for a test of `SHOW TABLES` to contain a correct table
row, because `SHOW TABLES` includes timestamps from when tables
were created. I'm not sure this is the right way to do this.

We add corresponding changes to dax_test, because the DAX tree
tests against the SQL tests.

We change the returned types of field names and field types to
plain strings, ironically because DAX needs this -- the test code
in the DAX tree is getting them back as plain strings, rather
than as dax.FieldName and dax.BaseType.

The tests using `having` are commented out because they don't
seem to be working, a ticket has been filed for this.

Two of the tests that should return strings are instead returning
untranslated integer IDs, but only for DAX, not for the regular
SQL tests, and the `delete` test has been commented out for
DAX-specific errors. If we merge this, the next step is to
ticket those and address them separately.
2023-03-01 13:40:50 -06:00
..
types Aggregation Nation (fb-1955, fb-1887) (#2252) 2023-02-16 10:56:27 -06:00
compilealterdatabase.go A bug fix roundup (#2242) 2023-02-13 12:28:34 -06:00
compilealtertable.go make count(*) not depend on _id (#2258) 2023-02-17 08:46:25 -06:00
compilebulkinsert.go make count(*) not depend on _id (#2258) 2023-02-17 08:46:25 -06:00
compilecreatedatabase.go A bug fix roundup (#2242) 2023-02-13 12:28:34 -06:00
compilecreatetable.go make count(*) not depend on _id (#2258) 2023-02-17 08:46:25 -06:00
compilecreateview.go A bug fix roundup (#2242) 2023-02-13 12:28:34 -06:00
compiledelete.go A bug fix roundup (#2242) 2023-02-13 12:28:34 -06:00
compiledropdatabase.go A bug fix roundup (#2242) 2023-02-13 12:28:34 -06:00
compiledroptable.go A bug fix roundup (#2242) 2023-02-13 12:28:34 -06:00
compiledropview.go A bug fix roundup (#2242) 2023-02-13 12:28:34 -06:00
compileinsert.go make count(*) not depend on _id (#2258) 2023-02-17 08:46:25 -06:00
compileselect.go ORDER BY ....what now!? (fb-1954) (#2257) 2023-02-17 13:35:36 -06:00
compileshow.go make count(*) not depend on _id (#2258) 2023-02-17 08:46:25 -06:00
executionplanner.go SQL tests now that CodedErrors are across HTTP (#2284) 2023-03-01 13:51:14 -05:00
executionplannersystemtables.go set default epoch for timestamps in system tables 2023-02-15 14:34:51 -06:00
expression.go FB-1968 timestamp data type related fixes and enhancements (#2256) 2023-02-24 14:57:17 -05:00
expression_it_test.go Sync from private repo to commit 12d608c80d 2022-12-12 09:01:20 -08:00
expressionagg.go make count(*) not depend on _id (#2258) 2023-02-17 08:46:25 -06:00
expressionanalyzer.go ORDER BY ....what now!? (fb-1954) (#2257) 2023-02-17 13:35:36 -06:00
expressionanalyzercall.go FB-1968 timestamp data type related fixes and enhancements (#2256) 2023-02-24 14:57:17 -05:00
expressionpql.go make count(*) not depend on _id (#2258) 2023-02-17 08:46:25 -06:00
expressiontypes.go FB-1968 timestamp data type related fixes and enhancements (#2256) 2023-02-24 14:57:17 -05:00
inbuiltfunctionsdate.go FB-1968 timestamp data type related fixes and enhancements (#2256) 2023-02-24 14:57:17 -05:00
inbuiltfunctionsset.go cleaned up sync from private repo 2022-09-30 11:20:58 -07:00
inbuiltfunctionsstring.go FB-1862: Implement Str() scalar string function (#2215) 2023-02-14 15:58:36 -05:00
inbuiltfunctionstable.go ORDER BY ....what now!? (fb-1954) (#2257) 2023-02-17 13:35:36 -06:00
main_test.go added testify dependency 2022-09-30 11:31:37 -07:00
opalterdatabase.go CLI: make it more like psql (#2235) 2023-02-14 09:23:51 -06:00
opaltertable.go Sync from private repo to commit 12d608c80d 2022-12-12 09:01:20 -08:00
opalterview.go Get rid of *most* of the context.Background() references in sql3 package (#2238) 2023-02-10 13:40:46 -06:00
opbulkinsert.go FB-1968 timestamp data type related fixes and enhancements (#2256) 2023-02-24 14:57:17 -05:00
opcreatedatabase.go Support for setting individual DatabaseOptions (#2231) 2023-02-06 08:50:28 -06:00
opcreatetable.go make count(*) not depend on _id (#2258) 2023-02-17 08:46:25 -06:00
opcreateview.go Get rid of *most* of the context.Background() references in sql3 package (#2238) 2023-02-10 13:40:46 -06:00
opdistinct.go Sup 294 pre sort command (#2209) 2023-01-23 12:26:38 -06:00
opdropdatabase.go Support for setting individual DatabaseOptions (#2231) 2023-02-06 08:50:28 -06:00
opdroptable.go implemented DISTINCT (fb-1562) (#2388) 2023-01-10 23:28:00 +00:00
opdropview.go Get rid of *most* of the context.Background() references in sql3 package (#2238) 2023-02-10 13:40:46 -06:00
opfanout.go introduce performance counters and system table fanout, plus refactor metrics (#2363) 2023-01-19 21:35:02 +00:00
opfeaturebasecolumns.go forward-port tests from SQL1 tree (#2261) 2023-03-01 13:40:50 -06:00
opfeaturebasedatabases.go make count(*) not depend on _id (#2258) 2023-02-17 08:46:25 -06:00
opfeaturebasetables.go make count(*) not depend on _id (#2258) 2023-02-17 08:46:25 -06:00
opfilter.go implemented DISTINCT (fb-1562) (#2388) 2023-01-10 23:28:00 +00:00
opgroupby.go fix import paths and import cycles 2023-01-12 00:31:14 +00:00
ophaving.go fix import paths 2023-01-11 18:59:24 +00:00
opinsert.go FB-1968 timestamp data type related fixes and enhancements (#2256) 2023-02-24 14:57:17 -05:00
opnestedloops.go hand comma version of inner join (#2221) 2023-01-25 13:37:05 -06:00
opnulltable.go implemented DISTINCT (fb-1562) (#2388) 2023-01-10 23:28:00 +00:00
oporderby.go ORDER BY ....what now!? (fb-1954) (#2257) 2023-02-17 13:35:36 -06:00
oppqlaggregate.go make count(*) not depend on _id (#2258) 2023-02-17 08:46:25 -06:00
oppqldelete.go make count(*) not depend on _id (#2258) 2023-02-17 08:46:25 -06:00
oppqldistinctscan.go make count(*) not depend on _id (#2258) 2023-02-17 08:46:25 -06:00
oppqlfiltereddelete.go fix import paths 2023-01-11 18:59:24 +00:00
oppqlgroupby.go make count(*) not depend on _id (#2258) 2023-02-17 08:46:25 -06:00
oppqlmultiaggregate.go implemented DISTINCT (fb-1562) (#2388) 2023-01-10 23:28:00 +00:00
oppqlmultigroupby.go Aggregation Nation (fb-1955, fb-1887) (#2252) 2023-02-16 10:56:27 -06:00
oppqltablescan.go make count(*) not depend on _id (#2258) 2023-02-17 08:46:25 -06:00
oppqltruncate.go fix typo in file name 2023-02-15 14:34:51 -06:00
opprojection.go implemented DISTINCT (fb-1562) (#2388) 2023-01-10 23:28:00 +00:00
opquery.go implemented DISTINCT (fb-1562) (#2388) 2023-01-10 23:28:00 +00:00
oprelalias.go implemented DISTINCT (fb-1562) (#2388) 2023-01-10 23:28:00 +00:00
opsubquery.go fix import paths and import cycles 2023-01-12 00:31:14 +00:00
opsystemtable.go Aggregation Nation (fb-1955, fb-1887) (#2252) 2023-02-16 10:56:27 -06:00
optablevaluedfunction.go implemented DISTINCT (fb-1562) (#2388) 2023-01-10 23:28:00 +00:00
optop.go implemented DISTINCT (fb-1562) (#2388) 2023-01-10 23:28:00 +00:00
planoptimizer.go ORDER BY ....what now!? (fb-1954) (#2257) 2023-02-17 13:35:36 -06:00
planwalker.go Implement DELETE (fb 1557) (#2382) 2023-01-10 23:25:08 +00:00
systemobjects.go make count(*) not depend on _id (#2258) 2023-02-17 08:46:25 -06:00
wireprotocol.go introduce performance counters and system table fanout, plus refactor metrics (#2363) 2023-01-19 21:35:02 +00:00