MCPcopy Create free account
hub / github.com/cloudquery/cloudquery / transformTimestamp

Function transformTimestamp

plugins/destination/duckdb/client/transform.go:148–162  ·  view source on GitHub ↗
(dt *arrow.TimestampType, arr *array.Timestamp)

Source from the content-addressed store, hash-verified

146}
147
148func transformTimestamp(dt *arrow.TimestampType, arr *array.Timestamp) arrow.Array {
149 builder := array.NewTimestampBuilder(memory.DefaultAllocator, dt)
150 in, out := arr.DataType().(*arrow.TimestampType).Unit, dt.Unit
151
152 for i := 0; i < arr.Len(); i++ {
153 if arr.IsNull(i) {
154 builder.AppendNull()
155 continue
156 }
157
158 builder.Append(arrow.Timestamp(arrow.ConvertTimestampValue(in, out, int64(arr.Value(i)))))
159 }
160
161 return builder.NewArray()
162}
163
164func transformDate32ToTimestamp(arr *array.Date32) arrow.Array {
165 builder := array.NewTimestampBuilder(memory.DefaultAllocator, &arrow.TimestampType{Unit: arrow.Microsecond, TimeZone: "UTC"})

Callers 2

transformArrayFunction · 0.85
reverseTransformArrayFunction · 0.85

Calls 2

AppendMethod · 0.80
ValueMethod · 0.65

Tested by

no test coverage detected