Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ExtendedTime] Remove references for OldNewExtendedTimeDetails #980

Merged
merged 3 commits into from
Oct 23, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Clean up.
Tang8330 committed Oct 23, 2024

Unverified

This user has not yet uploaded their public signing key.
commit da8e465cbe0946c021b5fc1912644b887b56b6f6
4 changes: 2 additions & 2 deletions lib/debezium/converters/time_test.go
Original file line number Diff line number Diff line change
@@ -143,7 +143,7 @@ func TestTime_Convert(t *testing.T) {
}

func TestNanoTime_Converter(t *testing.T) {
assert.Equal(t, typing.OldNewExtendedTimeDetails(typing.ETime, ext.TimeKindType, NanoTime{}.layout()), NanoTime{}.ToKindDetails())
assert.Equal(t, typing.MustNewExtendedTimeDetails(typing.ETime, ext.TimeKindType, NanoTime{}.layout()), NanoTime{}.ToKindDetails())
{
// Invalid data
_, err := NanoTime{}.Convert("123")
@@ -158,7 +158,7 @@ func TestNanoTime_Converter(t *testing.T) {
}

func TestMicroTime_Converter(t *testing.T) {
assert.Equal(t, typing.OldNewExtendedTimeDetails(typing.ETime, ext.TimeKindType, MicroTime{}.layout()), MicroTime{}.ToKindDetails())
assert.Equal(t, typing.MustNewExtendedTimeDetails(typing.ETime, ext.TimeKindType, MicroTime{}.layout()), MicroTime{}.ToKindDetails())
{
// Invalid data
_, err := MicroTime{}.Convert("123")
6 changes: 3 additions & 3 deletions lib/debezium/converters/timestamp_test.go
Original file line number Diff line number Diff line change
@@ -9,7 +9,7 @@ import (
)

func TestTimestamp_Converter(t *testing.T) {
assert.Equal(t, typing.OldNewExtendedTimeDetails(typing.ETime, ext.TimestampNTZKindType, ext.RFC3339MillisecondNoTZ), Timestamp{}.ToKindDetails())
assert.Equal(t, typing.MustNewExtendedTimeDetails(typing.ETime, ext.TimestampNTZKindType, ext.RFC3339MillisecondNoTZ), Timestamp{}.ToKindDetails())
{
// Invalid conversion
_, err := Timestamp{}.Convert("invalid")
@@ -30,7 +30,7 @@ func TestTimestamp_Converter(t *testing.T) {
}

func TestMicroTimestamp_Converter(t *testing.T) {
assert.Equal(t, typing.OldNewExtendedTimeDetails(typing.ETime, ext.TimestampNTZKindType, ext.RFC3339MicrosecondNoTZ), MicroTimestamp{}.ToKindDetails())
assert.Equal(t, typing.MustNewExtendedTimeDetails(typing.ETime, ext.TimestampNTZKindType, ext.RFC3339MicrosecondNoTZ), MicroTimestamp{}.ToKindDetails())
{
// Invalid conversion
_, err := MicroTimestamp{}.Convert("invalid")
@@ -51,7 +51,7 @@ func TestMicroTimestamp_Converter(t *testing.T) {
}

func TestNanoTimestamp_Converter(t *testing.T) {
assert.Equal(t, typing.OldNewExtendedTimeDetails(typing.ETime, ext.TimestampNTZKindType, ext.RFC3339NanosecondNoTZ), NanoTimestamp{}.ToKindDetails())
assert.Equal(t, typing.MustNewExtendedTimeDetails(typing.ETime, ext.TimestampNTZKindType, ext.RFC3339NanosecondNoTZ), NanoTimestamp{}.ToKindDetails())
{
// Invalid conversion
_, err := NanoTimestamp{}.Convert("invalid")
12 changes: 6 additions & 6 deletions lib/debezium/schema_test.go
Original file line number Diff line number Diff line change
@@ -233,7 +233,7 @@ func TestField_ToKindDetails(t *testing.T) {
for _, dbzType := range []SupportedDebeziumType{ZonedTimestamp} {
kd, err := Field{DebeziumType: dbzType}.ToKindDetails()
assert.NoError(t, err)
assert.Equal(t, typing.OldNewExtendedTimeDetails(typing.ETime, ext.TimestampTZKindType, "2006-01-02T15:04:05.999999999Z"), kd)
assert.Equal(t, typing.MustNewExtendedTimeDetails(typing.ETime, ext.TimestampTZKindType, "2006-01-02T15:04:05.999999999Z"), kd)
}
}
{
@@ -250,7 +250,7 @@ func TestField_ToKindDetails(t *testing.T) {
for _, dbzType := range []SupportedDebeziumType{Date, DateKafkaConnect} {
kd, err := Field{DebeziumType: dbzType}.ToKindDetails()
assert.NoError(t, err)
assert.Equal(t, typing.OldNewExtendedTimeDetails(typing.ETime, ext.DateKindType, ext.PostgresDateFormat), kd)
assert.Equal(t, typing.MustNewExtendedTimeDetails(typing.ETime, ext.DateKindType, ext.PostgresDateFormat), kd)
}
}
{
@@ -259,28 +259,28 @@ func TestField_ToKindDetails(t *testing.T) {
for _, dbzType := range []SupportedDebeziumType{TimeWithTimezone} {
kd, err := Field{DebeziumType: dbzType}.ToKindDetails()
assert.NoError(t, err)
assert.Equal(t, typing.OldNewExtendedTimeDetails(typing.ETime, ext.TimeKindType, "15:04:05.999999Z"), kd, dbzType)
assert.Equal(t, typing.MustNewExtendedTimeDetails(typing.ETime, ext.TimeKindType, "15:04:05.999999Z"), kd, dbzType)
}
}
{
// Time
for _, dbzType := range []SupportedDebeziumType{Time, TimeKafkaConnect} {
kd, err := Field{DebeziumType: dbzType}.ToKindDetails()
assert.NoError(t, err)
assert.Equal(t, typing.OldNewExtendedTimeDetails(typing.ETime, ext.TimeKindType, "15:04:05.000"), kd, dbzType)
assert.Equal(t, typing.MustNewExtendedTimeDetails(typing.ETime, ext.TimeKindType, "15:04:05.000"), kd, dbzType)
}
}
{
// Micro time
kd, err := Field{DebeziumType: MicroTime}.ToKindDetails()
assert.NoError(t, err)
assert.Equal(t, typing.OldNewExtendedTimeDetails(typing.ETime, ext.TimeKindType, "15:04:05.000000"), kd)
assert.Equal(t, typing.MustNewExtendedTimeDetails(typing.ETime, ext.TimeKindType, "15:04:05.000000"), kd)
}
{
// Nano time
kd, err := Field{DebeziumType: NanoTime}.ToKindDetails()
assert.NoError(t, err)
assert.Equal(t, typing.OldNewExtendedTimeDetails(typing.ETime, ext.TimeKindType, "15:04:05.000000000"), kd)
assert.Equal(t, typing.MustNewExtendedTimeDetails(typing.ETime, ext.TimeKindType, "15:04:05.000000000"), kd)
}
}
{
8 changes: 4 additions & 4 deletions lib/destination/ddl/ddl_sflk_test.go
Original file line number Diff line number Diff line change
@@ -51,7 +51,7 @@ func (d *DDLTestSuite) TestAlterComplexObjects() {

func (d *DDLTestSuite) TestAlterIdempotency() {
cols := []columns.Column{
columns.NewColumn("created_at", typing.OldNewExtendedTimeDetails(typing.ETime, ext.TimestampTZKindType, "")),
columns.NewColumn("created_at", typing.MustNewExtendedTimeDetails(typing.ETime, ext.TimestampTZKindType, "")),
columns.NewColumn("id", typing.Integer),
columns.NewColumn("order_name", typing.String),
columns.NewColumn("start", typing.String),
@@ -81,7 +81,7 @@ func (d *DDLTestSuite) TestAlterIdempotency() {
func (d *DDLTestSuite) TestAlterTableAdd() {
// Test adding a bunch of columns
cols := []columns.Column{
columns.NewColumn("created_at", typing.OldNewExtendedTimeDetails(typing.ETime, ext.TimestampTZKindType, "")),
columns.NewColumn("created_at", typing.MustNewExtendedTimeDetails(typing.ETime, ext.TimestampTZKindType, "")),
columns.NewColumn("id", typing.Integer),
columns.NewColumn("order_name", typing.String),
columns.NewColumn("start", typing.String),
@@ -123,7 +123,7 @@ func (d *DDLTestSuite) TestAlterTableAdd() {
func (d *DDLTestSuite) TestAlterTableDeleteDryRun() {
// Test adding a bunch of columns
cols := []columns.Column{
columns.NewColumn("created_at", typing.OldNewExtendedTimeDetails(typing.ETime, ext.TimestampTZKindType, "")),
columns.NewColumn("created_at", typing.MustNewExtendedTimeDetails(typing.ETime, ext.TimestampTZKindType, "")),
columns.NewColumn("id", typing.Integer),
columns.NewColumn("name", typing.String),
columns.NewColumn("start", typing.String),
@@ -180,7 +180,7 @@ func (d *DDLTestSuite) TestAlterTableDeleteDryRun() {
func (d *DDLTestSuite) TestAlterTableDelete() {
// Test adding a bunch of columns
cols := []columns.Column{
columns.NewColumn("created_at", typing.OldNewExtendedTimeDetails(typing.ETime, ext.TimestampTZKindType, "")),
columns.NewColumn("created_at", typing.MustNewExtendedTimeDetails(typing.ETime, ext.TimestampTZKindType, "")),
columns.NewColumn("id", typing.Integer),
columns.NewColumn("name", typing.String),
columns.NewColumn("col_to_delete", typing.String),
14 changes: 7 additions & 7 deletions lib/optimization/table_data_merge_columns_test.go
Original file line number Diff line number Diff line change
@@ -14,9 +14,9 @@ func TestTableData_UpdateInMemoryColumnsFromDestination_Tz(t *testing.T) {
{
// In memory and destination columns are both timestamp_tz
tableData := &TableData{inMemoryColumns: &columns.Columns{}}
tableData.AddInMemoryCol(columns.NewColumn("foo", typing.OldNewExtendedTimeDetails(typing.ETime, ext.TimestampTZKindType, "")))
tableData.AddInMemoryCol(columns.NewColumn("foo", typing.MustNewExtendedTimeDetails(typing.ETime, ext.TimestampTZKindType, "")))

assert.NoError(t, tableData.MergeColumnsFromDestination(columns.NewColumn("foo", typing.OldNewExtendedTimeDetails(typing.ETime, ext.TimestampTZKindType, ""))))
assert.NoError(t, tableData.MergeColumnsFromDestination(columns.NewColumn("foo", typing.MustNewExtendedTimeDetails(typing.ETime, ext.TimestampTZKindType, ""))))
updatedColumn, isOk := tableData.inMemoryColumns.GetColumn("foo")
assert.True(t, isOk)
assert.Equal(t, ext.TimestampTZKindType, updatedColumn.KindDetails.ExtendedTimeDetails.Type)
@@ -27,11 +27,11 @@ func TestTableData_UpdateInMemoryColumnsFromDestination_Tz(t *testing.T) {
tableData.AddInMemoryCol(
columns.NewColumn(
"foo",
typing.OldNewExtendedTimeDetails(typing.ETime, ext.TimestampNTZKindType, ext.RFC3339MillisecondNoTZ),
typing.MustNewExtendedTimeDetails(typing.ETime, ext.TimestampNTZKindType, ext.RFC3339MillisecondNoTZ),
),
)

assert.NoError(t, tableData.MergeColumnsFromDestination(columns.NewColumn("foo", typing.OldNewExtendedTimeDetails(typing.ETime, ext.TimestampTZKindType, ""))))
assert.NoError(t, tableData.MergeColumnsFromDestination(columns.NewColumn("foo", typing.MustNewExtendedTimeDetails(typing.ETime, ext.TimestampTZKindType, ""))))
updatedColumn, isOk := tableData.inMemoryColumns.GetColumn("foo")
assert.True(t, isOk)
assert.Equal(t, ext.TimestampTZKindType, updatedColumn.KindDetails.ExtendedTimeDetails.Type)
@@ -137,9 +137,9 @@ func TestTableData_UpdateInMemoryColumnsFromDestination(t *testing.T) {
assert.Nil(t, col.KindDetails.ExtendedTimeDetails, extTimeDetailsCol)
}

assert.NoError(t, tableData.MergeColumnsFromDestination(columns.NewColumn("ext_time", typing.OldNewExtendedTimeDetails(typing.ETime, ext.TimeKindType, ""))))
assert.NoError(t, tableData.MergeColumnsFromDestination(columns.NewColumn("ext_date", typing.OldNewExtendedTimeDetails(typing.ETime, ext.DateKindType, ""))))
assert.NoError(t, tableData.MergeColumnsFromDestination(columns.NewColumn("ext_datetime", typing.OldNewExtendedTimeDetails(typing.ETime, ext.TimestampTZKindType, ""))))
assert.NoError(t, tableData.MergeColumnsFromDestination(columns.NewColumn("ext_time", typing.MustNewExtendedTimeDetails(typing.ETime, ext.TimeKindType, ""))))
assert.NoError(t, tableData.MergeColumnsFromDestination(columns.NewColumn("ext_date", typing.MustNewExtendedTimeDetails(typing.ETime, ext.DateKindType, ""))))
assert.NoError(t, tableData.MergeColumnsFromDestination(columns.NewColumn("ext_datetime", typing.MustNewExtendedTimeDetails(typing.ETime, ext.TimestampTZKindType, ""))))

dateCol, isOk := tableData.inMemoryColumns.GetColumn("ext_date")
assert.True(t, isOk)
6 changes: 3 additions & 3 deletions lib/optimization/table_data_test.go
Original file line number Diff line number Diff line change
@@ -133,7 +133,7 @@ func TestTableData_UpdateInMemoryColumns(t *testing.T) {
"FOO": typing.String,
"bar": typing.Invalid,
"CHANGE_me": typing.String,
"do_not_change_format": typing.OldNewExtendedTimeDetails(typing.ETime, ext.DateKindType, ""),
"do_not_change_format": typing.MustNewExtendedTimeDetails(typing.ETime, ext.DateKindType, ""),
} {
_cols.AddColumn(columns.NewColumn(colName, colKind))
}
@@ -150,9 +150,9 @@ func TestTableData_UpdateInMemoryColumns(t *testing.T) {

for name, colKindDetails := range map[string]typing.KindDetails{
"foo": typing.String,
"change_me": typing.OldNewExtendedTimeDetails(typing.ETime, ext.TimestampTZKindType, ""),
"change_me": typing.MustNewExtendedTimeDetails(typing.ETime, ext.TimestampTZKindType, ""),
"bar": typing.Boolean,
"do_not_change_format": typing.OldNewExtendedTimeDetails(typing.ETime, ext.TimestampTZKindType, ""),
"do_not_change_format": typing.MustNewExtendedTimeDetails(typing.ETime, ext.TimestampTZKindType, ""),
} {
tableData.MergeColumnsFromDestination(columns.NewColumn(name, colKindDetails))
}