mirror of
https://github.com/featurebasedb/featurebase.git
synced 2026-09-07 17:15:56 +00:00
Merge branch 'master' into count-global
This commit is contained in:
commit
2961a69bd2
2 changed files with 22 additions and 0 deletions
|
|
@ -6576,6 +6576,9 @@ func (e *executor) translateResult(ctx context.Context, index string, idx *Index
|
|||
|
||||
if field.Keys() {
|
||||
rslt := result.Pos
|
||||
if rslt == nil {
|
||||
return &SignedRow{Pos: &Row{}}, nil
|
||||
}
|
||||
other := &Row{Attrs: rslt.Attrs}
|
||||
for _, segment := range rslt.Segments() {
|
||||
keys, err := e.Cluster.translateIndexIDs(context.Background(), field.ForeignIndex(), segment.Columns())
|
||||
|
|
|
|||
|
|
@ -5397,6 +5397,19 @@ func TestExecutor_ForeignIndex(t *testing.T) {
|
|||
pilosa.OptFieldKeys(),
|
||||
)
|
||||
|
||||
// stepchild/other field needs to have usesKeys=true
|
||||
crashSchemaJson := `{"indexes": [{"name": "stepparent","createdAt": 1611247966371721700,"options": {"keys": true,"trackExistence": true},"shardWidth": 1048576},{"name": "stepchild","createdAt": 1611247953796662800,"options": {"keys": true,"trackExistence": true},"shardWidth": 1048576,"fields": [{"name": "parent_id","createdAt": 1611247953797265700,"options": {"type": "int","base": 0,"bitDepth": 28,"min": -9223372036854776000,"max": 9223372036854776000,"keys": false,"foreignIndex": "stepparent"}},{"name": "other","createdAt": 1611247953796814000,"options": {"type": "int","base": 0,"bitDepth": 17,"min": -9223372036854776000,"max": 9223372036854776000,"keys": true,"foreignIndex": ""}}]}]}`
|
||||
|
||||
crashSchema := &pilosa.Schema{}
|
||||
err := json.Unmarshal([]byte(crashSchemaJson), &crashSchema)
|
||||
if err != nil {
|
||||
t.Fatalf("json unmarshall: %v", err)
|
||||
}
|
||||
err = c.GetNode(0).API.ApplySchema(context.Background(), crashSchema, false)
|
||||
if err != nil {
|
||||
t.Fatalf("applying JSON schema: %v", err)
|
||||
}
|
||||
|
||||
// Populate parent data.
|
||||
c.Query(t, "parent", fmt.Sprintf(`
|
||||
Set("one", general=1)
|
||||
|
|
@ -5442,6 +5455,12 @@ func TestExecutor_ForeignIndex(t *testing.T) {
|
|||
t.Fatalf("unexpected keys: %v", row.Keys)
|
||||
}
|
||||
|
||||
crash := c.Query(t, "stepchild", `Distinct(Row(parent_id=3), field=other)`).Results[0].(pilosa.SignedRow)
|
||||
if !sameStringSlice(crash.Pos.Keys, []string{}) {
|
||||
// empty result; error condition does not require data
|
||||
t.Fatalf("unexpected columns: %v", crash.Pos.Keys)
|
||||
}
|
||||
|
||||
eq := c.Query(t, "child", `Row(parent_id=="one")`).Results[0].(*pilosa.Row)
|
||||
if !reflect.DeepEqual(eq.Columns(), []uint64{1, ShardWidth}) {
|
||||
t.Fatalf("unexpected columns: %v", eq.Columns())
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue