Skip to content

Commit

Permalink
Merge branch 'master' into address-redshift-data-type-todo
Browse files Browse the repository at this point in the history
  • Loading branch information
Tang8330 authored Jun 28, 2024
2 parents adf121b + d70185f commit 5f119d8
Show file tree
Hide file tree
Showing 8 changed files with 16 additions and 26 deletions.
8 changes: 2 additions & 6 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
project_name: artie-transfer

# .goreleaser.yaml
version: 2

before:
hooks:
# You may remove this if you don't use go modules.
Expand Down Expand Up @@ -66,8 +67,3 @@ changelog:
exclude:
- '^docs:'
- '^test:'

# The lines beneath this are called `modelines`. See `:help modeline`
# Feel free to remove those if you don't want/use them.
# yaml-language-server: $schema=https://goreleaser.com/static/schema.json
# vim: set ts=2 sw=2 tw=0 fo=cnqoj
14 changes: 0 additions & 14 deletions Dockerfile

This file was deleted.

4 changes: 2 additions & 2 deletions clients/bigquery/storagewrite.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import (
"google.golang.org/protobuf/types/known/timestamppb"
)

// columnToTableFieldSchema returns a [*storagepb.TableFieldSchema] suitable for transfering data of the type that the column specifies.
// columnToTableFieldSchema returns a [*storagepb.TableFieldSchema] suitable for transferring data of the type that the column specifies.
// Not that the data type is not necessarily the data type that the table in the database is using.
func columnToTableFieldSchema(column columns.Column) (*storagepb.TableFieldSchema, error) {
var fieldType storagepb.TableFieldSchema_Type
Expand Down Expand Up @@ -150,7 +150,7 @@ func rowToMessage(row map[string]any, columns []columns.Column, messageDescripto
}
message.Set(field, protoreflect.ValueOfFloat64(floatValue))
default:
return nil, fmt.Errorf("expected float32/float64/int32/int64/string recieved %T with value %v", value, value)
return nil, fmt.Errorf("expected float32/float64/int32/int64/string received %T with value %v", value, value)
}
case typing.EDecimal.Kind:
if decimalValue, ok := value.(*decimal.Decimal); ok {
Expand Down
2 changes: 1 addition & 1 deletion clients/mssql/dialect/dialect.go
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ func (MSSQLDialect) IsTableDoesNotExistErr(err error) bool {
}

func (MSSQLDialect) BuildCreateTableQuery(tableID sql.TableIdentifier, _ bool, colSQLParts []string) string {
// Microsoft SQL Server uses the same syntax for temporary and permanant tables.
// Microsoft SQL Server uses the same syntax for temporary and permanent tables.
// Microsoft SQL Server doesn't support IF NOT EXISTS
return fmt.Sprintf("CREATE TABLE %s (%s);", tableID.FullyQualifiedName(), strings.Join(colSQLParts, ","))
}
Expand Down
2 changes: 1 addition & 1 deletion clients/redshift/dialect/dialect.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ func (RedshiftDialect) IsTableDoesNotExistErr(err error) bool {
}

func (RedshiftDialect) BuildCreateTableQuery(tableID sql.TableIdentifier, _ bool, colSQLParts []string) string {
// Redshift uses the same syntax for temporary and permanant tables.
// Redshift uses the same syntax for temporary and permanent tables.
return fmt.Sprintf("CREATE TABLE IF NOT EXISTS %s (%s);", tableID.FullyQualifiedName(), strings.Join(colSQLParts, ","))
}

Expand Down
2 changes: 1 addition & 1 deletion goreleaser.dockerfile
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
FROM --platform=linux/amd64 alpine:3.16
FROM --platform=linux/amd64 alpine:3.20
COPY transfer /transfer
2 changes: 1 addition & 1 deletion lib/config/constants/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const (
ToastUnavailableValuePlaceholder = "__debezium_unavailable_value"

// DebeziumTopicRoutingKey - https://debezium.io/documentation/reference/stable/transformations/topic-routing.html#by-logical-table-router-key-field-name
// This key is added to ensure no compaction or mutation happens since multiple tables are now going into the same topic and may have overlaping key ids.
// This key is added to ensure no compaction or mutation happens since multiple tables are now going into the same topic and may have overlapping key ids.
// We will strip this out from our partition key parsing.
DebeziumTopicRoutingKey = "__dbz__physicalTableIdentifier"

Expand Down
8 changes: 8 additions & 0 deletions lib/typing/decimal/details.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package decimal

import (
"fmt"
"log/slog"
)

const (
Expand All @@ -17,6 +18,13 @@ type Details struct {
}

func NewDetails(precision int32, scale int32) Details {
if precision == 0 {
// MySQL, PostgreSQL, and SQLServer do not allow a zero precision, so this should never happen.
// Let's log if we observe it happening, and if we don't see it in the logs then we can use zero as the
// [PrecisionNotSpecified] value and change precision to a uint16.
slog.Error("Decimal precision is zero")
}

if scale > precision && precision != PrecisionNotSpecified {
// Note: -1 precision means it's not specified.

Expand Down

0 comments on commit 5f119d8

Please sign in to comment.