featurebase/sql3/planner
Seebs 7cf2c5b07e handle integers as comparisons for decimal fields
It's reasonable to allow "where x > 13" on decimal
fields. Handle at least int64 and float64.

Once this is up, we find that aggregates can return
non-values, such as nil, in some cases; for instance,
`percentile(x) where x > 13` can yield a nil if x is
never greater than 13, rather than making up a value
from zero data points. So we accept nil as a valid
result type in PQL aggregates.

As a result of this, change two tests which were
unintentionally testing for an arcane edge case bug
in which (1) we can't render a condition to PQL,
such as because you specified an integer for a decimal
field, and (2) the filter is using an aliased name,
in which we would end up failing to generate a PQL
filter, but *also* losing the SQL-layer filter, and
produce wrong results as though there were no filter.

We also alter the tests to use `o.price > 9`, because
this lets us generate three user names, but only two
distinct user names, so the test using DISTINCT returns
a different value than the test not using DISTINCT,
which helps us verify that it's actually working and
not just lucky.

As part of fixing that, there was an intermediate
state where we rejected as an error any case where
generating the PQL filter failed. This broke 21 more
test cases, but in all of those cases, the SQL filter
was actually working.

... But in two of them, we SHOULD have been able to
generate PQL, because they were testing bools for
null, which works fine. We just had a list of
field types we allowed null tests against and
omitted bool because I forgot that bool isn't always
just treated as a kind of mutex.
2023-04-07 15:52:26 -05:00
..
types Test Row Append (#2323) 2023-03-15 13:13:44 -05: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
compilecopy.go create model, create function... all the goodies (#2264) 2023-04-04 17:44:29 -05:00
compilecreatedatabase.go CLOUD-1456: SERVERLESS - CREATE DATABASE (#2375) 2023-04-07 12:44:45 -05:00
compilecreatefunction.go create model, create function... all the goodies (#2264) 2023-04-04 17:44:29 -05:00
compilecreatemodel.go create model, create function... all the goodies (#2264) 2023-04-04 17:44:29 -05:00
compilecreatetable.go Improve test coverage for ast components in ast.go (#2355) 2023-03-31 14:27:18 -04: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
compiledropmodel.go create model, create function... all the goodies (#2264) 2023-04-04 17:44:29 -05: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
compilepredict.go create model, create function... all the goodies (#2264) 2023-04-04 17:44:29 -05:00
compileselect.go implemented query hints (flatten) (fb-2124) (#2373) 2023-04-06 17:28:24 -05:00
compileshow.go tidy up show tables behavior (#2374) 2023-04-07 12:58:09 -05:00
executionplanner.go create model, create function... all the goodies (#2264) 2023-04-04 17:44:29 -05:00
executionplannersystemtables.go tidy up show tables behavior (#2374) 2023-04-07 12:58:09 -05:00
expression.go fix regex generation (#2377) 2023-04-07 14:10:16 -05:00
expression_it_test.go create model, create function... all the goodies (#2264) 2023-04-04 17:44:29 -05:00
expression_test.go SQL3 Test Coverage: complete coerceValue coverage (#2343) 2023-03-24 13:33:05 -05:00
expressionagg.go create model, create function... all the goodies (#2264) 2023-04-04 17:44:29 -05:00
expressionanalyzer.go Add test coverage to expressionanalyzer.go (#2370) 2023-04-06 09:55:09 -05:00
expressionanalyzercall.go create model, create function... all the goodies (#2264) 2023-04-04 17:44:29 -05:00
expressionpql.go handle integers as comparisons for decimal fields 2023-04-07 15:52:26 -05:00
expressiontypes.go implement select from time quantum columns (fb-1654) (#2282) 2023-03-02 00:06:58 -06:00
inbuiltfunctionsdate.go Added date_trunc time/date scalar function (#2312) 2023-03-10 14:49:47 -06:00
inbuiltfunctionsquantum.go implement select from time quantum columns (fb-1654) (#2282) 2023-03-02 00:06:58 -06:00
inbuiltfunctionsset.go handle null results gracefully in SetContains{Any,All} 2023-03-24 16:01:09 -05:00
inbuiltfunctionsstring.go linter: prealloc (#2315) 2023-03-11 21:19:05 -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 don't panic on failed table creation 2023-04-03 16:29:21 -05: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 create model, create function... all the goodies (#2264) 2023-04-04 17:44:29 -05:00
opcopy.go create model, create function... all the goodies (#2264) 2023-04-04 17:44:29 -05:00
opcreatedatabase.go Support for setting individual DatabaseOptions (#2231) 2023-02-06 08:50:28 -06:00
opcreatefunction.go create model, create function... all the goodies (#2264) 2023-04-04 17:44:29 -05:00
opcreatemodel.go create model, create function... all the goodies (#2264) 2023-04-04 17:44:29 -05:00
opcreatetable.go don't panic on failed table creation 2023-04-03 16:29:21 -05:00
opcreateview.go fb-2036 improve coverage for create view statement (#2333) 2023-03-21 14:06:38 -04: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
opdropmodel.go create model, create function... all the goodies (#2264) 2023-04-04 17:44:29 -05: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 tidy up show tables behavior (#2374) 2023-04-07 12:58:09 -05: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 SQL3 Test Coverage: complete coerceValue coverage (#2343) 2023-03-24 13:33:05 -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 handle integers as comparisons for decimal fields 2023-04-07 15:52:26 -05:00
oppqldelete.go make count(*) not depend on _id (#2258) 2023-02-17 08:46:25 -06:00
oppqldistinctscan.go implemented query hints (flatten) (fb-2124) (#2373) 2023-04-06 17:28:24 -05:00
oppqlfiltereddelete.go fix import paths 2023-01-11 18:59:24 +00:00
oppqlgroupby.go implemented query hints (flatten) (fb-2124) (#2373) 2023-04-06 17:28:24 -05: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 implemented query hints (flatten) (fb-2124) (#2373) 2023-04-06 17:28:24 -05:00
oppqltruncate.go fix typo in file name 2023-02-15 14:34:51 -06:00
oppredict.go create model, create function... all the goodies (#2264) 2023-04-04 17:44:29 -05:00
opprojection.go implemented DISTINCT (fb-1562) (#2388) 2023-01-10 23:28:00 +00:00
opquery.go Linters! (#2314) 2023-03-10 15:13:15 -06:00
oprelalias.go implement select from time quantum columns (fb-1654) (#2282) 2023-03-02 00:06:58 -06:00
opsubquery.go fix import paths and import cycles 2023-01-12 00:31:14 +00:00
opsystemtable.go create model, create function... all the goodies (#2264) 2023-04-04 17:44:29 -05:00
optablevaluedfunction.go implement select from time quantum columns (fb-1654) (#2282) 2023-03-02 00:06:58 -06:00
optop.go implemented DISTINCT (fb-1562) (#2388) 2023-01-10 23:28:00 +00:00
planoptimizer.go handle integers as comparisons for decimal fields 2023-04-07 15:52:26 -05:00
planwalker.go Enable linter: stylecheck (#2317) 2023-03-14 08:45:18 -05:00
systemobjects.go create model, create function... all the goodies (#2264) 2023-04-04 17:44:29 -05:00
userdefinedfunctions.go create model, create function... all the goodies (#2264) 2023-04-04 17:44:29 -05:00
wireprotocol.go renamed 2 system tables (#2310) 2023-03-15 17:43:11 -05:00
wireprotocol_test.go SQL3 tests newMessageError and all the constructors (#2320) 2023-03-15 12:41:35 -05:00