wonder if anyone can help, have the following impo...
# troubleshooting
g
wonder if anyone can help, have the following import... and here is the associated pom entry, import is stll failing as far as vscode and mvn compile is concerned. from code.
Copy code
import org.apache.flink.api.common.serialization.SerializableSerializer;
...

    @Override
    public SimpleVersionedSerializerSnmpSourceSplit getSplitSerializer() {
        return new SerializableSerializer<>();
    }

    @Override
    public SimpleVersionedSerializer<ListSnmpSourceSplit> getEnumeratorCheckpointSerializer() {
        return new SerializableSerializer<>();
    }
parent pom.xml
Copy code
properties
        flink.version1.20.1/flink.version
        java.version17/java.version
        maven-compiler.version3.11.0/maven-compiler.version
        maven-shade.version3.5.2/maven-shade.version
        maven-compiler.source${java.version}/maven-compiler.source
        maven-compiler.target${java.version}/maven-compiler.target
        project.build.sourceEncodingUTF-8/project.build.sourceEncoding
     ...
local pom.xml
Copy code
dependency
            groupIdorg.apache.flink/groupId
            artifactIdflink-core/artifactId
            version${flink.version}/version
            scopeprovided/scope
        /dependency
a
I can't find that class at all - I don't think that class exists. Closest match I can find is
org.apache.flink.api.common.SerializableSerializer
which was added in Flink 2.0. Still. I don't think that's a useful class in this case as it doesn't implement the
SimpleVersionedSerializer
interface. The code you posted above doesn't make much sense. You have to actually implement the serialization logic that de-/serializes your
SnmpSourceSplit
objects into byte arrays. For example:
Copy code
public static class FooSerializer implements SimpleVersionedSerializerFoo {

    @Override
    public int getVersion() {
      return 0;
    }

    @Override
    public byte[] serialize(Foo foo) throws IOException {
      try (ByteArrayOutputStream baos = new ByteArrayOutputStream();
          DataOutputStream out = new DataOutputStream(baos)) {
        out.writeBoolean(foo.isFoo());
        out.flush();
        return baos.toByteArray();
      }
    }

    public Foo deserialize(int version, byte[] serialized) throws IOException {
      try (ByteArrayInputStream bais = new ByteArrayInputStream(serialized);
          DataInputStream in = new DataInputStream(bais)) {
        boolean isFoo = in.readBoolean();
        return new Foo(isFoo);
      }
    }
  }
I find that current crop of LLMs are not very helpful with Flink implementations. They seem to lacking the proper training data, and often make quite fundamental mistakes.
πŸ‘ 1
g
i'm a proper noob as far as Java is concerned, trying to put together a source connector for flink,
will have a look, thanks for the above
a
Awesome to hear that you're giving it a go! Best of luck πŸ™‚ An IDE with good auto-complete (e.g intellij) with all of the Flink dependencies imported is a great help. Does VSCode have proper auto-complete?
g
... can do with someone with allot of Java/Flink skills to assist if interested. I installed Github co pilot last night, so need to see if it is helpfull or more of a hinder... for me
a
Unfortunately I don't have the time, currently. I'm just contributing a bit on slack. As for Co-pilot. For general Java questions it's great. But for Flink specifics it's not much help (e.g the above)
πŸ‘ 1
g
curious, which AI coding assistance have you found is best for Flink, ChatGPT is a joke... Gemini seems to also develop a healthy level of hallucination and at random in one file change the direct of the code and variable names...