Closed masonproffitt closed 3 years ago
I have some code that will go through and do its best to unwrap all tuple operations (and I think list operations, but it would be an easy modification). It also does things like try to combine multiple Selects, push Where's together. It operates only at the ast
level.
In this case- it would take the above code and remove the second Select, and then resolve the index operations on the first - so by the time your translation code got to it, it wouldn't have to deal with that case.
You can find it in the func_adl.ast package.
One thing I really want to add there is something similar for dictionaries (that you already have at some level in your code).
If you do something like
.Select(lambda row: [row.column_a, row.column_b]).Select(lambda row: [row[0], row[1]])
, the secondSelect
should effectively be an identity operation, but right now it will actually pick out the first two rows/events instead of the two columns.