Skip to content

Commit

Permalink
Dates need to specify UTC too
Browse files Browse the repository at this point in the history
  • Loading branch information
xentripetal committed Feb 10, 2022
1 parent 0300c95 commit 21cfc70
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 21 deletions.
2 changes: 1 addition & 1 deletion format/avro/decoders/logicaltypes.go
Expand Up @@ -96,7 +96,7 @@ func (d DateMapper) MapScalar(s scalar.S) (scalar.S, error) {
if !ok {
return s, errors.New("not an int64")
}
s.Sym = time.Unix(0, 0).AddDate(0, 0, int(v)).Format("2006-01-02")
s.Sym = time.Unix(0, 0).AddDate(0, 0, int(v)).UTC().Format("2006-01-02")
return s, nil
}

Expand Down
20 changes: 10 additions & 10 deletions format/avro/testdata/allDataTypes.fqtest
Expand Up @@ -89,7 +89,7 @@ $ fq dv allDataTypes.avro
0x440| 30 | 0 | data: "0" 0x447-0x447.7 (1)
0x440| 00 01 02 03 04 05 06 07| ........| fixed: raw bits 0x448-0x457.7 (16)
0x450|08 09 0a 0b 0c 0d 0e 0f |........ |
0x450| 0c | . | date: "1970-01-06" (6) 0x458-0x458.7 (1)
0x450| 0c | . | date: "1970-01-07" (6) 0x458-0x458.7 (1)
0x450| c0 a9 07 | ... | timeMillis: "00:01:00.000" (60000) 0x459-0x45b.7 (3)
0x450| e0 5d | .] | timeMicros: "00:00:00.006000" (6000) 0x45c-0x45d.7 (2)
0x450| c0 d9| ..| timestampMillis: "2000-01-01T00:01:00Z" (946684860000) 0x45e-0x463.7 (6)
Expand Down Expand Up @@ -155,7 +155,7 @@ $ fq dv allDataTypes.avro
0x490| 31 | 1 | data: "1" 0x495-0x495.7 (1)
0x490| 00 01 02 03 04 05 06 07 08 09| ..........| fixed: raw bits 0x496-0x4a5.7 (16)
0x4a0|0a 0b 0c 0d 0e 0f |...... |
0x4a0| 0e | . | date: "1970-01-07" (7) 0x4a6-0x4a6.7 (1)
0x4a0| 0e | . | date: "1970-01-08" (7) 0x4a6-0x4a6.7 (1)
0x4a0| c2 a9 07 | ... | timeMillis: "00:01:00.001" (60001) 0x4a7-0x4a9.7 (3)
0x4a0| dd 5d | .] | timeMicros: "23:59:59.994001" (-5999) 0x4aa-0x4ab.7 (2)
0x4a0| c2 c9 b7 ff| ....| timestampMillis: "2000-01-02T00:01:00.001Z" (946771260001) 0x4ac-0x4b1.7 (6)
Expand Down Expand Up @@ -224,7 +224,7 @@ $ fq dv allDataTypes.avro
0x4e0| 32 | 2 | data: "2" 0x4e5-0x4e5.7 (1)
0x4e0| 00 01 02 03 04 05 06 07 08 09| ..........| fixed: raw bits 0x4e6-0x4f5.7 (16)
0x4f0|0a 0b 0c 0d 0e 0f |...... |
0x4f0| 08 | . | date: "1970-01-04" (4) 0x4f6-0x4f6.7 (1)
0x4f0| 08 | . | date: "1970-01-05" (4) 0x4f6-0x4f6.7 (1)
0x4f0| c4 a9 07 | ... | timeMillis: "00:01:00.002" (60002) 0x4f7-0x4f9.7 (3)
0x4f0| e4 5d | .] | timeMicros: "00:00:00.006002" (6002) 0x4fa-0x4fb.7 (2)
0x4f0| c4 b9 ea d1| ....| timestampMillis: "2000-01-03T00:01:00.002Z" (946857660002) 0x4fc-0x501.7 (6)
Expand Down Expand Up @@ -284,7 +284,7 @@ $ fq dv allDataTypes.avro
0x530|33 |3 | data: "3" 0x530-0x530.7 (1)
0x530| 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e| ...............| fixed: raw bits 0x531-0x540.7 (16)
0x540|0f |. |
0x540| 0a | . | date: "1970-01-05" (5) 0x541-0x541.7 (1)
0x540| 0a | . | date: "1970-01-06" (5) 0x541-0x541.7 (1)
0x540| c6 a9 07 | ... | timeMillis: "00:01:00.003" (60003) 0x542-0x544.7 (3)
0x540| d9 5d | .] | timeMicros: "23:59:59.994003" (-5997) 0x545-0x546.7 (2)
0x540| c6 a9 9d a4 8f 37 | .....7 | timestampMillis: "2000-01-04T00:01:00.003Z" (946944060003) 0x547-0x54c.7 (6)
Expand Down Expand Up @@ -349,7 +349,7 @@ $ fq dv allDataTypes.avro
0x570| 02 | . | length: 1 0x57e-0x57e.7 (1)
0x570| 34| 4| data: "4" 0x57f-0x57f.7 (1)
0x580|00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f|................| fixed: raw bits 0x580-0x58f.7 (16)
0x590|04 |. | date: "1970-01-02" (2) 0x590-0x590.7 (1)
0x590|04 |. | date: "1970-01-03" (2) 0x590-0x590.7 (1)
0x590| c8 a9 07 | ... | timeMillis: "00:01:00.004" (60004) 0x591-0x593.7 (3)
0x590| e8 5d | .] | timeMicros: "00:00:00.006004" (6004) 0x594-0x595.7 (2)
0x590| c8 99 d0 f6 8f 37 | .....7 | timestampMillis: "2000-01-05T00:01:00.004Z" (947030460004) 0x596-0x59b.7 (6)
Expand Down Expand Up @@ -418,7 +418,7 @@ $ fq dv allDataTypes.avro
0x5d0|35 |5 | data: "5" 0x5d0-0x5d0.7 (1)
0x5d0| 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e| ...............| fixed: raw bits 0x5d1-0x5e0.7 (16)
0x5e0|0f |. |
0x5e0| 06 | . | date: "1970-01-03" (3) 0x5e1-0x5e1.7 (1)
0x5e0| 06 | . | date: "1970-01-04" (3) 0x5e1-0x5e1.7 (1)
0x5e0| ca a9 07 | ... | timeMillis: "00:01:00.005" (60005) 0x5e2-0x5e4.7 (3)
0x5e0| d5 5d | .] | timeMicros: "23:59:59.994005" (-5995) 0x5e5-0x5e6.7 (2)
0x5e0| ca 89 83 c9 90 37 | .....7 | timestampMillis: "2000-01-06T00:01:00.005Z" (947116860005) 0x5e7-0x5ec.7 (6)
Expand Down Expand Up @@ -478,7 +478,7 @@ $ fq dv allDataTypes.avro
0x610| 36 | 6 | data: "6" 0x61c-0x61c.7 (1)
0x610| 00 01 02| ...| fixed: raw bits 0x61d-0x62c.7 (16)
0x620|03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f |............. |
0x620| 00 | . | date: "1969-12-31" (0) 0x62d-0x62d.7 (1)
0x620| 00 | . | date: "1970-01-01" (0) 0x62d-0x62d.7 (1)
0x620| cc a9| ..| timeMillis: "00:01:00.006" (60006) 0x62e-0x630.7 (3)
0x630|07 |. |
0x630| ec 5d | .] | timeMicros: "00:00:00.006006" (6006) 0x631-0x632.7 (2)
Expand Down Expand Up @@ -544,7 +544,7 @@ $ fq dv allDataTypes.avro
0x660| 37 | 7 | data: "7" 0x66b-0x66b.7 (1)
0x660| 00 01 02 03| ....| fixed: raw bits 0x66c-0x67b.7 (16)
0x670|04 05 06 07 08 09 0a 0b 0c 0d 0e 0f |............ |
0x670| 02 | . | date: "1970-01-01" (1) 0x67c-0x67c.7 (1)
0x670| 02 | . | date: "1970-01-02" (1) 0x67c-0x67c.7 (1)
0x670| ce a9 07| ...| timeMillis: "00:01:00.007" (60007) 0x67d-0x67f.7 (3)
0x680|d1 5d |.] | timeMicros: "23:59:59.994007" (-5993) 0x680-0x681.7 (2)
0x680| ce e9 e8 ed 91 37 | .....7 | timestampMillis: "2000-01-08T00:01:00.007Z" (947289660007) 0x682-0x687.7 (6)
Expand Down Expand Up @@ -611,7 +611,7 @@ $ fq dv allDataTypes.avro
0x6b0| 38 | 8 | data: "8" 0x6ba-0x6ba.7 (1)
0x6b0| 00 01 02 03 04| .....| fixed: raw bits 0x6bb-0x6ca.7 (16)
0x6c0|05 06 07 08 09 0a 0b 0c 0d 0e 0f |........... |
0x6c0| 1c | . | date: "1970-01-14" (14) 0x6cb-0x6cb.7 (1)
0x6c0| 1c | . | date: "1970-01-15" (14) 0x6cb-0x6cb.7 (1)
0x6c0| d0 a9 07 | ... | timeMillis: "00:01:00.008" (60008) 0x6cc-0x6ce.7 (3)
0x6c0| f0| .| timeMicros: "00:00:00.006008" (6008) 0x6cf-0x6d0.7 (2)
0x6d0|5d |] |
Expand Down Expand Up @@ -670,7 +670,7 @@ $ fq dv allDataTypes.avro
0x700| 39 | 9 | data: "9" 0x704-0x704.7 (1)
0x700| 00 01 02 03 04 05 06 07 08 09 0a| ...........| fixed: raw bits 0x705-0x714.7 (16)
0x710|0b 0c 0d 0e 0f |..... |
0x710| 1e | . | date: "1970-01-15" (15) 0x715-0x715.7 (1)
0x710| 1e | . | date: "1970-01-16" (15) 0x715-0x715.7 (1)
0x710| d2 a9 07 | ... | timeMillis: "00:01:00.009" (60009) 0x716-0x718.7 (3)
0x710| cd 5d | .] | timeMicros: "23:59:59.994009" (-5991) 0x719-0x71a.7 (2)
0x710| d2 c9 ce 92 93| .....| timestampMillis: "2000-01-10T00:01:00.009Z" (947462460009) 0x71b-0x720.7 (6)
Expand Down

0 comments on commit 21cfc70

Please sign in to comment.