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

Cast$Value doesn't transform String to Float64 #41

Open
mmowris opened this issue Jul 11, 2022 · 0 comments
Open

Cast$Value doesn't transform String to Float64 #41

mmowris opened this issue Jul 11, 2022 · 0 comments

Comments

@mmowris
Copy link

mmowris commented Jul 11, 2022

Problem

I'm using Kafka to take data from SQL Server and insert into Postgres - the issue is with billinglatitude [nvarchar] to billinglatitude [double precision].

I've tried to use Cast$Value to turn SQL Server '26.116184' to float64, but the column still comes across as a string. I can correctly cast SQL Server booleans [0, 1] to postgres [false, true].. how can I accomplish this for string -> double precision??

Attempt to Solve

I've tried to use billinglatitude:float64 and billinglatitude:float32, but the value still comes across as a string:

# Connector excerpt
  "transforms.castColumnsAccount.type": "org.apache.kafka.connect.transforms.Cast$Value",
  "transforms.castColumnsAccount.spec": "accepts_pos__c:boolean,billinglatitude:float32,billinglongitude:float64,biz_indicator__c:float64",
  "transforms.castColumnsAccount.predicates": "account",

# boolean cast, but nothing else cast...
"accepts_pos__c": false, # before cast: 0
"billinglatitude": "39.946713",
"billinglongitude": "-74.352108",
"biz_indicator__c": "2",

Reference docs

The Cast$Value documentation shows you can work with primitive types - string is a primitive type, so how can I take the string and cast it to a float??

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant