Skip to content
This repository was archived by the owner on Feb 21, 2024. It is now read-only.

Commit 7ae2f02

Browse files
authored
add test coverage for ordring by string, bools, and timestamps (#2327)
1 parent c9c63b2 commit 7ae2f02

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

sql3/sql_complex_test.go

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2927,6 +2927,41 @@ func TestPlanner_BulkInsertParquet(t *testing.T) {
29272927
if !pql.Decimal.EqualTo(d, results[0][0].(pql.Decimal)) {
29282928
t.Fatal("Should be equal")
29292929
}
2930+
// just getting some opOrderBy coverage here
2931+
// order by string
2932+
results, _, _, err = sql_test.MustQueryRows(t, c.GetNode(0).Server, `select _id, c from j1 order by c`)
2933+
assert.NoError(t, err)
2934+
if diff := cmp.Diff([][]interface{}{
2935+
{int64(2), "goldenratio"},
2936+
{int64(1), "pi"},
2937+
{int64(3), "sqr2"},
2938+
}, results); diff != "" {
2939+
t.Fatal(diff)
2940+
}
2941+
// order by bool
2942+
results, _, _, err = sql_test.MustQueryRows(t, c.GetNode(0).Server, `select _id, f from j1 order by f`)
2943+
assert.NoError(t, err)
2944+
if diff := cmp.Diff([][]interface{}{
2945+
{int64(2), false},
2946+
{int64(1), true},
2947+
{int64(3), true},
2948+
}, results); diff != "" {
2949+
t.Fatal(diff)
2950+
}
2951+
// order by timestamp
2952+
results, _, _, err = sql_test.MustQueryRows(t, c.GetNode(0).Server, `select _id, t from j1 order by t`)
2953+
assert.NoError(t, err)
2954+
t2, _ := time.ParseInLocation(time.RFC3339Nano, "1970-01-28T00:00:00Z", time.UTC)
2955+
t3, _ := time.ParseInLocation(time.RFC3339Nano, "1988-05-30T12:02:00Z", time.UTC)
2956+
t1, _ := time.ParseInLocation(time.RFC3339Nano, "2022-01-28T12:14:04Z", time.UTC)
2957+
2958+
if diff := cmp.Diff([][]interface{}{
2959+
{int64(2), t2},
2960+
{int64(3), t3},
2961+
{int64(1), t1},
2962+
}, results); diff != "" {
2963+
t.Fatal(diff)
2964+
}
29302965
})
29312966

29322967
t.Run("BulkParquetFromUrl", func(t *testing.T) {

0 commit comments

Comments
 (0)