Commit graph

77 commits

Author SHA1 Message Date
Pat Okeeffe
7386f13159
implement left join (fb-1888) (#2420)
* implement left join

* fixed failing test
2023-01-19 10:05:34 -06:00
pokeeffe-molecula
b6e642338a
make the count....count (#2416) 2023-01-18 10:35:14 -06:00
HHans09
2fccb87dcf
Fb 1876 : Implement Replicate() func (#2410)
* fb-1876 : creating Replicate fun

* fb-1876: creating string replicate func

* Fb-1876: String Replicate func

* Fb-1876: String Replicate func
2023-01-17 16:58:55 -05:00
Travis Turner
d971cfc269
Database isolation: Balancer (#2407)
* Database isolation: Balancer

Remove naive Balancer

remove debugging lines

Thread dax.Transaction through Controller

Change role to roleType

Swap out Balancer interface with new one

Standardize InvalidTransaction error

Add some interface comments

* Remove type.Worker; replace with type.Address

* Remove database validate from Queryer

This is already being handled in the `CreateTable()` method. Prior
to doing that validation, we were getting a panic, but that's no longer
the case.

* Remove dax.TableQualifier; replace with dax.QualifiedDatabaseID

* Update IDK test to create database
2023-01-17 11:57:58 -06:00
pokeeffe-molecula
c620aae350
implement CREATE/ALTER/DROP VIEW (fb-1592) (#2408)
* implement CREATE/ALTER/DROP VIEW

* fixed failing test

* another failing test

* fixed some broken serverless tests
2023-01-13 18:57:31 -06:00
rachithrr
f99be656df
FB-1827: Implement Len() (#2406) 2023-01-12 18:01:06 -05:00
pokeeffe-molecula
7f6ea0e6e5
introduce performance counters and system table fanout, plus refactor metrics (#2363)
* performance counters

* first cut of perf counters and system table fanout and a wire protocol
* significantly refactored prometheus support; removed statsd and exprvar

* removed node_id

* put dax subquery test back

* Change Translator.TranslateFieldIDs method to take a dax.TableKeyer

There are a bunch of other calls to the Translator interface methods
with currently take an `index string`, and those need to be converted to
dax.TableKeyer as well. But I need to review each call, because in at
least one place I noticed one being called with `result.Index` instead
of with the qtbl available. And I don't yet know how those could be
different.

Co-authored-by: Travis Turner <travis@molecula.com>
2023-01-11 20:37:00 -06:00
pokeeffe-molecula
af475a27f2
fix sum aggregate (fb-1874) (#2404)
* handle sum aggregates with ints; handle escaped quotes in blob literals

* added test ceoverage

* skip subquery test for dax
2023-01-11 15:46:41 -06:00
rachithrr
f590227471
FB-1814: Implement ASCII() (#2378)
* FB-1814: Implement ASCII()
2023-01-11 12:32:27 -05:00
pokeeffe-molecula
4750c2215f
include space_used column in show table output (#2401) 2023-01-10 11:03:57 -06:00
Lory Cloutier
da74f0a312
Implement SPACE() function for SQL3 (#2399)
FB-1861
2023-01-09 12:20:04 -06:00
pokeeffe-molecula
18fe6a35f6
handle insert into timequantum fields with default 'now' time (fb-1868) (#2398)
* handle insert into timequantum fields with default 'now' time

* allocate on the stack
2023-01-06 16:58:37 -06:00
pokeeffe-molecula
164aac509e
added space_used columns (#2397)
added space_used columns to show tables and fb_cluster_nodes
2023-01-06 11:43:17 -06:00
pokeeffe-molecula
9f042216a7
Bug fix round up (fb-1841, fb-1819, fb-1867) (#2396)
* check root operator after optimize

* round of bug fixes
2023-01-05 20:13:26 -06:00
tgruben
e8505d8a53
[FB-1831] distribute bulk insert to owning node (#2391)
* distribute bulk insert to owning node
2023-01-04 14:26:08 -06:00
pokeeffe-molecula
f030d58d95
implemented DISTINCT (fb-1562) (#2388)
* implemented distinct

* implemented distinct
* uses first cut of a buffer pool, and extendible hashing with thresholded spill to disk
* tests
* cleaned up some stuff around query plan output to make developing tooling easier
* added optimization to call PQL Distinct()

* fixed test

* fix for passing wrong index name in orchestrator

* back out change to DistinctTimestamp

* fix other instance of wrong table name being passed

* use full index name instead of abbreviated one for translation. sigh.

* removed some unused code

Co-authored-by: Matthew Jaffee <jaffee@pilosa.com>
2023-01-03 22:13:31 -06:00
pokeeffe-molecula
9dda3ff215
Consistency in error handling (fb-1799) (#2383)
* return 200 once plan compilation starts; if error, return error in response.

* removed some commented out code that is definitely not needed.
2022-12-20 09:32:19 -06:00
pokeeffe-molecula
021219935f
Implement DELETE (fb 1557) (#2382)
* delete implementation with test coverage

* optimize IN expressions; stop linter complaining

* fixed some uncovered query cases

* skip test in DAX for now
2022-12-19 16:34:28 -06:00
Bruce Baranowski
d19f3e81da
Fb 1818 Implement PREFIX() and SUFFIX() (#2371)
* Implement Prefix and Suffix
* Update substring out-of-index handling
2022-12-19 16:31:27 -05:00
rachithrr
27963441ab
FB-1815: Implement CHAR() (#2369) 2022-12-15 22:04:51 +05:30
Travis Turner
4e8fe488de
Fix PQL distinct in dax (#2360)
* Fix PQL distinct in dax

When issuing a PQL Distinct() call (or any other call with a "index=" arg),
this commit will attempt to convert the value in the index arg with a
TableKeyer.

* Apply change to call.Children as well

* Add some PQL Distinct (join) test coverage
2022-12-15 07:59:20 -06:00
pokeeffe-molecula
15d2ee8b07
add allow_missing_values option to bulk insert (fb-1823) (#2372)
* add allow_missing_values option to bulk insert

* test coverage

* review feedback
2022-12-14 18:32:27 -06:00
pokeeffe-molecula
843312dfc9
handling missing epoch constraint correctly (#2366) 2022-12-14 17:53:17 -06:00
pokeeffe-molecula
3528ec8fc0
enable handling string representations of integers (#2367) 2022-12-14 16:58:18 -06:00
pokeeffe-molecula
c88d60c9ab
SHOW CREATE TABLE issues (fb-1810) (#2365)
* fixed ddl issues with cache type/size; removed shardwidth option; improved error message
2022-12-14 16:27:55 -06:00
rachithrr
a4f18fb25f
FB-1812: implement stringsplit() (#2362) 2022-12-15 01:11:29 +05:30
HHans09
c1dbc48fb2
fb-1809: SQL3 RTrim & LTrim func for strings (#2361) 2022-12-14 13:21:45 -05:00
pokeeffe-molecula
9759602f94
added updated_at column to show tables output (#2364) 2022-12-14 10:15:42 -06:00
pokeeffe-molecula
eca3168d63
implement having; create view experiment (#2357) 2022-12-13 17:43:37 -06:00
Bruce Baranowski
4773aabc4e
FB-1719: implement SQL3 lower() (#2358)
* Implemented SQL3 LOWER()
2022-12-13 14:59:05 -05:00
pokeeffe-molecula
2146f407c3
fixed csv bugs (#2355) 2022-12-12 17:14:10 -06:00
HHans09
ac3ffac8e6
fb-1802 : Trim functionality (#2353)
* fb-1802 : Trim functionality

rebase

* fb-1802 : trim - updated as per review
2022-12-12 15:43:14 -05:00
Travis Turner
63cfdb5078
Thread Owner, UpdatedAt, UpdatedBy through SchemaAPI (#2351)
* Fix "qualifer" misspellings

* Remove `track_existence` and `shard_width` from SHOW TABLES output

* Thread Owner, UpdatedAt, UpdatedBy through SchemaAPI

I took the liberty of renaming "LastUpdatedUser" to "UpdateBy" to align
with "UpdatedAt".
2022-12-12 12:36:37 -06:00
rachithrr
9548e71f46
FB-1805: implement REPLACEALL() (#2349) 2022-12-12 22:42:53 +05:30
Travis Turner
a61d1a9571
Introduce TableKeyer interface; use in Execute() calls as "index" (#2350)
This commit introduces an interface called `TableKeyer` which anything that means to represent a "table"
can implement. Examples are `dax.QualifiedTable`, `dax.Table`, and `string` (for legacy pilosa calls
where Execute simply took `index string`).

In the case of `orchestrator.Execute()` and `qualifiedOrchestrator.Execute()`, we are intentionally strict
about which type of `TableKeyer` the respective method accepts. If we find, in the future, this is too
restrictive, we can loosen that; but for now it helps us understand what is expected.
2022-12-11 11:45:10 -06:00
Travis Turner
12d608c80d
Move batch.Importer interface to pilosa.Importer (#2347)
* Move batch.Importer interface to pilosa.Importer

In addition to moving the interface, it updates all the methods to use
dax.TableID (for example) intead of a string pilosa index name.

* Change unused onPremImporter methods to no-op.

onPremImporter is a wrapper around API which implements the Importer
interface. This is currently only used by sql3 running locally in standard
(i.e not "serverless") mode. Because sql3 always sets
`useShardTransactionalEndpoint = true`, There are several methods which this
implemtation of the Importer interface does not use, and therefore they
intentionally no-op.
2022-12-09 14:24:47 -06:00
HHans09
57ce7c4c0e
Fb:1787 - Clean up (#2339)
* Fb:1787 - Clean up

* fb-1787 : String upper function

* Formatting the files
2022-12-09 14:19:17 -05:00
Travis Turner
734477aaee
Add Table.Description, Table.CreatedAt, Field.CreatedAt support to SchemaAPI (#2340)
* Thread Table.Description through SchemaAPI

* Thread Table.CreatedAt through SchemaAPI

* Thread Field.CreatedAt through SchemaAPI
2022-12-08 22:50:41 -06:00
rachithrr
aa2a62fda0
FB-1800: Implement SUBSTRING() (#2343)
substring(string, startIndex,length).
2022-12-09 05:20:15 +05:30
pokeeffe-molecula
728b1dc9f5
handle int-->bool map type conversions; handle single value-->(id|string)set map type conversions (#2342) 2022-12-08 15:41:11 -06:00
Travis Turner
a15783cb49
Convert SchemaAPI interface to use dax.Table instead of pilosa.IndexInfo (#2336)
* WIP: Convert SchemaAPI to be DAX-centric

* Tables(), CreateField()

* CreateTable(), DeleteTable(), DeleteField()

* More cleanup

* Remove the old SchemaAPI
2022-12-08 11:35:17 -06:00
rachithrr
d33bf4811f
FB-1795: Implement REVERSE() scalar string function (#2335) 2022-12-08 04:01:30 +05:30
pokeeffe-molecula
e599f12ee4
you should be able to cast an id as a string (#2334) 2022-12-07 14:27:01 -06:00
rachithrr
ad350c2d49
FB-1739: Add ability to add a description to a table on creation (#2332)
* FB-1739: Add ability to add a description to a table on creation

- Added CommentOption to handle text after COMMENT option.
- added description field in the createtable plan.
- The description is stored in the existing index metadata.
2022-12-07 21:05:54 +05:30
Travis Turner
969bf055b2
Rename some interfaces. Remove the ComputeAPI (#2333)
* Clean up dax service interfaces

Rename some of the `computer` interfaces and organize them in the
appropriate files.
Remove `dax/computer/alpha` package

* Remove ComputeAPI (it was replaced by batch.Importer)

* add nss-tools dependecy to smoke test
2022-12-07 09:02:39 -06:00
pokeeffe-molecula
d2eba5bd8d
handle decimal without scale correctly; handle bulk insert dupe columns correctly; handle decimal->string & float->string type conversions in bulk insert (#2331) 2022-12-06 13:32:49 -06:00
pokeeffe-molecula
e392ce3460
enforce int min/max constraints on insert (fb-1772) (#2325)
* moved the debug code to the right spot

* enforce int min/max constraints on inserts

* add a check for decimal min and max

* fixed borked tests

* fix the decimal to int conversion in constraint check

Co-authored-by: Travis Turner <travis@molecula.com>
2022-12-05 22:51:42 -06:00
pokeeffe-molecula
f62313762c
implemented extract ddl; tightened up type related stuff (#2329)
* implemented extract ddl; tightened up type related stuff

* added some test coverage

* review feedback
2022-12-05 16:50:30 -06:00
Travis Turner
2843f218bc
Introduce ServiceManager and Refactor DAX Integration tests (#2320)
* Introduce ServiceManager and Refactor DAX Integration tests

The ServiceManager provides an interface with which to manage
featurebase (dax) services (mds, queryer, computer). It replaces the
confusing interface implementations in /dax/server/server.go (which
optionally used pointers to in-process objects to satisfy an interface)
with (for now) http implementations. The thought is that even if we're
running all services in-process, we should communicate between services
over http in order to mirror what we would do in a production
environment where the services are running on different nodes.

This batch of commits does quit a lot, most of which is captured here:

- Added `path` support to `dax.Address`. Address is now a string of the form [scheme]://[host]:[port]/[path].
- Added `Holder.directiveApplied` to determine (in tests) if the computer has completed applying the latest directive. This is somewhat temporary until we improve the mds-to-computer logic.
- Removed the "service prefix" code which was prepending client URL paths with the prefix. Instead, the serviceType (mds, queryer, computer[n] is now part of `dax.Address`).
- Removed, from the dax config, the top level `StorageMethod` and `StorageDSN` and now just have `MDS.Config.DataDir`.
- Added `Computer.Config.N` to specify the number of computers to run in-process.
- Moved the `pilosa.MDS` interface to `computer.Registrar`. This is an example of getting the interfaces defined in the right packages.
- Added `SnapshotTable()` method to the mds client (to align with its API).
- Changed `Balancer.AddJob()` to `Balancer.AddJobs()` to support, for example, adding 256 partitions in a single call. Refactored some of the naive Balancer to account for this.
- Added a `Seed` to the top-level config. It's not really useful because of package `crypto/rand`.
- Added an in-memory implementation of the DisCo interface and disabled etcd in a computer service.
- Create sepearte data-dirs for each in-process computer.
- Disabled grpc in dax.
- Modified the sql3 test definition format to support multiple insert steps and separate query results (to align with those steps).

* Changes necessary to get multiple computer instance running in-process

For now the config looks like this:

```
[computer]
run = true
n = 4
```

but we can probably just change that to be something like:

```
[computer]
run = 4
```

*Issues found running multiple "computers" in-process*
- grpc was trying to bind on the same port
  - changed GRPCListener from `*net.TCPListener` to `net.Listener`
  - created a nopListener and set to that for now (i.e. disabled grpc)
- etcd was starting more than once
  - changed dax to use in-memory implementations of the disco interfaces (i.e. stop using etcd)
- IDAllocator (which uses boltdb) was trying to open the `idalloc.db` file more than once
  - realized we have to set separate data-dirs for each holder. that fixed it.

* Port dax integration tests to ManagedCommand

* Modify Balancer-related methods like AddJob to AddJobs

There were (and still are) a lot of places where we were adding on job
at a time, even when we had a long list of jobs to add. This resulted in
every job add (for example adding 1 of 256 shards) taking ~40ms, or over
10s to create a keyed table. One reason was because each job add was
making multiple boltdb transactions.

* Port over more dax integration test stuff

* Add DirectiveApplied to signify that snapshot/writes have loaded.

We use this in tests to avoid using sleeps.
This should be considered temporary; we're going to need a more robust
solution for determining when a computer node is ready to serve complete
data.

* Finish porting dax integration tests

* Improve godocs

* Remove docker-based DAX integration tests.

* go mod tidy

* Move test/managed.go to avoid package conflicts

* Modify IDK integration tests to work with ServiceManager changes

This is really just computer -> computer0
And the MDS DataDir config change.

* cleanup found during review

* echo $CI_COMMIT_REF_SLUG in CI

* remove docker image arg, use build instead
2022-12-05 14:49:17 -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