add executor tests and license headers for like & UnionRows

This commit is contained in:
Jaden Weiss 2020-07-08 12:50:36 -04:00
parent 7a16ffff68
commit c9edccb267
No known key found for this signature in database
GPG key ID: 177F065773634B67
3 changed files with 57 additions and 0 deletions

View file

@ -4742,6 +4742,10 @@ func TestExecutor_Execute_Rows_Keys(t *testing.T) {
q: `Rows(f, previous="1", limit=0, column="0")`,
exp: []string{},
},
{
q: `Rows(f, like="__")`,
exp: []string{"10", "11", "12", "13", "14", "15", "16", "17", "18"},
},
}
for i, test := range tests {
@ -5843,6 +5847,31 @@ func TestExecutor_Execute_TopNDistinct(t *testing.T) {
})
}
func Test_Executor_Execute_UnionRows(t *testing.T) {
c := test.MustRunCluster(t, 2)
defer c.Close()
c.CreateField(t, "i", pilosa.IndexOptions{}, "s",
pilosa.OptFieldTypeSet(pilosa.CacheTypeRanked, 50000),
)
// Populate data.
c.Query(t, "i", `
Set(0, s=1)
Set(1, s=2)
Set(2, s=3)
Set(3, s=1)
Set(3, s=5)
`)
if res := c.Query(t, "i", `Count(UnionRows(TopN(s, n=1)))`); res.Results[0] != uint64(2) {
t.Errorf("expected 2 columns, got %v", res.Results[0])
}
if res := c.Query(t, "i", `Count(UnionRows(Rows(s)))`); res.Results[0] != uint64(4) {
t.Errorf("expected 4 columns, got %v", res.Results[0])
}
}
func TestTimelessClearRegression(t *testing.T) {
data, err := ioutil.ReadFile("testdata/timeRegressionSchema.json")
if err != nil {

14
like.go
View file

@ -1,3 +1,17 @@
// Copyright 2020 Pilosa Corp.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package pilosa
import (

View file

@ -1,3 +1,17 @@
// Copyright 2020 Pilosa Corp.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package pilosa
import (