Unable to create pulsar function with --window-length-duration-ms or --window-length-count
- Dominant language
- Java
- Stars
- 15.3k
- Forks
- 3.8k
- Avg merge
- 1d 14h
- Merged PRs (30d)
- 160
Description
**Describe the bug**
There are two ways to develop a custom pulsar function. 1.) by implementing interface Function 2.) by implementing WindowFunction.
Custom pulsar function that is developed using interface Function has a null issue When we try to create function with options --window-length-duration-ms or --window-length-count.
This issue observed in Pulsar version:2.6.1 and Pulsar version-all :2.6.1
bin/pulsar-admin functions create \--jar test.jar --classname com.abcd.xyz.mnop.qrst.function.sample --inputs input --output test --name samplefunction --window-length-count 30000
null
Reason: null
**To Reproduce**
Steps to reproduce the behavior:
1. Develop a custom pulsar function by implementing interface Function
```
public class sample implements Function {
@Override
public Void process(String input, Context context) throws Exception {
System.out.println("Test:"+input);
return null;
}
}
```
2. Generate the jar (sample.jar )for this custom pulsar function
3. Deploy the generated jar (sample.jar) in pulsar container by docker cp sample.jar :/pulsar
4. login/run the container by docker exec -it /bin/bash
5. Now execute the following command bin/pulsar-admin functions create \--jar sample.jar --classname com.abcd.xyz.mnop.qrst.function.sample --inputs input --output test --name samplefunction --window-length-count 300
Following error occur

**Expected behavior**
Pulsar function should be created with --window-length-duration-ms and --window-length-count options
**Screenshots**
NA
**Desktop (please complete the following information):**
- OS: Windows 10, Pulsar in Docker image. Docker version: 2.2.0.4
**Additional context**
NA
Contributor guide
Research direction
Start by reproducing the issue with the sample Java Function implementation and the bin/pulsar-admin functions create command using --window-length-count or --window-length-duration-ms in the Docker-based Pulsar setup. Trace the command's handling of these options and compare it with WindowFunction creation; done means a Function can be created successfully with either option instead of returning null.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- docker, java
- Domain
- stream-processing
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100