Open kaikalur opened 1 year ago
This way, we will have to parse fieldName for every row. If we have encode fieldName using a RowType, we can specialize and do codegen - which will be faster.
However, this is much more user-friendly
This way, we will have to parse fieldName for every row. If we have encode fieldName using a RowType, we can specialize and do codegen - which will be faster.
However, this is much more user-friendly
Not really?We can say they have to be the same type in which case you compute index array that defines the path once (like we do for LIKE etc do a preproc).
Currently to modify a (nested) field in a row, one has to list all the rest of the fields (at least along the path) making it hard to use. So we should add a method:
setValue(object RowType, fieldName VARCHAR, Function(T->boolean), T newValue)
so it will search the rowtype for the (potentially qualified fieldName or the first occurrence of a simple field name?) that satisfies the lambda and sets its value to the newValue suppled.
setValue(CAST(ROW(1, ROW(2, 'a', ROW('c')), 1.3) AS ROW(x INT, ROW(y INT, z VARCHAR, r ROW(c VARCHAR)), d double)), 'z', x->x like '%a%', 'blah')
will return
ROW(1, ROW(2, 'blah', ROW('c')), 1.3)
If the element inside an array (or map), it will do a TRANSFORM and update that field when the lambda matches