Commit graph

209 commits

Author SHA1 Message Date
Seebs
cf97a0dcb8 overhaul: switch over to using QueryContext
We switch everything to use QueryContext/QueryRead/etc instead
of Qcx/Tx.

We drop the short_txkey subpackage (it's now handled by either
keys or querycontext).

We drop all the dbshard stuff, and all the tx/txfactory stuff.

We remove all the things that related to the old "Block" concept,
which was mostly used by the anti-entropy code, but had one
fragmentary usage left in the ImportRoaringOverwrite case of
ImportRoaring. That's replaced by using a rewriter that deletes
all bits (not just bits in specific columns) from an existing
thing, but writes in new bits. Actually we could probably do that
better with a custom "eradicate-rewriter" that doesn't try to
be clever, and just eliminates things.

This includes a number of minor bug fixes that were
exposed by getting the testing to work. For example:
* When checking whether an operation "requires write", we
  now consider a Delete a kind of a Write, because it is.
* Several tests were relying on the fact that writes through
  Qcx were being committed whether or not the Qcx was ever
  told to finish. With QueryContext, you actually have to
  reach a Commit() or the writes don't happen (except for
  special cases in Delete).
* Replaced a lot of panics with t.Fatalf in tests.

There's also some minor staticcheck fixes, like deleting the
unused "db" member of a boltdb transaction wrapper.
2023-01-11 12:57:56 -06:00
pokeeffe-molecula
0be0c42b66
non-sql aggregation, top, decimal and sundries (#2328)
* fixed a bunch of issues with non-pql aggregation; moved some decimal related functionality; made top actually top (for the non-pql case); experimental create function

* drive up test coverage
2022-12-03 20:39:57 -06:00
tgruben
2f1beaf119
Dataframe (#2241)
* Dataframe
2022-11-21 17:38:48 -06:00
Seebs
ab543adbe3 drop invalid UTF8 encoding from encoding tests
Testing unicode is great, but we appear to have had a couple
of cases where we were using strings that weren't valid UTF8.

Weirdly, other instances of these strings work -- I think because
they're in raw quotes (backticks) rather than strings. Anyway,
this is what SonarCloud fusses about.
2022-11-16 15:31:06 -06:00
tgruben
0aa5efcc51
staticcheck fixes (#2278) 2022-11-07 10:51:55 -06:00
pokeeffe-molecula
193ef7cba1
Test expression eval for tuple values in inserts (fb-1555) (#2270)
refactored comparison, equality and arithmetic expr eval for decimal data types and added a test to cover expression eval for inserts

fixed failing test
2022-11-01 20:46:34 -05:00
Seebs
c3b032d5cb drop ioutil
The ioutil package is deprecated, with all of its functions having
moved into os or io. Do the replacements so we stop having this
impending.
2022-09-23 16:56:27 -05:00
rachithrr
3e42fc7d9f
WIP: Sort extract columns by a field (#2193)
* FB-1251: Add ability to sort Extract queries by some field

There is a sort call which takes a row call and the field, and
based on the field type, the corresponding rows are read. both key and
value are stored in RowKV{}. The value is stored since its required to
merge data from shards. values are sorted in each shard and these sorted
listes are merged in the reduce.
sort-desc flag is sent to comparator to decide the sorting order. ok
flag is added to the compare function to track any error in the
sort.Slice anonymous function
Sorting over set field was removed, since there would be multiple values
for each ids and there would be no right sorting order there.
2022-08-19 13:29:17 -05:00
reesporte
89159134a4 recalculate shards for each call in query if it needs them
this way we don't have write/read calls in the same query that return false
results because they're using stale shards.
2022-07-27 10:25:52 -05:00
reesporte
51fb34e657 make Decimal proto definition backwards compatible 2022-06-17 14:58:30 -05:00
reesporte
0d91e2991d Revert "FB-1491: Revert pql.Decimal commit for the 4.8.5 release (#2117)"
This reverts commit acbcec54c8.
2022-06-17 14:58:30 -05:00
rachithrr
acbcec54c8
FB-1491: Revert pql.Decimal commit for the 4.8.5 release (#2117)
* Revert "make pql.Decimal.Value a private big.Int field"

This reverts commit eab6174388.

* Revert "pql.Decimal for DecimalVal in ValCount&GroupCount"

This reverts commit a0c9eec410.

* Revert "Add AddDecimal support to pql"

This reverts commit 50787fd37a.
2022-06-15 09:15:37 -07:00
seebs
42b4c05df2
Implement UnionRows as a BitmapFilter (#2116)
This is fairly experimental, but basically, we make a fragment-level
op which, given a []uint64, can produce a union of all those rows in
the fragment, with a single scan through the fragment and not needing
a ton of additional space to reify all the rows at once.

Now with the Repair calls happening in the Results assembly rather than
on the intermediate data.
2022-06-15 08:40:12 -07:00
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