| 184 | } |
| 185 | |
| 186 | int TopLevelIndex(const FieldRef& ref, const Schema& schema) { |
| 187 | if (const auto* name = ref.name()) { |
| 188 | return schema.GetFieldIndex(*name); |
| 189 | } else if (const auto* path = ref.field_path()) { |
| 190 | DCHECK(!path->empty()); |
| 191 | return (*path)[0]; |
| 192 | } |
| 193 | const auto* nested_refs = ref.nested_refs(); |
| 194 | DCHECK(nested_refs && !nested_refs->empty()); |
| 195 | return TopLevelIndex((*nested_refs)[0], schema); |
| 196 | } |
| 197 | |
| 198 | // Make a new schema consisting only of the top-level fields in the dataset schema that: |
| 199 | // (a) Have children that require materialization |
no test coverage detected