Automatic dynamic type conversion
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 1.1k
- Forks
- 232
- PR merge metrics
- No merged PRs in 30d
Description
## Background
We have a very specific use case where the data is in a CSV file and there is a separate file which stores avro schema.
We will have to convert the csv data into OCF format and send it out.
The problem we face is the CSV data is array of strings, and because of this the `BinaryFromNative` function returns type errors like
```
value does not match its schema: long: expected: Go numeric; received: string
```
### Schema
```avsc
{
"type": "record",
"name": "example",
"fields": [
{
"name": "customer",
"type": "long",
"default": 0
}
]
}
```
### Data
```go
map[string]interface{}{
"customer": "12323423",
}
```
## Feature request
1. Can we auto parse string to a type required by the avro schema at run time?
2. Also if a data is not present(empty string) default value must be populated
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading the BinaryFromNative implementation and the schema-validation path that produces the reported type error. Clarify how runtime conversion should cover CSV strings and how empty strings interact with Avro defaults. Done means schema-compatible encoding for the requested conversions and default population, with tests for the long example and empty input.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- backend
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100