Transformation order and result varies
tuukka opened this issue · comments
The order and thus result of transformation execution seems to vary between runs, especially if I switch between Java 7 and Java 8. The written order of the transformations may matter as well, but it's not deterministic.
I tried 4 ways to write a transformation that updates an agency id and removes a route from the same agency:
{remove above update, update above remove} x {remove using old agency id, remove using new agency id}
{"op":"remove", "match":{"file":"routes.txt", "agency_id":"4", "route_short_name":"8001"}}
{"op":"update", "match":{"file":"agency.txt", "agency_id":"4"}, "update":{"agency_id":"VR"}}
{"op":"update", "match":{"file":"agency.txt", "agency_id":"4"}, "update":{"agency_id":"VR"}}
{"op":"remove", "match":{"file":"routes.txt", "agency_id":"4", "route_short_name":"8001"}}
{"op":"remove", "match":{"file":"routes.txt", "agency_id":"VR", "route_short_name":"8001"}}
{"op":"update", "match":{"file":"agency.txt", "agency_id":"4"}, "update":{"agency_id":"VR"}}
{"op":"update", "match":{"file":"agency.txt", "agency_id":"VR"}, "update":{"agency_id":"VR"}}
{"op":"remove", "match":{"file":"routes.txt", "agency_id":"4", "route_short_name":"8001"}}
On one Java 7 test run, all of these happened to work and removed the route. On another run, only the first one succeeded.
On three Java 8 test runs, the versions using old agency id failed. So perhaps it's deterministic here?
This is the command I used for testing: java -server -jar onebusaway-gtfs-transformer-cli.jar --transform matka.rule matka.zip matka ; grep -q ,8001, matka/routes.txt && echo "fail"
This is the GTFS data I work with: http://dev.hsl.fi/tmp/matka.zip