[ 
https://issues.apache.org/jira/browse/FLINK-30483?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17651147#comment-17651147
 ] 

Mingliang Liu commented on FLINK-30483:
---------------------------------------

Sample code:
{code:java}
  public static void main(String[] args) {
    final TableEnvironment tableEnv =
        TableEnvironment.create(EnvironmentSettings.inStreamingMode());
    tableEnv.executeSql(
        "CREATE TABLE SinkTable(ts TIMESTAMP_LTZ(3)) "
            + "WITH ('connector' = 'filesystem', 'path' = 
'/tmp/flink-avro-test', 'format' = 'avro')");
    tableEnv.executeSql("INSERT INTO SinkTable VALUES (PROCTIME())");
    tableEnv.executeSql("SELECT *  FROM SinkTable").print();
  }
{code}
will get following exception:
{code}
Exception in thread "main" java.lang.UnsupportedOperationException: Unsupported 
to derive Schema for type: TIMESTAMP_LTZ(3)
        at 
org.apache.flink.formats.avro.typeutils.AvroSchemaConverter.convertToSchema(AvroSchemaConverter.java:429)
        at 
org.apache.flink.formats.avro.typeutils.AvroSchemaConverter.convertToSchema(AvroSchemaConverter.java:400)
        at 
org.apache.flink.formats.avro.typeutils.AvroSchemaConverter.convertToSchema(AvroSchemaConverter.java:306)
{code}

> Make Avro format support for TIMESTAMP_LTZ
> ------------------------------------------
>
>                 Key: FLINK-30483
>                 URL: https://issues.apache.org/jira/browse/FLINK-30483
>             Project: Flink
>          Issue Type: Improvement
>          Components: Formats (JSON, Avro, Parquet, ORC, SequenceFile)
>    Affects Versions: 1.16.0
>            Reporter: Mingliang Liu
>            Priority: Major
>
> Currently Avro format does not support TIMESTAMP_LTZ (short for 
> TIMESTAMP_WITH_LOCAL_TIME_ZONE) type. Avro 1.10+ introduces local timestamp 
> logic type (both milliseconds and microseconds), see spec [1]. As TIMESTAMP 
> currently only supports milliseconds, we can make TIMESTAMP_LTZ support 
> milliseconds first.
> A related work is to support microseconds, and there is already 
> work-in-progress Jira FLINK-23589 for TIMESTAMP type. We can consolidate the 
> effort or track that separately for TIMESTAMP_LTZ.
> [1] 
> https://avro.apache.org/docs/1.10.2/spec.html#Local+timestamp+%28millisecond+precision%29



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to