โ01-11-2022 06:56 AM
Hello,
I have found something like bug. I cannot understand the strange result of the following pipeline.
When I run validation of this pipeline, I see following results.
As expected count of the input documents in the Gate output equal zero. You can see it on the screenshot below.
Following screenshot shows the settings of the mapper โLog File Not Foundโ:
If open Exression builder then you can see expression (as showed on the screenshot below). Window โOutput Previewโ contain expected result โFile Not Foundโ (because count = 0).
However, result of this mapper contain value โFile existsโ (as showed on the screenshot below).
As a result the whole pipeline works incorrect during execution process.
Could somebody help me to sort out with this strange behavior of the Mapper snap?
I am attaching my pipeline.
SnapLogic_Bug_Gate_Count_reproduce_2022_01_11.slp (9.8 KB)
Thanks
โ01-11-2022 07:25 AM
Hey @Vladyslav,
I guess itโs working when you have documents on input. If not, the default configuration of Gate returns an empty object, so maybe thatโs why thereโs a conflict here.
But, I donโt see any reason why not to improvise, and use a Gate and a Mapper. Check the pipeline attached:
SnapLogic_Bug_Gate_Count1.slp (6.1 KB)
You can easily test by disconnecting and disabling the JSON Generator snap.
I hope youโll find this helpful,
Bojan
โ01-11-2022 09:16 AM
Hi @bojanvelevski ,
Unfortunately your pipeline works in correct way only for cases where Gate donโt have any input snaps. I modified your pipeline by adding Filter between JSON Generator and Gate (
SnapLogic_Bug_Gate_Count_reproduce_alternative_2022_01_11.slp (7.3 KB)
). Filter snap donโt return any documents (I did it specially). In this case you will see result โFile existsโ.
But I need calculate count of input documents. And if this count equal zero then I am expecting to have โFile not foundโ as a result.
Anyway, thank you for your help.
โ01-11-2022 11:37 AM
@Vladyslav, I agree, this appears to be a bug. The $input0.count value type doesnโt appear to be comparable type to 0. I suggest you open a ticket to support.
In the meantime, I think I found this expression to work for your case:
$input0.count.toString() == "0" ? "File Not Found" : "File exists"
Another hack is to place a JSON Formatter + JSON Parser between the Gate and Mapper. That seems to correct the expected type.
โ01-11-2022 11:47 AM
Yes, I can confirm that this is a bug in the Gate snap. The type of the count is actually AtomicInteger, and this isnโt comparable in the normal way with โ== 0โ in the expression language. The Gate snap should be fixed so that the count is the usual type for integers (BigInteger).
Iโll second Delโs workaround for the mapper expression.
Iโll take care of tracking and fixing this bug.