Skip to content

Commit 3ef9492

Browse files
committed
Add more details on how to use the Java client
1 parent b5aed0e commit 3ef9492

File tree

2 files changed

+53
-3
lines changed

2 files changed

+53
-3
lines changed

docs/user_guides/integrations/java.md

+52-3
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@ description: Documentation on how to connect to Hopsworks from a Java client.
44

55
# Java client
66

7-
This guide explains step by step how to connect to Hopsworks from a Java client.
8-
7+
Starting from version 3.9.0-RC13, HSFS provides a pure Java client. This guide explains how to use the client to connect to Hopsworks and read or write feature data.
98

109
## Generate an API key
1110

@@ -16,6 +15,40 @@ For instructions on how to generate an API key follow this [user guide](../proje
1615
3. job
1716
4. kafka
1817

18+
## Add the HSFS dependency to your project:
19+
20+
The HSFS library is available on the Hopsworks' Maven repository. If you are using Maven as build tool, you can add the following in your pom.xml file:
21+
22+
```xml
23+
<repositories>
24+
<repository>
25+
<id>Hops</id>
26+
<name>Hops Repository</name>
27+
<url>https://archiva.hops.works/repository/Hops/</url>
28+
<releases>
29+
<enabled>true</enabled>
30+
</releases>
31+
<snapshots>
32+
<enabled>true</enabled>
33+
</snapshots>
34+
</repository>
35+
</repositories>
36+
```
37+
38+
The artifactId for the HSFS Java build is hsfs, if you are using Maven as build tool, you can add the following dependency:
39+
40+
```xml
41+
<dependency>
42+
<groupId>com.logicalclocks</groupId>
43+
<artifactId>hsfs</artifactId>
44+
<version>${hsfs.version}</version>
45+
</dependency>
46+
```
47+
48+
!!!note "Java Version"
49+
50+
Please note that the Java client has been tested with Java versions up to Java 17
51+
1952
## Connecting to the Feature Store
2053

2154
You are now ready to connect to the Hopsworks Feature Store from a Java client:
@@ -47,5 +80,21 @@ List<Object> singleVector = fv.getFeatureVector(new HashMap<String, Object>() {{
4780
}});
4881
```
4982

83+
### Update feature data
84+
85+
The Java client allows you to update data on existing feature groups using the streaming interface. You can provide a list of POJO objects to the [insertStream](https://docs.hopsworks.ai/feature-store-api/{{{ hopsworks_version }}}/javadoc/com/logicalclocks/hsfs/StreamFeatureGroup.html#insertStream-java.util.List-) method.
86+
87+
The feature group should exists already (can be created using the Python client) and the POJO objects should be serializable with the feature group's AVRO schema.
88+
89+
Please see the [tutorial](https://github.com/logicalclocks/hopsworks-tutorials/tree/master/integrations/java/java) for a code example on how to write data.
90+
91+
### Limitations
92+
93+
Currently using the Java client to retrieve feature vectors have the following limitations:
94+
95+
* Only the SQL interface is supported. It is not possible to retrieve feature vectors using the REST API Interface
96+
* Feature Views with model dependent transformations attached are not applied. If your feature view has model dependent transformations, please use the Python client.
97+
5098
## Next Steps
51-
For more information how to interact from Java client with the Hopsworks Feature store follow this [tutorial](https://github.com/logicalclocks/hopsworks-tutorials/tree/java_engine/java).
99+
100+
You can find more information on how to interact from Java client in the [JavaDoc](https://docs.hopsworks.ai/feature-store-api/{{{ hopsworks_version }}}/javadoc/) or this [tutorial](https://github.com/logicalclocks/hopsworks-tutorials/tree/master/integrations/java/java)

mkdocs.yml

+1
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,7 @@ nav:
119119
- Apache Spark: user_guides/integrations/spark.md
120120
- Apache Flink: user_guides/integrations/flink.md
121121
- Apache Beam: user_guides/integrations/beam.md
122+
- Java: user_guides/integrations/java.md
122123
- Sharing: user_guides/fs/sharing/sharing.md
123124
- Tags: user_guides/fs/tags/tags.md
124125
- Provenance: user_guides/fs/provenance/provenance.md

0 commit comments

Comments
 (0)