Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support passing nested structures as tuples #30

Open
akudiyar opened this issue Mar 9, 2021 · 2 comments
Open

Support passing nested structures as tuples #30

akudiyar opened this issue Mar 9, 2021 · 2 comments
Labels

Comments

@akudiyar
Copy link
Collaborator

akudiyar commented Mar 9, 2021

Currently, nested structures may be passed only as maps (despite whether the structure is a simple object or an entity). This may be not efficient in case if the structures are merged as a result of a map-reduce operation resembling a "join", especially in the case of collections of structures, since it requires using "tomap" operation on each tuple corresponding to a nested structure.

We need to provide a way for deserializing nested structures from tuples.

Possible solution:

Allow specifying the serialized source type for the object fields that contain nested structures with some kind of annotation (e.g. @Field(serialize = TarantoolSerializationType.TUPLE))

@akudiyar akudiyar added enhancement New feature or request waiting for analysis labels Mar 9, 2021
@akudiyar akudiyar added this to the Q1 2021 milestone Mar 9, 2021
@vrogach2020 vrogach2020 removed this from the Q1 2021 milestone Sep 14, 2021
@ArtDu
Copy link
Contributor

ArtDu commented Dec 16, 2021

Is it possible somehow through the Repository/Query interface to put a non-nested interface like list/tuple?
I could not send the non-nested structure to the Tarantool as a list/tuple

@Data
@Builder
public class System {
    @Id
    @Field("id")
    private Integer id;

    @Field("name")
    private String name;

    @Field("response_needed")
    private Boolean responseNeeded;

    @Field("check_sender_bic_needed")
    private Boolean checkSenderBicNeeded;

    @Field("duplicate_check_needed")
    private Integer duplicateCheckNeeded;

    @Field("aggregation_needed")
    private Boolean aggregationNeeded;

    @Field("unpacking_needed")
    private Boolean unpackingNeeded;

    @Field("message_priority")
    private String messagePriority;

    @Field("bic_mask")
    private List<?> bicMask;

    @Field("enabled")
    private Boolean enabled;
}
@Tuple("system")
public interface SystemRepository extends TarantoolRepository<System, Integer> {
    @Query(function = "get_system")
    Optional<System> getSystem(Integer id);

    @Query(function = "replace_system")
    Optional<System> replaceSystem(System system);

}
main/1175/main I> {"message_priority":"Hello","id":1,"response_needed":true,"bic_mask":"Arrays.asList(id, \"Hello\")","unpacking_needed":false,"duplicate_check_needed":1,"enabled":true,"check_sender_bic_needed":false,"name":"Hello","aggregation_needed":true}

@ArtDu
Copy link
Contributor

ArtDu commented Feb 3, 2022

In the comment above, I pointed out that I cannot pass an object in a function argument as a tuple without field keys, i.e. this will always be a Map(if the @Query method is used). And there is a wish to be able to transfer the list/tuple, since extra handover of keys affects the performance

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants