mirror of
https://github.com/featurebasedb/featurebase.git
synced 2026-08-28 02:44:59 +00:00
The internal/ingest and internal/schema endpoints were developed with
intent that they'd be the primary interface new users would work with,
because they were Easy To Use, and did not require any kind of setup,
the counterpoint being that ingest done this way had performance issues
because it ended up with huge amounts of JSON parsing to reformat
things into our native format. But this was understood to be the price
of providing a new-user-friendly JSON ingest experience.
A year later, we have no evidence that it's ever been used. We never
even moved it out of the `/internal` path. It's a lot of very complex
fiddly code and we don't seem to be using it, and at this point, our
anticipation is that if we really need something, we'll use CSV, which
we already have working, or something in the new SQL code. Either way,
we don't seem to be using this.
(cherry picked from commit 16ccbc461a)
28 lines
733 B
Go
28 lines
733 B
Go
// Copyright 2022 Molecula Corp. All rights reserved.
|
|
package pilosa_test
|
|
|
|
import (
|
|
"math/rand"
|
|
"testing"
|
|
|
|
pilosa "github.com/molecula/featurebase/v3"
|
|
)
|
|
|
|
func TestSortToShards(t *testing.T) {
|
|
var ir pilosa.ImportRequest
|
|
expected := make(map[uint64][]uint64)
|
|
const n = 50
|
|
rng := rand.New(rand.NewSource(3))
|
|
for i := 0; i < n; i++ {
|
|
x := uint64(rng.Intn(8 * pilosa.ShardWidth))
|
|
shard := x / pilosa.ShardWidth
|
|
expected[shard] = append(expected[shard], x)
|
|
ir.ColumnIDs = append(ir.ColumnIDs, x)
|
|
}
|
|
out := ir.SortToShards()
|
|
for shard, values := range out {
|
|
if len(values.ColumnIDs) != len(expected[shard]) {
|
|
t.Fatalf("shard %d: expected values %d, got values %d", shard, expected[shard], values.ColumnIDs)
|
|
}
|
|
}
|
|
}
|