diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index a61dce7..6a5ee77 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -29,7 +29,7 @@ jobs: fail-fast: true matrix: go: - - "1.20" + - "1.22" clickhouse: - "latest" steps: diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 5dfbc60..3fdb615 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -2,7 +2,7 @@ * Git * Make (see [Makefile](./Makefile) for all available commands) -* Go 1.20+ +* Go 1.22+ ## Install Protoc and Go plugin diff --git a/destination/db/values/values.go b/destination/db/values/values.go index a8caeb3..cf37e67 100644 --- a/destination/db/values/values.go +++ b/destination/db/values/values.go @@ -102,12 +102,19 @@ func Parse(colName string, colType pb.DataType, val string) (any, error) { } // Supported range of values: [1900-01-01 00:00:00, 2299-12-31 23:59:59.99999999]. // See https://clickhouse.com/docs/en/sql-reference/data-types/datetime64 - year := result.Year() + // However, due to the way the driver works, the actual upper bound is 2262-04-11 23:47:16. + year, month, day := result.Date() + if year > 2262 || (year == 2262 && month > 4) || (year == 2262 && month == 4 && day > 11) { + return time.Date(2262, time.April, 11, 23, 47, 16, 0, time.UTC), nil + } if year < 1900 { return time.Date(1900, time.January, 1, 0, 0, 0, 0, time.UTC), nil } - if year > 2299 { - return time.Date(2299, time.December, 31, 23, 59, 59, 0, time.UTC), nil + hours, minutes, seconds := result.Clock() + if year == 2262 && month == 4 && day == 11 && hours == 23 { + if minutes > 47 || minutes == 47 && seconds > 16 || minutes == 47 && seconds == 16 { + return time.Date(2262, time.April, 11, 23, 47, 16, 0, time.UTC), nil + } } return result, nil case pb.DataType_UTC_DATETIME: diff --git a/destination/db/values/values_test.go b/destination/db/values/values_test.go index 2c5e7ba..2533868 100644 --- a/destination/db/values/values_test.go +++ b/destination/db/values/values_test.go @@ -240,17 +240,35 @@ func TestParseTruncatedDateTime(t *testing.T) { assert.NoError(t, err) assert.Equal(t, time.Date(1900, 1, 1, 0, 0, 1, 0, time.UTC), val) - val, err = Parse("test", pb.DataType_NAIVE_DATETIME, "2300-01-01T00:00:00") + // year > 2262 + val, err = Parse("test", pb.DataType_NAIVE_DATETIME, "2263-04-11T00:00:00") + assert.NoError(t, err) + assert.Equal(t, time.Date(2262, 4, 11, 23, 47, 16, 0, time.UTC), val) + + // year == 2262, month > 04 + val, err = Parse("test", pb.DataType_NAIVE_DATETIME, "2262-05-11T00:00:00") assert.NoError(t, err) - assert.Equal(t, time.Date(2299, 12, 31, 23, 59, 59, 0, time.UTC), val) + assert.Equal(t, time.Date(2262, 4, 11, 23, 47, 16, 0, time.UTC), val) - val, err = Parse("test", pb.DataType_NAIVE_DATETIME, "2299-12-31T23:59:59") + // year == 2262, month == 04, day > 11 + val, err = Parse("test", pb.DataType_NAIVE_DATETIME, "2262-04-12T00:00:00") assert.NoError(t, err) - assert.Equal(t, time.Date(2299, 12, 31, 23, 59, 59, 0, time.UTC), val) + assert.Equal(t, time.Date(2262, 4, 11, 23, 47, 16, 0, time.UTC), val) - val, err = Parse("test", pb.DataType_NAIVE_DATETIME, "2299-12-31T23:59:58") + // minute > 47 + val, err = Parse("test", pb.DataType_NAIVE_DATETIME, "2262-04-11T23:48:00") assert.NoError(t, err) - assert.Equal(t, time.Date(2299, 12, 31, 23, 59, 58, 0, time.UTC), val) + assert.Equal(t, time.Date(2262, 4, 11, 23, 47, 16, 0, time.UTC), val) + + // seconds > 16 + val, err = Parse("test", pb.DataType_NAIVE_DATETIME, "2262-04-11T23:47:17") + assert.NoError(t, err) + assert.Equal(t, time.Date(2262, 4, 11, 23, 47, 16, 0, time.UTC), val) + + // an exact fit + val, err = Parse("test", pb.DataType_NAIVE_DATETIME, "2262-04-11T23:47:16") + assert.NoError(t, err) + assert.Equal(t, time.Date(2262, 4, 11, 23, 47, 16, 0, time.UTC), val) // MySQL-like edge cases val, err = Parse("test", pb.DataType_NAIVE_DATETIME, "0000-01-01T00:00:00") @@ -259,7 +277,7 @@ func TestParseTruncatedDateTime(t *testing.T) { val, err = Parse("test", pb.DataType_NAIVE_DATETIME, "9999-12-31T23:59:59") assert.NoError(t, err) - assert.Equal(t, time.Date(2299, 12, 31, 23, 59, 59, 0, time.UTC), val) + assert.Equal(t, time.Date(2262, 4, 11, 23, 47, 16, 0, time.UTC), val) } func TestParseTruncatedUTCDateTime(t *testing.T) { diff --git a/destination/main_e2e_test.go b/destination/main_e2e_test.go index 8141180..0ecc9ac 100644 --- a/destination/main_e2e_test.go +++ b/destination/main_e2e_test.go @@ -243,6 +243,22 @@ func TestTableNotFound(t *testing.T) { runSDKTestCommand(t, fileName, true) // verify at least no SDK tester errors } +func TestTruncateDateValues(t *testing.T) { + fileName := "input_truncate_date_values.json" + tableName := "truncate_date_values" + startServer(t) + runSDKTestCommand(t, fileName, true) + assertTableRowsWithPK(t, tableName, [][]string{ + {"1", "1900-01-01", "1900-01-01 00:00:00", "1900-01-01 00:00:00.000000000"}, + {"2", "2299-12-31", "2262-04-11 23:47:16", "2262-04-11 23:47:16.000000000"}}) + assertTableColumns(t, tableName, [][]string{ + {"id", "Int32", ""}, + {"d", "Nullable(Date32)", ""}, + {"dt", "Nullable(DateTime64(0, 'UTC'))", ""}, + {"utc", "Nullable(DateTime64(9, 'UTC'))", ""}, + {"_fivetran_synced", "DateTime64(9, 'UTC')", ""}}) +} + func TestLargeInputFile(t *testing.T) { t.Skip("Skip large input file test - SDK tester hangs") tableName := "input_large_file" diff --git a/docs/overview.md b/docs/overview.md index 959e8ec..ec3aa9b 100644 --- a/docs/overview.md +++ b/docs/overview.md @@ -26,24 +26,32 @@ ClickHouse Cloud. [Fivetran data types](https://fivetran.com/docs/destinations#datatypes) to ClickHouse mapping overview: -| Fivetran type | ClickHouse type | -|---------------|--------------------------------------------------------------------------------------------| -| BOOLEAN | [Bool](https://clickhouse.com/docs/en/sql-reference/data-types/boolean) | -| SHORT | [Int16](https://clickhouse.com/docs/en/sql-reference/data-types/int-uint) | -| INT | [Int32](https://clickhouse.com/docs/en/sql-reference/data-types/int-uint) | -| LONG | [Int64](https://clickhouse.com/docs/en/sql-reference/data-types/int-uint) | -| BIGDECIMAL | [Decimal(P, S)](https://clickhouse.com/docs/en/sql-reference/data-types/decimal) | -| FLOAT | [Float32](https://clickhouse.com/docs/en/sql-reference/data-types/float) | -| DOUBLE | [Float64](https://clickhouse.com/docs/en/sql-reference/data-types/float) | -| LOCALDATE | [Date32](https://clickhouse.com/docs/en/sql-reference/data-types/date32) | -| LOCALDATETIME | [DateTime64(0, 'UTC')](https://clickhouse.com/docs/en/sql-reference/data-types/datetime64) | -| INSTANT | [DateTime64(9, 'UTC')](https://clickhouse.com/docs/en/sql-reference/data-types/datetime64) | -| STRING | [String](https://clickhouse.com/docs/en/sql-reference/data-types/string) | -| BINARY | [String](https://clickhouse.com/docs/en/sql-reference/data-types/string) * | -| XML | [String](https://clickhouse.com/docs/en/sql-reference/data-types/string) * | -| JSON | [String](https://clickhouse.com/docs/en/sql-reference/data-types/string) * | - -> * NOTE: The ClickHouse [String](https://clickhouse.com/docs/en/sql-reference/data-types/string) type can be used +| Fivetran type | ClickHouse type | +|---------------|--------------------------------------------------------------------------------------------------| +| BOOLEAN | [Bool](https://clickhouse.com/docs/en/sql-reference/data-types/boolean) | +| SHORT | [Int16](https://clickhouse.com/docs/en/sql-reference/data-types/int-uint) | +| INT | [Int32](https://clickhouse.com/docs/en/sql-reference/data-types/int-uint) | +| LONG | [Int64](https://clickhouse.com/docs/en/sql-reference/data-types/int-uint) | +| BIGDECIMAL | [Decimal(P, S)](https://clickhouse.com/docs/en/sql-reference/data-types/decimal) | +| FLOAT | [Float32](https://clickhouse.com/docs/en/sql-reference/data-types/float) | +| DOUBLE | [Float64](https://clickhouse.com/docs/en/sql-reference/data-types/float) | +| LOCALDATE | [Date32](https://clickhouse.com/docs/en/sql-reference/data-types/date32) * | +| LOCALDATETIME | [DateTime64(0, 'UTC')](https://clickhouse.com/docs/en/sql-reference/data-types/datetime64) * | +| INSTANT | [DateTime64(9, 'UTC')](https://clickhouse.com/docs/en/sql-reference/data-types/datetime64) * | +| STRING | [String](https://clickhouse.com/docs/en/sql-reference/data-types/string) | +| BINARY | [String](https://clickhouse.com/docs/en/sql-reference/data-types/string) ** | +| XML | [String](https://clickhouse.com/docs/en/sql-reference/data-types/string) ** | +| JSON | [String](https://clickhouse.com/docs/en/sql-reference/data-types/string) ** | + +> * NOTE: the allowed range for `LOCALDATE` values is `[1900-01-01, 2299-12-31]` +> (see [Date32](https://clickhouse.com/docs/en/sql-reference/data-types/date32)); +> the allowed range for `LOCALDATETIME` and `INSTANT` is `[1900-01-01 00:00:00, 2262-04-11 23:47:16]` +> (see [DateTime64](https://clickhouse.com/docs/en/sql-reference/data-types/datetime64)). +> If a value does not fit into the allowed range, it will be rounded to the nearest valid value. +> For example: an input `LOCALDATE` value like `0000-01-01` will be stored as `1900-01-01`, +> and `9999-01-01` will be stored as `2299-12-31`. + +> ** NOTE: The ClickHouse [String](https://clickhouse.com/docs/en/sql-reference/data-types/string) type can be used > to represent an arbitrary set of bytes. The ClickHouse destination adds a column comment to the `JSON`, `BINARY`, > and `XML` types to indicate the original data type. > [JSON](https://clickhouse.com/docs/en/sql-reference/data-types/json) data type is not used as it is marked as diff --git a/go.mod b/go.mod index 782b4d4..2e4ee6f 100644 --- a/go.mod +++ b/go.mod @@ -1,35 +1,37 @@ module fivetran.com/fivetran_sdk -go 1.20 +go 1.21 + +toolchain go1.21.11 require ( - github.com/ClickHouse/clickhouse-go/v2 v2.17.1 - github.com/google/uuid v1.5.0 - github.com/klauspost/compress v1.16.7 + github.com/ClickHouse/clickhouse-go/v2 v2.26.0 + github.com/google/uuid v1.6.0 + github.com/klauspost/compress v1.17.7 github.com/rs/zerolog v1.32.0 - github.com/shopspring/decimal v1.3.1 - github.com/stretchr/testify v1.8.4 - golang.org/x/sync v0.4.0 + github.com/shopspring/decimal v1.4.0 + github.com/stretchr/testify v1.9.0 + golang.org/x/sync v0.6.0 google.golang.org/grpc v1.60.1 google.golang.org/protobuf v1.33.0 ) require ( - github.com/ClickHouse/ch-go v0.58.2 // indirect - github.com/andybalholm/brotli v1.0.6 // indirect + github.com/ClickHouse/ch-go v0.61.5 // indirect + github.com/andybalholm/brotli v1.1.0 // indirect github.com/davecgh/go-spew v1.1.1 // indirect github.com/go-faster/city v1.0.1 // indirect - github.com/go-faster/errors v0.6.1 // indirect + github.com/go-faster/errors v0.7.1 // indirect github.com/golang/protobuf v1.5.3 // indirect github.com/mattn/go-colorable v0.1.13 // indirect github.com/mattn/go-isatty v0.0.19 // indirect - github.com/paulmach/orb v0.10.0 // indirect - github.com/pierrec/lz4/v4 v4.1.18 // indirect + github.com/paulmach/orb v0.11.1 // indirect + github.com/pierrec/lz4/v4 v4.1.21 // indirect github.com/pkg/errors v0.9.1 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect github.com/segmentio/asm v1.2.0 // indirect - go.opentelemetry.io/otel v1.19.0 // indirect - go.opentelemetry.io/otel/trace v1.19.0 // indirect + go.opentelemetry.io/otel v1.26.0 // indirect + go.opentelemetry.io/otel/trace v1.26.0 // indirect golang.org/x/net v0.23.0 // indirect golang.org/x/sys v0.18.0 // indirect golang.org/x/text v0.14.0 // indirect diff --git a/go.sum b/go.sum index 3a82222..ba2e8ea 100644 --- a/go.sum +++ b/go.sum @@ -1,17 +1,17 @@ -github.com/ClickHouse/ch-go v0.58.2 h1:jSm2szHbT9MCAB1rJ3WuCJqmGLi5UTjlNu+f530UTS0= -github.com/ClickHouse/ch-go v0.58.2/go.mod h1:Ap/0bEmiLa14gYjCiRkYGbXvbe8vwdrfTYWhsuQ99aw= -github.com/ClickHouse/clickhouse-go/v2 v2.17.1 h1:ZCmAYWpu75IyEi7+Yrs/uaAjiCGY5wfW5kXo64exkX4= -github.com/ClickHouse/clickhouse-go/v2 v2.17.1/go.mod h1:rkGTvFDTLqLIm0ma+13xmcCfr/08Gvs7KmFt1tgiWHQ= -github.com/andybalholm/brotli v1.0.6 h1:Yf9fFpf49Zrxb9NlQaluyE92/+X7UVHlhMNJN2sxfOI= -github.com/andybalholm/brotli v1.0.6/go.mod h1:fO7iG3H7G2nSZ7m0zPUDn85XEX2GTukHGRSepvi9Eig= +github.com/ClickHouse/ch-go v0.61.5 h1:zwR8QbYI0tsMiEcze/uIMK+Tz1D3XZXLdNrlaOpeEI4= +github.com/ClickHouse/ch-go v0.61.5/go.mod h1:s1LJW/F/LcFs5HJnuogFMta50kKDO0lf9zzfrbl0RQg= +github.com/ClickHouse/clickhouse-go/v2 v2.26.0 h1:j4/y6NYaCcFkJwN/TU700ebW+nmsIy34RmUAAcZKy9w= +github.com/ClickHouse/clickhouse-go/v2 v2.26.0/go.mod h1:iDTViXk2Fgvf1jn2dbJd1ys+fBkdD1UMRnXlwmhijhQ= +github.com/andybalholm/brotli v1.1.0 h1:eLKJA0d02Lf0mVpIDgYnqXcUn0GqVmEFny3VuID1U3M= +github.com/andybalholm/brotli v1.1.0/go.mod h1:sms7XGricyQI9K10gOSf56VKKWS4oLer58Q+mhRPtnY= github.com/coreos/go-systemd/v22 v22.5.0/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/go-faster/city v1.0.1 h1:4WAxSZ3V2Ws4QRDrscLEDcibJY8uf41H6AhXDrNDcGw= github.com/go-faster/city v1.0.1/go.mod h1:jKcUJId49qdW3L1qKHH/3wPeUstCVpVSXTM6vO3VcTw= -github.com/go-faster/errors v0.6.1 h1:nNIPOBkprlKzkThvS/0YaX8Zs9KewLCOSFQS5BU06FI= -github.com/go-faster/errors v0.6.1/go.mod h1:5MGV2/2T9yvlrbhe9pD9LO5Z/2zCSq2T8j+Jpi2LAyY= +github.com/go-faster/errors v0.7.1 h1:MkJTnDoEdi9pDabt1dpWf7AA8/BaSYZqibYyhZ20AYg= +github.com/go-faster/errors v0.7.1/go.mod h1:5ySTjWFiphBs07IKuiL69nxdfd5+fzh1u7FPGZP2quo= github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= @@ -20,16 +20,18 @@ github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiu github.com/golang/snappy v0.0.1/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= -github.com/google/uuid v1.5.0 h1:1p67kYwdtXjb0gL0BPiP1Av9wiZPo5A8z2cWkTZ+eyU= -github.com/google/uuid v1.5.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= +github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= +github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= +github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= github.com/klauspost/compress v1.13.6/go.mod h1:/3/Vjq9QcHkK5uEr5lBEmyoZ1iFhe47etQ6QUkpK6sk= -github.com/klauspost/compress v1.16.7 h1:2mk3MPGNzKyxErAw8YaohYh69+pa4sIQSC0fPGCFR9I= -github.com/klauspost/compress v1.16.7/go.mod h1:ntbaceVETuRiXiv4DpjP66DpAtAGkEQskQzEyD//IeE= +github.com/klauspost/compress v1.17.7 h1:ehO88t2UGzQK66LMdE8tibEd1ErmzZjNEqWkjLAKQQg= +github.com/klauspost/compress v1.17.7/go.mod h1:Di0epgTjJY877eYKx5yC51cX2A2Vl2ibi7bDH9ttBbw= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= +github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= @@ -39,27 +41,28 @@ github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/ github.com/mattn/go-isatty v0.0.19 h1:JITubQf0MOLdlGRuRq+jtsDlekdYPia9ZFsB8h/APPA= github.com/mattn/go-isatty v0.0.19/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= github.com/montanaflynn/stats v0.0.0-20171201202039-1bf9dbcd8cbe/go.mod h1:wL8QJuTMNUDYhXwkmfOly8iTdp5TEcJFWZD2D7SIkUc= -github.com/paulmach/orb v0.10.0 h1:guVYVqzxHE/CQ1KpfGO077TR0ATHSNjp4s6XGLn3W9s= -github.com/paulmach/orb v0.10.0/go.mod h1:5mULz1xQfs3bmQm63QEJA6lNGujuRafwA5S/EnuLaLU= +github.com/paulmach/orb v0.11.1 h1:3koVegMC4X/WeiXYz9iswopaTwMem53NzTJuTF20JzU= +github.com/paulmach/orb v0.11.1/go.mod h1:5mULz1xQfs3bmQm63QEJA6lNGujuRafwA5S/EnuLaLU= github.com/paulmach/protoscan v0.2.1/go.mod h1:SpcSwydNLrxUGSDvXvO0P7g7AuhJ7lcKfDlhJCDw2gY= -github.com/pierrec/lz4/v4 v4.1.18 h1:xaKrnTkyoqfh1YItXl56+6KJNVYWlEEPuAQW9xsplYQ= -github.com/pierrec/lz4/v4 v4.1.18/go.mod h1:gZWDp/Ze/IJXGXf23ltt2EXimqmTUXEy0GFuRQyBid4= +github.com/pierrec/lz4/v4 v4.1.21 h1:yOVMLb6qSIDP67pl/5F7RepeKYu/VmTyEXvuMI5d9mQ= +github.com/pierrec/lz4/v4 v4.1.21/go.mod h1:gZWDp/Ze/IJXGXf23ltt2EXimqmTUXEy0GFuRQyBid4= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjRBZyWFQ= +github.com/rogpeppe/go-internal v1.10.0/go.mod h1:UQnix2H7Ngw/k4C5ijL5+65zddjncjaFoBhdsK/akog= github.com/rs/xid v1.5.0/go.mod h1:trrq9SKmegXys3aeAKXMUTdJsYXVwGY3RLcfgqegfbg= github.com/rs/zerolog v1.32.0 h1:keLypqrlIjaFsbmJOBdB/qvyF8KEtCWHwobLp5l/mQ0= github.com/rs/zerolog v1.32.0/go.mod h1:/7mN4D5sKwJLZQ2b/znpjC3/GQWY/xaDXUM0kKWRHss= github.com/segmentio/asm v1.2.0 h1:9BQrFxC+YOHJlTlHGkTrFWf59nbL3XnCoFLTwDCI7ys= github.com/segmentio/asm v1.2.0/go.mod h1:BqMnlJP91P8d+4ibuonYZw9mfnzI9HfxselHZr5aAcs= -github.com/shopspring/decimal v1.3.1 h1:2Usl1nmF/WZucqkFZhnfFYxxxu8LG21F6nPQBE5gKV8= -github.com/shopspring/decimal v1.3.1/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o= +github.com/shopspring/decimal v1.4.0 h1:bxl37RwXBklmTi0C79JfXCEBD1cqqHt0bbgBAGFp81k= +github.com/shopspring/decimal v1.4.0/go.mod h1:gawqmDU56v4yIKSwfBSFip1HdCCXN8/+DMd9qYNcwME= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= -github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= +github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= +github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= github.com/tidwall/pretty v1.0.0/go.mod h1:XNkn88O1ChpSDQmQeStsy+sBenx6DDtFZJxhVysOjyk= github.com/xdg-go/pbkdf2 v1.0.0/go.mod h1:jrpuAogTd400dnrH08LKmI/xc1MbPOebTwRqcT5RDeI= github.com/xdg-go/scram v1.1.1/go.mod h1:RaEWvsqvNKKvBPvcKeFjrG2cJqOkHTiyTpzz23ni57g= @@ -68,10 +71,10 @@ github.com/youmark/pkcs8 v0.0.0-20181117223130-1be2e3e5546d/go.mod h1:rHwXgn7Jul github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= go.mongodb.org/mongo-driver v1.11.4/go.mod h1:PTSz5yu21bkT/wXpkS7WR5f0ddqw5quethTUn9WM+2g= -go.opentelemetry.io/otel v1.19.0 h1:MuS/TNf4/j4IXsZuJegVzI1cwut7Qc00344rgH7p8bs= -go.opentelemetry.io/otel v1.19.0/go.mod h1:i0QyjOq3UPoTzff0PJB2N66fb4S0+rSbSB15/oyH9fY= -go.opentelemetry.io/otel/trace v1.19.0 h1:DFVQmlVbfVeOuBRrwdtaehRrWiL1JoVs9CPIQ1Dzxpg= -go.opentelemetry.io/otel/trace v1.19.0/go.mod h1:mfaSyvGyEJEI0nyV2I4qhNQnbBOUUmYZpYojqMnX2vo= +go.opentelemetry.io/otel v1.26.0 h1:LQwgL5s/1W7YiiRwxf03QGnWLb2HW4pLiAhaA5cZXBs= +go.opentelemetry.io/otel v1.26.0/go.mod h1:UmLkJHUAidDval2EICqBMbnAd0/m2vmpf/dAM+fvFs4= +go.opentelemetry.io/otel/trace v1.26.0 h1:1ieeAUb4y0TE26jUFrCIXKpTuVK7uJGN9/Z/2LP5sQA= +go.opentelemetry.io/otel/trace v1.26.0/go.mod h1:4iDxvGDQuUkHve82hJJ8UqrwswHYsZuWCBllGV2U2y0= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= @@ -89,8 +92,8 @@ golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.4.0 h1:zxkM55ReGkDlKSM+Fu41A+zmbZuaPVbGMzvvdUPznYQ= -golang.org/x/sync v0.4.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y= +golang.org/x/sync v0.6.0 h1:5BMeUDZ7vkXGfEr1x9B4bRcTH4lpkTkpdh0T/J+qjbQ= +golang.org/x/sync v0.6.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -129,6 +132,7 @@ google.golang.org/protobuf v1.33.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHh gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= +gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/sdk_tests/input_truncate_date_values.json b/sdk_tests/input_truncate_date_values.json new file mode 100644 index 0000000..0ac2379 --- /dev/null +++ b/sdk_tests/input_truncate_date_values.json @@ -0,0 +1,36 @@ +{ + "create_table": { + "truncate_date_values": { + "columns": { + "id": "INT", + "d": "NAIVE_DATE", + "dt": "NAIVE_DATETIME", + "utc": "UTC_DATETIME" + }, + "primary_key": ["id"] + } + }, + "describe_table": [ + "truncate_date_values" + ], + "ops": [ + { + "upsert": { + "truncate_date_values": [ + { + "id": 1, + "d": "0000-01-01", + "dt": "0000-01-01T00:00:00", + "utc": "0000-01-01T00:00:00.000000000Z" + }, + { + "id": 2, + "d": "9999-12-31", + "dt": "9999-12-31T23:59:59", + "utc": "9999-12-31T23:59:59.999999999Z" + } + ] + } + } + ] +} \ No newline at end of file