apache / apache/pulsar

[Bug] CustomExtractor cannot be cast to class org.apache.pulsar.functions.windowing.TimestampExtractor

Open
#18,719 1 comment 0 reactions 0 assignees View on GitHub
Stale type/bug
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

Open the contributing 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.