Skip to content

Commit 98540e4

Browse files
committed
Support for VectorSeach
1 parent e9fff36 commit 98540e4

File tree

1 file changed

+25
-17
lines changed

1 file changed

+25
-17
lines changed

src/test/java/org/apache/beam/sdk/io/astra/db/vectorsearch/ProductMapperFactoryFn.java

Lines changed: 25 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -39,23 +39,31 @@ public AstraDbMapper<ProductDto> apply(CqlSession cqlSession) {
3939
.getProductDao(cqlSession.getKeyspace().get());
4040

4141
// Mapping to Serialize
42-
return new AstraDbMapper<ProductDto>() {
43-
44-
@Override
45-
public ProductDto mapRow(Row row) {
46-
return new ProductDto(dao.mapRow(row));
47-
}
48-
49-
@Override
50-
public CompletionStage<Void> deleteAsync(ProductDto entity) {
51-
return dao.deleteAsync(entity.toProduct());
52-
}
53-
54-
@Override
55-
public CompletionStage<Void> saveAsync(ProductDto entity) {
56-
return dao.saveAsync(entity.toProduct());
57-
}
58-
};
42+
return new AstraDbMapperDelegate(dao);
43+
}
44+
45+
public static class AstraDbMapperDelegate implements AstraDbMapper<ProductDto> {
46+
47+
ProductDao dao;
48+
49+
public AstraDbMapperDelegate(ProductDao dao) {
50+
this.dao = dao;
51+
}
52+
53+
@Override
54+
public ProductDto mapRow(Row row) {
55+
return new ProductDto(dao.mapRow(row));
56+
}
57+
58+
@Override
59+
public CompletionStage<Void> deleteAsync(ProductDto entity) {
60+
return dao.deleteAsync(entity.toProduct());
61+
}
62+
63+
@Override
64+
public CompletionStage<Void> saveAsync(ProductDto entity) {
65+
return dao.saveAsync(entity.toProduct());
66+
}
5967
}
6068

6169
}

0 commit comments

Comments
 (0)