Schema::empty() <https://github.com/apache/arrow/blob/8e43f23dcc6a9e630516228f110c48b64d13cec6/rust/arrow/src/datatypes/schema.rs#L43> serializes to "{\"fields\":[]}". Metadata is not present because of skip_serializing_if. This is the error that would be given if the above string is deserialized: Error("missing field `metadata`", line: 1, column: 13).
Jack Andrew Lamb <al...@influxdata.com> 於 2021年4月5日週一 上午3:36寫道: > Did the metadata successfully serialize with serde json (this is a little > unclear to me given your description). > > > I would expect that every schema can be serialized-deserialized back in > itself. > > I have the same expectation. > > If metadata can't be serialized with serde_json that would seem like a bug > to me and I think the project would appreciate help fixing it. > > Thanks, > Andrew > > On Sun, Apr 4, 2021 at 10:40 AM Jack Chan <j4ck....@gmail.com> wrote: > > > Indeed, I did, with both serde json and dynamodb. Inside an arrow schema, > > the metadata field is a hashmap with skip serializing if empty. When > > deserializing, it expects a metadata field. I would expect that every > > schema can be serialized-deserialized back in itself. > > > > Jack > > > > On Sat, Apr 3, 2021, 10:59 AM Andrew Lamb <al...@influxdata.com> wrote: > > > > > This looks like a rust program. Perhaps you could try using > `serde_json` > > or > > > some other format to narrow down where the issue is > > > > > > On Fri, Apr 2, 2021 at 10:00 PM Jack Chan <j4ck....@gmail.com> wrote: > > > > > > > Hi > > > > > > > > I tried to serialize and deserialize an arrow schema, but I got into > an > > > > error of > > > > (Error { message: "missing field `metadata`" }). Is this a bug in > > apache > > > > arrow or in serde_dynamodb? > > > > > > > > ``` > > > > let schema = ArrowSchema::empty(); > > > > let object = serde_dynamodb::to_hashmap(&schema)?; > > > > let roundtrip: ArrowSchema = > > > serde_dynamodb::from_hashmap(object)?; > > > > assert_eq!(roundtrip, schema); > > > > ``` > > > > > > > > Jack > > > > > > > > > >