theweipeng commented on code in PR #1825:
URL: https://github.com/apache/fury/pull/1825#discussion_r1779362374
##########
javascript/packages/fury/lib/gen/object.ts:
##########
@@ -111,8 +107,9 @@ class ObjectSerializerGenerator extends
BaseSerializerGenerator {
return `${CodecBuilder.safePropName(key)}: null`;
}).join(",\n")}
};
+
${this.maybeReference(result, refState)}
- ${this.builder.reader.buffer(encodedMetaInformation.byteLength)}
+ ${this.builder.typeMeta.fromBytes(this.builder.reader.ownName())}
Review Comment:
If it's SchemaConsistent, you can't read typeMeta.
##########
javascript/packages/fury/lib/gen/object.ts:
##########
@@ -80,11 +70,18 @@ class ObjectSerializerGenerator extends
BaseSerializerGenerator {
writeStmt(accessor: string): string {
const options = this.description.options;
const expectHash = computeStructHash(this.description);
- const metaInformation =
Buffer.from(computeMetaInformation(this.description));
+ // const metaInformation =
Buffer.from(computeMetaInformation(this.description));
+ const fields = Object.entries(this.description).map(([key, value]) => {
+ return new FieldInfo(key, value.type);
+ });
+ const typeMetaBinary = new Uint8Array(TypeMeta.fromFields(256,
fields).toBytes());
+ const typeMetaDeclare = this.scope.declare("typeMeta", `new
Uint8Array([${typeMetaBinary.toString()}])`);
return `
${this.builder.writer.int32(expectHash)};
-
${this.builder.writer.buffer(`Buffer.from("${metaInformation.toString("base64")}",
"base64")`)};
+
+ ${this.builder.writer.buffer(typeMetaDeclare)};
Review Comment:
If it's SchemaConsistent, you can't write typeMeta for the same reason
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]