-
Notifications
You must be signed in to change notification settings - Fork 310
Support for logical datatypes like Decimal type #121
base: master
Are you sure you want to change the base?
Conversation
Current coverage is
|
In addition to adding support for DateType, this fix is important to be able to read and write logical types in spark-bigquery. To fully incorporate logical types, the logicalType attribute should be set for all logical types in convertTypeToAvro() when building Avro schema. |
@cpbhagtani i.e. to support this schema:
|
@progrexor , No currently we are sending decimal as string type with logical type. |
Any plans on updating this code compatible to updated version of spark-avro. i.e Resolve the branch conflicts to support spark-avro 3.2.0 |
I am also interested in this issue. You decided on correct approach of fixes in pull request and only problem is that they currently do not merge cleanly? |
Hi, Sorry for asking same question again. Thanks, |
@karthikkadiyam I will make my PR compatible with 3.2.0 soon |
@hsn10 my PR is compatible with branch 2.0. I will try to make it compatible with 3.0 |
@alind-billore decimal is already supported in my PR through avro logical type. bytes is not supported. |
@cpbhagtani Thanks a lot for your reply ! :) |
@cpbhagtani Any update on when can we expect this PR to be compatible with 3.2 . I tried it myself but ran through some runtime exceptions and couldn't fix them. |
In Avro spec:
@cpbhagtani Can you update this PR? I will follow it. |
Should also link to following, related, more recent PR (even if closed): #291 |
Avro doesn't support very big numbers directly. It supports it through logicalTypes where you can specify value as string type but send the actual data type of the field as logicalType. Following is the example of a decimal type
{"type": "record",
"name": "test",
"fields" : [
{"name": "a","type": "string",
"logicalType": "decimal",
"precision": 4,
"scale": 2
},
{"name": "b", "type": "string"}
]}
This pull request add support for reading such datatype. For now I have added only decimal type, but we can add more logicalTypes. In dataframe it actually appears as decimal(4,2) type.