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

keyField fetching raises error #137

Closed
mkcode92 opened this issue Nov 2, 2022 · 0 comments · Fixed by #138
Closed

keyField fetching raises error #137

mkcode92 opened this issue Nov 2, 2022 · 0 comments · Fixed by #138
Assignees
Labels
component/gateway type/bug Something isn't working

Comments

@mkcode92
Copy link
Contributor

mkcode92 commented Nov 2, 2022

Issue description

On migrating the quick-example profile-store from 0.7.0 to 0.8.0 the keyArgument functionality is broken.
The relevant part of the schema is:

type Query {
    getUserProfile(userId: Long!): UserProfile
}

type UserProfile {
    artistCharts: NamedArtistCharts! @topic(name: "lastlisten", keyArgument: "userId")
    ...
}

type NamedArtistCharts {
    topK: [NamedArtistCount!]!
}

type NamedArtistCount {
    id: Long!
    count: Long!
    # here
    artist: Item! @topic(name: "artists", keyField: "id")
}

type Item {
    id: Long!
    name: String!
}

The following Query

# Q1
query {
 getUserProfile(userId: 21072247) {
   artistCharts {
     topK {
       artist {
        name 
}}}}}

causes the following exception in the gateway:

WARN notprivacysafe.graphql.execution.SimpleDataFetcherExceptionHandler - Exception while fetching data (/getUserProfile/artistCharts/topK[9]/artist) : class java.lang.Integer cannot be cast to class java.lang.Long (java.lang.Integer and java.lang.Long are in module java.base of loader 'bootstrap')
java.lang.ClassCastException: class java.lang.Integer cannot be cast to class java.lang.Long (java.lang.Integer and java.lang.Long are in module java.base of loader 'bootstrap')
    at org.apache.kafka.common.serialization.LongSerializer.serialize(LongSerializer.java:19)
    at com.bakdata.quick.common.api.client.routing.PartitionRouter.findHost(PartitionRouter.java:83)
    at com.bakdata.quick.common.api.client.mirror.PartitionedMirrorClient.fetchValue(PartitionedMirrorClient.java:63)
    at com.bakdata.quick.gateway.fetcher.MirrorDataFetcherClient.fetchResult(MirrorDataFetcherClient.java:44)
    at com.bakdata.quick.gateway.fetcher.KeyFieldFetcher.get(KeyFieldFetcher.java:97)
...

Expected Behavior

Q1 should return an array of objects under the topK-field. The project is set up such that each id has a record in the "artists"-topic.

Current Behavior

The gateway throws exceptions that are propagated to the query result.

Steps to Reproduce

Deploy the profile-store example using quick-0.8.0. Execute Q1.

Detailed Description

  • To exclude other causes, notice that the following query works
# Q2
query {
 getUserProfile(userId: 21072247) {
   artistCharts {
     topK {
       id
}}}}
  • Also, all ids obtained with Q2 are present in the artists topic, which can be verified on the mirror endpoint.
    In an earlier deployment, the error was null, but this could not be reproduced
@raminqaf raminqaf added type/bug Something isn't working component/gateway labels Nov 2, 2022
@raminqaf raminqaf self-assigned this Nov 3, 2022
@raminqaf raminqaf added this to Quick Nov 3, 2022
@raminqaf raminqaf moved this to In-Review in Quick Nov 3, 2022
Repository owner moved this from In-Review to Done in Quick Nov 30, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component/gateway type/bug Something isn't working
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

2 participants