Commit graph

196 commits

Author SHA1 Message Date
reesporte
eab6174388 make pql.Decimal.Value a private big.Int field
This ensures that we can't overflow when adding `pql.Decimal`s together. The
only place we can possibly overflow is when converting pql.Decimal to an Int64,
but that is a risk we have to take. Also, the only place we do this is in our
ToRowser. We could maybe change that to strings, so the presentation of data
doesn't indicate an overflow, but that is a later decision to make. It will
also involve fixing the generate-proto-grpc make command, because that's broken
rn.
2022-06-06 16:44:01 -05:00
reesporte
50787fd37a Add AddDecimal support to pql
This allows us to add two Decimals together as long
as the result doesn't overflow int64 either in value or in scale.
2022-06-06 16:44:01 -05:00
Matthew Jaffee
8e5ab106dc
FB-1459 ugly first cut at supportings Rows(in=[...]) (#2066)
* ugly first cut at supportings Rows(in=[...])

need tests, better handling of various combinations of arguments and
error cases

* explicitly error when other arguments passed with 'in' to Rows

* first cut at supporting Rows(in=[...])

'in' is explicitly not supported with any other arguments (except the
field of course), and will error. It works both as a standalone Rows
call and in GroupBy.

* bitmapfilter require ordered rowids

* remove log message

Co-authored-by: Todd Gruben <todd@molecula.com>
2022-05-25 11:57:59 -05:00
rachithrr
eba7927b56
FB-1387: Grafana Empty Variable Select (#2032)
Fixed the issue where deselecting variables didn't work on quries like
groupby and extract.
The empty variables list returns All() when the variables are empty.
2022-04-26 12:39:28 -05:00
Samir Patel
8da946fe9b allow empty values to be provided for vars in Row call
queries can become arbitrarily long when variables are used.
This is especially the case when a variable is defined as
'select distinct field from table'
and a user wants to use all the values in a Row call
(which is effectively disabling any condition on the field).

This change allows users to select no values for a variable
associated with a Row call to disable the condition. If that
variable is the only condition (query expands to nothing)
then it interprets it as an All call.
2022-03-24 10:45:30 -05:00
Seebs
6d93e41e7f catch the panic we throw for an invalid timestamp
We recover from some specific panics deeper in the PEG parser, but when
we added the invalid timestamp, we didn't add it to the list we catch
and handle gracefully. Add test case for this, and test case for
successful parsing. Also add the word "valid" to the error message so
people don't get as confused by it.
2022-02-22 16:20:09 -06:00
Ben Johnson
6d06f5550b Restrict max-memory to Extract() calls only 2022-02-11 14:19:56 -06:00
Samir Patel
39c9a062aa address feedback 2022-02-09 13:16:19 -06:00
Samir Patel
be68241d8e add test 2022-02-09 12:33:12 -06:00
Samir Patel
bfcbf9d784 change interfaceOrVariable type 2022-02-09 11:29:11 -06:00
Samir Patel
edc16a61ea remove comment 2022-02-08 16:08:04 -06:00
Samir Patel
9e8b968c19 Refactor ExpandVars to reduce complexity 2022-02-08 15:58:12 -06:00
Samir Patel
fbe23915cf support ConstRow expansion and cleanup 2022-02-08 13:39:22 -06:00
Samir Patel
9a52dd1a2c handle rows for the most part 2022-02-07 20:00:05 -06:00
Ben Johnson
4fb795d6cb Parse variables for _field 2022-02-07 15:40:24 -07:00
Samir Patel
f5d0b227fa messing with parser, Rows call
messing around trying to get Rows call to recognize
$ syntax. got Rows to not barf, but it is interpreting $ syntax
as string values for the _field parameter as opposed to a Variable
2022-02-07 16:21:35 -06:00
Samir Patel
a755006d95 match on variable name, not field name 2022-02-07 15:43:32 -06:00
Samir Patel
b3faaa9dc0 handle expanding of Row call
working for equality, but not for inequalityh ATM
2022-02-07 12:55:10 -06:00
Ben Johnson
3989b363ce Add variable support to PQL 2022-02-01 08:30:48 -07:00
Ben Johnson
9ebf0e2119 Upgrade go.mod to featurebase/v3 2022-01-21 10:57:05 -07:00
reesporte
48aef0c8a4 add copyright notice back in
```bash
for file in `cat diffys`; do
   printf '%s\n%s\n' "// Copyright 2021 Molecula Corp. All rights reserved." "$(cat $file)" >$file;
done
```
2021-12-10 11:01:04 -06:00
reesporte
4c53f86e82 removed license from each go file
i used this script, a little clunky but it got the job done

```bash
for file in `find . -type f -print | grep '\.go'`; do
    sed '1,/^\/\/ limitations under the License.$/d' $file > $file.tmp;
    result=`cat $file.tmp`
    if [[ result != "" ]]; then
        gofmt $file.tmp &> /dev/null;
        if [[ $? == 0 ]]; then
            mv $file.tmp $file && gofmt -w $file;
        else
            rm $file.tmp;
        fi
    else
        rm $file.tmp;
    fi
done
```
2021-12-10 09:17:17 -06:00
reesporte
63c5c11108 fix some staticcheck issues 2021-12-03 09:31:45 -06:00
Mahesh Arumugam
858f889745 FeatureBase Renaming: changing go.mod module name for featurebase 2021-07-19 09:20:30 -07:00
Mahesh Arumugam
357caf68c3 Fix percentile query: field is mandatory (should not crash), fieldnames can be unquoted 2021-06-24 15:10:05 -07:00
Nia Weiss
a72f6425af
add an option to open a postgres transaction in lookup so it isnt actually a lookup 2021-05-26 14:07:52 -04:00
Nia Weiss
f4ba34247f
remove attributes
Attributes are unmaintained and unused.
They have become more of a liability than a benefit.
This change eliminates them from the codebase.
The only user-visible change (assuming that attrs are not used) is that the attrs field will no longer appear in row JSON.
2021-05-14 10:28:08 -04:00
tgruben
a60c70b2a5
Merge branch 'master' into delete 2021-04-09 10:26:30 -05:00
Ben Johnson
d70eb737cb Fix timestamp field issues 2021-04-09 08:26:12 -06:00
Todd Gruben
918644820b added pql delete function 2021-04-07 13:57:43 -05:00
Ben Johnson
cfc725e799 Add timestamp field type support 2021-04-06 10:50:10 -06:00
Nia Weiss
e9b92e1cd4
add ExternalLookup query 2021-03-25 13:21:28 -04:00
Kuba Podgórski
d370452449 Add helper function FirstStringArg 2021-03-16 16:32:35 +01:00
Kuba Podgórski
1dac4c7622 Consistency with aggregate functions 2021-03-16 15:02:40 +01:00
Travis
883e687094
fix missing bracket 2021-03-02 22:14:07 -06:00
Travis
ea8b07d380
Merge branch 'master' into disco 2021-03-02 22:11:04 -06:00
nagamocha3000
30a7e0f0da
Add pql syntax for Percentile 2021-03-02 20:36:51 -06:00
Maxton Huff
15aa7d1ad8 add field to SetRowAttrs and TopK to prototypes in ast.go 2021-03-01 11:18:31 -06:00
Maxton Huff
23f44725cb remove var allowUnderField 2021-02-26 16:36:16 -06:00
Maxton Huff
3822e38952 remove z arg from Rows tests 2021-02-26 16:15:37 -06:00
Maxton Huff
441630d804 try fixing tests 2021-02-26 16:13:00 -06:00
Maxton Huff
8bc8368c57 change test arguments to be appropriate 2021-02-26 12:58:59 -06:00
Maxton Huff
d49a8f953e regenerate pql from modified peg file 2021-02-26 11:27:39 -06:00
Maxton Huff
ab41d0492c add more tests for TopK, Rows, and SetRowAttrs 2021-02-25 16:04:31 -06:00
Maxton Huff
6b75a8b500 Revert "allow 'field=' for TopN()"
This reverts commit db01237904.
2021-02-25 11:01:22 -06:00
Maxton Huff
db01237904 allow 'field=' for TopN() 2021-02-24 15:29:10 -06:00
Nia Weiss
ac09c11bad
Invoke precalls directly in count operations
This changes Count(Precall()) operations to execute the precall directly inside of the count operation, bypassing the transformation to a Precomputed() call.
Eliminating the Precomputed() step causes Count(Distinct()) to work properly on negative integers.
2021-01-26 12:44:03 -05:00
Nia Weiss
dde318ac8c
Move globally computed GroupBy rows calls into EmbeddedData
This fixes a bug where a globally computed Rows call would be computed with a subset of the shards.
2021-01-25 10:17:58 -05:00
Matt Jaffee
ea539d8241
simplify groupby sorting and fix bugs
Back out support for sorting on fields (only count and aggregate
supported for now).

Fix bug where default return of "true" caused sort to be unstable. (If
they are equal, Less should return false)

Fix bug where limit was being applied before sorting.

Fix bug where offset was not actually allowed to be an argument to
GroupBy (weird! guess we weren't testing that very well)

Apply "having" after calculating Count(Distinct) aggregate so that
having can apply to that.

Switch to stable sort to make testing easier.
2020-12-31 14:42:03 -06:00
Matt Jaffee
5fdae74812
draft of sorting groupby results 2020-12-31 14:41:52 -06:00