linkedin / linkedin/goavro

Automatic dynamic type conversion

Open
#230 1 comment 0 reactions 0 assignees View on GitHub

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

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.