【问题标题】:Parsing avro schema drops logicalType解析 avro 模式会丢弃logicalType
【发布时间】:2021-03-10 18:10:37
【问题描述】:

我正在使用 Apache.Avro 1.10.1,并尝试在运行时生成架构。

在解析模式时出现,某些信息被丢弃。在下面的简单示例中,字段“something”有一个logicalType 集。但是,在将解析后的模式转换回字符串时,缺少此信息。

    static void Main(string[] args)
    {
        const string txt = @"
        {
            ""type"": ""record"",
            ""namespace"": ""test"",
            ""name"": ""Type1"",
            ""fields"": [
                {
                    ""name"": ""something"",
                    ""type"": ""int"",
                    ""logicalType"": ""date""
                }
            ]
        }
        ";

        var schema = Avro.Schema.Parse(txt);
        var str = schema.ToString();
        // str has the following value, i.e. is missing logicalType:
        // {"type":"record","name":"Type1","namespace":"test","fields":[{"name":"something","type":"int"}]}
    }
}

以前有人遇到过这种情况吗?

我不完全确定这是我的使用错误,还是库本身的错误。

【问题讨论】:

    标签: c# avro


    【解决方案1】:

    这似乎是一个已知的错误,多年来没有任何吸引力。见https://issues.apache.org/jira/browse/AVRO-1556

    【讨论】:

    • 感谢 Scott,很高兴知道这一点(同样令人沮丧)!我可能会再次离开 Avro,这对其实施的总体健康状况不利
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-08-28
    • 2018-11-26
    • 1970-01-01
    • 2018-03-22
    • 1970-01-01
    • 2017-03-28
    相关资源
    最近更新 更多