Skip to content

Commit 7095ee8

Browse files
committed
example for avro logicalType
1 parent 98d2991 commit 7095ee8

File tree

1 file changed

+32
-5
lines changed

1 file changed

+32
-5
lines changed

docs/proton-format-schema.md

Lines changed: 32 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -292,15 +292,42 @@ The table below shows supported Avro primitive data types and how they match Tim
292292

293293
### Avro Logical Types
294294

295-
Here is a list of supported logical types:
295+
If you use `logicalType` in your Avro schema, Timeplus will automatically map it to the corresponding Timeplus data type:
296296

297-
* UUID: maps to uuid.
298-
* Date: maps to date.
299-
* Timestamp (millisecond precision): maps to datetime64(3).
300-
* Timestamp (microsecond precision): maps to datetime64(6).
297+
- UUID: maps to `uuid`.
298+
- Date: maps to `date`.
299+
- Timestamp (millisecond precision): maps to `datetime64(3)`.
300+
- Timestamp (microsecond precision): maps to `datetime64(6)`.
301301

302302
Other logical types are not implemented yet.
303303

304+
For example, given the following Avro schema:
305+
306+
```json
307+
{
308+
"type": "record",
309+
"name": "schema",
310+
"fields": [
311+
{
312+
"name": "time",
313+
"type": { "type": "long", "logicalType": "timestamp-millis" }
314+
},
315+
{ "name": "key", "type": "string" },
316+
{ "name": "value", "type": "double" }
317+
]
318+
}
319+
```
320+
321+
The external stream uses tuple will be like this:
322+
323+
```sql
324+
CREATE EXTERNAL STREAM avro (
325+
time datetime64(3),
326+
key string,
327+
value float64
328+
) SETTINGS ...;
329+
```
330+
304331
### record
305332
There are two ways to map a `record`. The simple one is using `tuple`. Here is an example:
306333

0 commit comments

Comments
 (0)