To make the pastry, put the flour, butter and two tbsp icing sugar in a food processor and pulse until the mixture resembles fine breadcrumbs. Add the chopped pistachios.
Whisk the egg yolk with one tbsp cold water and gradually add to the mixture, until you have a firm dough (you may not need all the egg mixture). Knead it briefly to make a ball, wrap in clingfilm and chill in the fridge for 20 minutes.
Meanwhile, heat the oven to 190°C/170°C fan/gas 5. Put the rhubarb on a baking tray, tuck in the vanilla pod and scatter over the demerara sugar. Roast for 15-20 minutes, until just tender. Remove from the oven and set aside to cool.
Roll out the pastry and use to line a 23cm x 4cm loose-bottomed flan tin. Line the pastry with baking parchment and fill with baking beans. Bake for 15 minutes. Remove the beans and parchment and return to the oven for five minutes.
In a bowl, beat the ricotta and caster sugar together until smooth, then beat in the eggs, one at a time. Stir in the cream, then pour into the pastry case.
Arrange the rhubarb on top and bake for 20-25 minutes, until the filling is just set, but with a slight wobble in the centre. Dust with icing sugar to serve.