fix prolly_fields_test

This commit is contained in:
Andy Arthur
2022-05-24 16:18:32 -07:00
parent c878a26694
commit b1203d02d5
2 changed files with 8 additions and 3 deletions
@@ -113,7 +113,7 @@ func TestRoundTripProllyFields(t *testing.T) {
{
name: "date",
typ: val.Type{Enc: val.DateEnc},
value: time.Now().UTC(),
value: dateFromTime(time.Now().UTC()),
},
{
name: "datetime",
@@ -122,7 +122,7 @@ func TestRoundTripProllyFields(t *testing.T) {
},
{
name: "timestamp",
typ: val.Type{Enc: val.TimestampEnc},
typ: val.Type{Enc: val.DatetimeEnc},
value: time.Now().UTC(),
},
{
@@ -196,3 +196,8 @@ func mustParseJson(t *testing.T, s string) sql.JSONDocument {
require.NoError(t, err)
return sql.JSONDocument{Val: v}
}
func dateFromTime(t time.Time) time.Time {
y, m, d := t.Year(), t.Month(), t.Day()
return time.Date(y, m, d, 0, 0, 0, 0, time.UTC)
}
+1 -1
View File
@@ -256,7 +256,7 @@ func (td TupleDesc) GetYear(i int, tup Tuple) (v int16, ok bool) {
td.expectEncoding(i, YearEnc)
b := td.GetField(i, tup)
if b != nil {
v, ok = readInt16(b), true
v, ok = readYear(b), true
}
return
}