This is an automated email from the ASF dual-hosted git repository.
chaokunyang pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/fory.git
The following commit(s) were added to refs/heads/main by this push:
new f97d9dc9 docs: add row format guide for ext and interface types (#2346)
f97d9dc9 is described below
commit f97d9dc975723e5529e04a8309815704c6332147
Author: Nabil Shafi <[email protected]>
AuthorDate: Wed Jun 18 17:24:00 2025 +0500
docs: add row format guide for ext and interface types (#2346)
## What does this PR do?
This PR adds documentation to `row_format_guide.md` for recent
enhancements that support Java `interface` types and class inheritance
(`extends`) in row format mapping.
The update includes code examples demonstrating how to register
interface mappings and superclass support using Fury's Java API.
## Related issues
- #2310
- [#2243](https://github.com/apache/fory/pull/2243)
- [#2250](https://github.com/apache/fory/pull/2250)
- [#2256](https://github.com/apache/fory/pull/2256)
## Does this PR introduce any user-facing change?
Yes. It introduces user-facing documentation explaining how to use
interface and extension types with row encoding in Java.
---------
Co-authored-by: nabil.shafi <[email protected]>
---
docs/guide/row_format_guide.md | 53 ++++++++++++++++++++++++++++++++++++++++++
1 file changed, 53 insertions(+)
diff --git a/docs/guide/row_format_guide.md b/docs/guide/row_format_guide.md
index 5d739e80..f48ee5c2 100644
--- a/docs/guide/row_format_guide.md
+++ b/docs/guide/row_format_guide.md
@@ -116,6 +116,59 @@ for (int i = 0; i < 10; i++) {
return arrowWriter.finishAsRecordBatch();
```
+### Support for Interface and Extension Types
+
+Fury now supports row format mapping for Java `interface` types and subclassed
(`extends`) types, enabling more dynamic and flexible data schemas.
+
+These enhancements were introduced in
[#2243](https://github.com/apache/fury/pull/2243),
[#2250](https://github.com/apache/fury/pull/2250), and
[#2256](https://github.com/apache/fury/pull/2256).
+
+#### Example: Interface Mapping with RowEncoder
+
+```java
+public interface Animal {
+ String speak();
+}
+
+public class Dog implements Animal {
+ public String name;
+
+ @Override
+ public String speak() {
+ return "Woof";
+ }
+}
+
+// Encode and decode using RowEncoder with interface type
+RowEncoder<Animal> encoder = Encoders.bean(Animal.class);
+Dog dog = new Dog();
+dog.name = "Bingo";
+BinaryRow row = encoder.toRow(dog);
+Animal decoded = encoder.fromRow(row);
+System.out.println(decoded.speak()); // Woof
+
+```
+
+#### Example: Extension Type with RowEncoder
+
+```java
+public class Parent {
+ public String parentField;
+}
+
+public class Child extends Parent {
+ public String childField;
+}
+
+// Encode and decode using RowEncoder with parent class type
+RowEncoder<Parent> encoder = Encoders.bean(Parent.class);
+Child child = new Child();
+child.parentField = "Hello";
+child.childField = "World";
+BinaryRow row = encoder.toRow(child);
+Parent decoded = encoder.fromRow(row);
+
+```
+
Python:
```python
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]