[NO ISSUE][COMP] Fix index selection for datasets with meta - user model changes: no - storage format changes: no - interface changes: no
Details: Fix index selection for datasets with meta. Access method rule should check where the field is coming from (dataset record or meta record) and then determine if the field matches the keys in the index based on their names and sources.
This patch also fixes resolving PK field accesses to the primary key variable (e.g. $ds.getField("id") is turned into $13 where id is a PK). The fix considers whether the PK is coming from the data record or the meta record. The patch also includes fixing rewriting of meta() references and replacing them with their corresponding meta variables. Now nested plans are visited also when looking for meta() references to take care of cases where the data scan producing the meta variable and the meta() references happen to be inside the nested plans. MetaFunctionToMetaVariable() is fired also after the rules which eliminate subplans to allow for rewriting of the meta() if it couldn't be replaced when the meta() reference was in the subplan but referring to meta variable outside the nested plan. ReinferAllTypesRule() is now fired before ByNameToByIndexFieldAccessRule() to allow the latter rule to get the up-to-date types in the whole plan.