You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iceberg.apache.org by bl...@apache.org on 2021/01/16 01:53:18 UTC

[iceberg] branch master updated: Core: Add comments for Position2Accessor and Position3Accessor (#2074)

This is an automated email from the ASF dual-hosted git repository.

blue pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/iceberg.git


The following commit(s) were added to refs/heads/master by this push:
     new 989f8fc  Core: Add comments for Position2Accessor and Position3Accessor (#2074)
989f8fc is described below

commit 989f8fc21f6cf2f883c0de8f6ff87a9ffb6dc123
Author: simonsssu <ba...@gmail.com>
AuthorDate: Sat Jan 16 09:53:09 2021 +0800

    Core: Add comments for Position2Accessor and Position3Accessor (#2074)
---
 api/src/main/java/org/apache/iceberg/Accessors.java | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/api/src/main/java/org/apache/iceberg/Accessors.java b/api/src/main/java/org/apache/iceberg/Accessors.java
index e62012d..017fb51 100644
--- a/api/src/main/java/org/apache/iceberg/Accessors.java
+++ b/api/src/main/java/org/apache/iceberg/Accessors.java
@@ -26,6 +26,20 @@ import org.apache.iceberg.types.Type;
 import org.apache.iceberg.types.TypeUtil;
 import org.apache.iceberg.types.Types;
 
+/**
+ * Position2Accessor and Position3Accessor here is an optimization. For a nested schema like:
+ * <pre>
+ * root
+ *  |-- a: struct (nullable = false)
+ *  |    |-- b: struct (nullable = false)
+ *  |        | -- c: string (containsNull = false)
+ * </pre>
+ *  Then we will use Position3Accessor to access nested field 'c'. It can be accessed like this:
+ *  {@code row.get(p0, StructLike.class).get(p1, StructLike.class).get(p2, javaClass)}.
+ *  Commonly, Nested fields with depth=1 or 2 or 3 are the fields that will be accessed frequently,
+ *  so this optimization will help to access this kind of schema. For schema whose depth is deeper than 3,
+ *  then we will use the {@link WrappedPositionAccessor} to access recursively.
+ */
 public class Accessors {
   private Accessors() {
   }