SubhamSinghal commented on code in PR #23217:
URL: https://github.com/apache/datafusion/pull/23217#discussion_r3734418252
##########
datafusion/datasource-parquet/src/projection_read_plan.rs:
##########
@@ -76,6 +76,83 @@ pub(crate) struct StructFieldAccess {
pub(crate) field_path: Vec<String>,
}
+/// Trie of nested struct accesses, keyed at the top by the root column index
in
+/// the file schema and then by field names down each access path.
+///
+/// # Example
+///
+/// For a filter expression
+///
+/// ```sql
+/// WHERE s['outer']['a'] > 10
+/// AND s['outer']['b'] < 20
+/// AND s['outer']['inner']['c'] IS NOT NULL
+/// ```
+///
+/// where `s` is column index `2` in the file schema, three accesses are
+/// recorded — all with `root_index = 2` and paths `["outer","a"]`,
+/// `["outer","b"]`, `["outer","inner","c"]`. They produce a trie in which
+/// the shared `"outer"` prefix is represented by a single intermediate node:
+///
+/// ```text
+/// roots:
+/// 2 ──► node { selected_here: false }
+/// children:
+/// "outer" ──► node { selected_here: false }
+/// children:
+/// "a" ──► { selected_here: true, children: {} }
+/// "b" ──► { selected_here: true, children: {} }
+/// "inner" ──► { selected_here: false,
+/// children: {
+/// "c" ──► { selected_here: true,
+/// children: {} }
+/// } }
+/// ```
+#[derive(Debug, Default)]
+struct StructAccessTree {
+ roots: BTreeMap<usize, StructAccessNode>,
+}
+
+/// One node in a [`StructAccessTree`].
+///
+/// `selected_here` is `true` when at least one access path terminates at this
+/// node. Duplicate paths are idempotent.
+#[derive(Debug, Default)]
+struct StructAccessNode {
+ children: BTreeMap<String, StructAccessNode>,
Review Comment:
resolved.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]