Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Duplicate key" error when using repeated matches with the same name and type #117

Open
bmcfeely opened this issue Aug 30, 2021 · 0 comments

Comments

@bmcfeely
Copy link

bmcfeely commented Aug 30, 2021

When I try to compile the following with 0.1.9:

"%{NUMBER:myValue:int} %{NUMBER:myValue:int}";

I get:

java.lang.IllegalStateException: Duplicate key myValue (attempted merging values INT and INT)
	at java.base/java.util.stream.Collectors.duplicateKeyException(Collectors.java:133)
	at java.base/java.util.stream.Collectors.lambda$uniqKeysMapAccumulator$1(Collectors.java:180)
	at java.base/java.util.stream.ReduceOps$3ReducingSink.accept(ReduceOps.java:169)
	at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:195)
	at java.base/java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:177)
	at java.base/java.util.HashMap$ValueSpliterator.forEachRemaining(HashMap.java:1675)
	at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:484)
	at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474)
	at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:913)
	at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
	at java.base/java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:578)
	at io.krakens.grok.api.Converter.getGroupTypes(Converter.java:85)
	at io.krakens.grok.api.Grok.<init>(Grok.java:72)
	at io.krakens.grok.api.GrokCompiler.compile(GrokCompiler.java:197)
	at io.krakens.grok.api.GrokCompiler.compile(GrokCompiler.java:124)
	at io.krakens.grok.api.GrokCompiler.compile(GrokCompiler.java:120)

However, when I try:

"%{NUMBER:myValue} %{NUMBER:myValue}"

It works just fine.

So maybe a different version of toMap needs to be called, maybe the one that takes BinaryOperator<U> mergeFunction as the third argument? 🤔 Not sure what merge function to pass it, though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant