[Bug] CustomExtractor cannot be cast to class org.apache.pulsar.functions.windowing.TimestampExtractor
- Dominant language
- Java
- Stars
- 15.3k
- Forks
- 3.8k
- Avg merge
- 1d 14h
- Merged PRs (30d)
- 160
Description
### Search before asking
- [X] I searched in the [issues](https://github.com/apache/pulsar/issues) and found nothing similar.
### Version
2.10.2
### Minimal reproduce step
Described in https://github.com/tomaszmichalak/pulsar-sandbox.
### What did you expect to see?
No issue with custom TimestampExtractor implementation.
### What did you see instead?
java.lang.ClassCastException: class org.apache.pulsar.functions.watermark.SampleTimestampExtractor cannot be cast to class org.apache.pulsar.functions.windowing.TimestampExtractor (org.apache.pulsar.functions.watermark.SampleTimestampExtractor is in unnamed module of loader org.apache.pulsar.functions.utils.functioncache.FunctionClassLoaders$ParentFirstClassLoader @3872bc37; org.apache.pulsar.functions.windowing.TimestampExtractor is in unnamed module of loader java.net.URLClassLoader @3f102e87)
at org.apache.pulsar.functions.windowing.WindowFunctionExecutor.getTimeStampExtractor(WindowFunctionExecutor.java:167) ~[org.apache.pulsar-pulsar-functions-instance-2.10.2.jar:2.10.2]
at org.apache.pulsar.functions.windowing.WindowFunctionExecutor.getWindowManager(WindowFunctionExecutor.java:111) ~[org.apache.pulsar-pulsar-functions-instance-2.10.2.jar:2.10.2]
at org.apache.pulsar.functions.windowing.WindowFunctionExecutor.initialize(WindowFunctionExecutor.java:67) ~[org.apache.pulsar-pulsar-functions-instance-2.10.2.jar:2.10.2]
at org.apache.pulsar.functions.instance.JavaInstance.initialize(JavaInstance.java:160) ~[org.apache.pulsar-pulsar-functions-instance-2.10.2.jar:2.10.2]
at org.apache.pulsar.functions.instance.JavaInstanceRunnable.setup(JavaInstanceRunnable.java:234) ~[org.apache.pulsar-pulsar-functions-instance-2.10.2.jar:2.10.2]
at org.apache.pulsar.functions.instance.JavaInstanceRunnable.run(JavaInstanceRunnable.java:260) ~[org.apache.pulsar-pulsar-functions-instance-2.10.2.jar:2.10.2]
### Anything else?
I try to find examples with watermark cases.
### Are you willing to submit a PR?
- [ ] I'm willing to submit a PR!
Contributor guide
Research direction
Start with the sandbox reproduction linked in the issue, then inspect WindowFunctionExecutor.getTimeStampExtractor at line 167 and its calls from getWindowManager and initialize. Confirm the class-loader interaction behind the ClassCastException and verify that a custom TimestampExtractor can initialize without this failure.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- distributed-systems
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100