org.apache.avro.generic.GenericData$Record cannot be cast to org.apache.kafka.streams.kstream.Windowed
up vote
-2
down vote
favorite
I am getting the error when trying to implement stream windowed aggregation
"org.apache.avro.generic.GenericData$Record cannot be cast to
org.apache.kafka.streams.kstream.Windowed"
where the record is GenericRecord and after the aggregation the record should be pushed to the topic as GenericRecord.
KStream<'GenericRecord, GenericRecord> streamAgg=builder.stream("Topic").groupByKey().windowedBy(TimeWindows.of(60*1000L)).aggregate(/initializer/, /aggregate/, Materialized.as("StoreName")).toStream().to("FinalTopic");
Here I am getting the record (key, value) as generic records and after aggregation I want to send it to the topic as Generic Records. I tried explicitly mentioning GenericAvroSerde and schema registry URL by passing through methods but none of it worked. Is it the error while casting GenericRecord to Windowed ? If, so how to rectify it?
java apache-kafka apache-kafka-streams
add a comment |
up vote
-2
down vote
favorite
I am getting the error when trying to implement stream windowed aggregation
"org.apache.avro.generic.GenericData$Record cannot be cast to
org.apache.kafka.streams.kstream.Windowed"
where the record is GenericRecord and after the aggregation the record should be pushed to the topic as GenericRecord.
KStream<'GenericRecord, GenericRecord> streamAgg=builder.stream("Topic").groupByKey().windowedBy(TimeWindows.of(60*1000L)).aggregate(/initializer/, /aggregate/, Materialized.as("StoreName")).toStream().to("FinalTopic");
Here I am getting the record (key, value) as generic records and after aggregation I want to send it to the topic as Generic Records. I tried explicitly mentioning GenericAvroSerde and schema registry URL by passing through methods but none of it worked. Is it the error while casting GenericRecord to Windowed ? If, so how to rectify it?
java apache-kafka apache-kafka-streams
3
You should provide more context, ie, code snippet what you are doing and which operation fails.
– Matthias J. Sax
Nov 20 at 5:59
Where is the question? :)
– Sarief
Nov 20 at 7:14
You are doing a windowed aggregation an the return type ofaggregate
isKTable<Windowed<K>,V>
-- it seems that you try to use aGenericData$Record
when it should be aWindowed<GenericData$Record>
. Hope this helps. Look at the full stack trace to see which operation causes the problem
– Matthias J. Sax
Nov 20 at 22:15
Yeah but how to cast it to Windowed. I tried in Materialized function by passing keyAvroSerde, valueAvroSerde in with function but same error.
– Sanju Bonela
Nov 26 at 10:31
add a comment |
up vote
-2
down vote
favorite
up vote
-2
down vote
favorite
I am getting the error when trying to implement stream windowed aggregation
"org.apache.avro.generic.GenericData$Record cannot be cast to
org.apache.kafka.streams.kstream.Windowed"
where the record is GenericRecord and after the aggregation the record should be pushed to the topic as GenericRecord.
KStream<'GenericRecord, GenericRecord> streamAgg=builder.stream("Topic").groupByKey().windowedBy(TimeWindows.of(60*1000L)).aggregate(/initializer/, /aggregate/, Materialized.as("StoreName")).toStream().to("FinalTopic");
Here I am getting the record (key, value) as generic records and after aggregation I want to send it to the topic as Generic Records. I tried explicitly mentioning GenericAvroSerde and schema registry URL by passing through methods but none of it worked. Is it the error while casting GenericRecord to Windowed ? If, so how to rectify it?
java apache-kafka apache-kafka-streams
I am getting the error when trying to implement stream windowed aggregation
"org.apache.avro.generic.GenericData$Record cannot be cast to
org.apache.kafka.streams.kstream.Windowed"
where the record is GenericRecord and after the aggregation the record should be pushed to the topic as GenericRecord.
KStream<'GenericRecord, GenericRecord> streamAgg=builder.stream("Topic").groupByKey().windowedBy(TimeWindows.of(60*1000L)).aggregate(/initializer/, /aggregate/, Materialized.as("StoreName")).toStream().to("FinalTopic");
Here I am getting the record (key, value) as generic records and after aggregation I want to send it to the topic as Generic Records. I tried explicitly mentioning GenericAvroSerde and schema registry URL by passing through methods but none of it worked. Is it the error while casting GenericRecord to Windowed ? If, so how to rectify it?
java apache-kafka apache-kafka-streams
java apache-kafka apache-kafka-streams
edited Nov 20 at 16:14
asked Nov 20 at 5:43
Sanju Bonela
11
11
3
You should provide more context, ie, code snippet what you are doing and which operation fails.
– Matthias J. Sax
Nov 20 at 5:59
Where is the question? :)
– Sarief
Nov 20 at 7:14
You are doing a windowed aggregation an the return type ofaggregate
isKTable<Windowed<K>,V>
-- it seems that you try to use aGenericData$Record
when it should be aWindowed<GenericData$Record>
. Hope this helps. Look at the full stack trace to see which operation causes the problem
– Matthias J. Sax
Nov 20 at 22:15
Yeah but how to cast it to Windowed. I tried in Materialized function by passing keyAvroSerde, valueAvroSerde in with function but same error.
– Sanju Bonela
Nov 26 at 10:31
add a comment |
3
You should provide more context, ie, code snippet what you are doing and which operation fails.
– Matthias J. Sax
Nov 20 at 5:59
Where is the question? :)
– Sarief
Nov 20 at 7:14
You are doing a windowed aggregation an the return type ofaggregate
isKTable<Windowed<K>,V>
-- it seems that you try to use aGenericData$Record
when it should be aWindowed<GenericData$Record>
. Hope this helps. Look at the full stack trace to see which operation causes the problem
– Matthias J. Sax
Nov 20 at 22:15
Yeah but how to cast it to Windowed. I tried in Materialized function by passing keyAvroSerde, valueAvroSerde in with function but same error.
– Sanju Bonela
Nov 26 at 10:31
3
3
You should provide more context, ie, code snippet what you are doing and which operation fails.
– Matthias J. Sax
Nov 20 at 5:59
You should provide more context, ie, code snippet what you are doing and which operation fails.
– Matthias J. Sax
Nov 20 at 5:59
Where is the question? :)
– Sarief
Nov 20 at 7:14
Where is the question? :)
– Sarief
Nov 20 at 7:14
You are doing a windowed aggregation an the return type of
aggregate
is KTable<Windowed<K>,V>
-- it seems that you try to use a GenericData$Record
when it should be a Windowed<GenericData$Record>
. Hope this helps. Look at the full stack trace to see which operation causes the problem– Matthias J. Sax
Nov 20 at 22:15
You are doing a windowed aggregation an the return type of
aggregate
is KTable<Windowed<K>,V>
-- it seems that you try to use a GenericData$Record
when it should be a Windowed<GenericData$Record>
. Hope this helps. Look at the full stack trace to see which operation causes the problem– Matthias J. Sax
Nov 20 at 22:15
Yeah but how to cast it to Windowed. I tried in Materialized function by passing keyAvroSerde, valueAvroSerde in with function but same error.
– Sanju Bonela
Nov 26 at 10:31
Yeah but how to cast it to Windowed. I tried in Materialized function by passing keyAvroSerde, valueAvroSerde in with function but same error.
– Sanju Bonela
Nov 26 at 10:31
add a comment |
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53386900%2forg-apache-avro-generic-genericdatarecord-cannot-be-cast-to-org-apache-kafka-st%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
3
You should provide more context, ie, code snippet what you are doing and which operation fails.
– Matthias J. Sax
Nov 20 at 5:59
Where is the question? :)
– Sarief
Nov 20 at 7:14
You are doing a windowed aggregation an the return type of
aggregate
isKTable<Windowed<K>,V>
-- it seems that you try to use aGenericData$Record
when it should be aWindowed<GenericData$Record>
. Hope this helps. Look at the full stack trace to see which operation causes the problem– Matthias J. Sax
Nov 20 at 22:15
Yeah but how to cast it to Windowed. I tried in Materialized function by passing keyAvroSerde, valueAvroSerde in with function but same error.
– Sanju Bonela
Nov 26 at 10:31