I've discovered what looks like a bug in Mapnik, but I'm finding it hard to track down where the bug might be.
If you create one or more rules that have filter expressions like this:
length([field]) % 5 = 0
length([field]) % 5 = 1
length([field]) % 5 = 2
Then, during evaluation, [field] is always null. I've verified that by stepping through the evaluation code.
If I change any of the expressions to something:
length([field]) % 5 = 0 or [field] = 'foobar'
then all expressions are evaluated correctly, and [field] is fed through correctly from the DB.
I've verified that this has nothing to do with the DB fetch - the correct [field] is fetched from the DB in both cases.
I'm assuming this bug is due to some piece of code that tries to analyze the expressions in a style, and avoid populating those fields that aren't needed. If I'm correct in this hunch, then where does that code lie?
If I know where it is, then I can probably fix it.
My Mapnik version is 3.0.15.
Thanks,
Ben