RussellSpitzer commented on code in PR #11324:
URL: https://github.com/apache/iceberg/pull/11324#discussion_r1811179041


##########
api/src/main/java/org/apache/iceberg/VariantLike.java:
##########
@@ -0,0 +1,70 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.iceberg;
+
+import org.apache.iceberg.types.Type;
+
+/**
+ * Interface for accessing Variant fields.
+ */
+public interface VariantLike {
+  int size();
+
+  /**
+   * Retrieves the value of the current variant element based on the provided 
`javaClass` type.
+   * The `javaClass` parameter should be the `javaClass` field value of an 
Iceberg data type TypeID
+   * {@link Type#typeId()}, such as `Boolean.class`.
+   *
+   * <p>
+   * If the current variant element holds a primitive value that can be 
extracted or promoted to match
+   * the specified `javaClass`, the method will return that value. If the 
value is an object or cannot
+   * be extracted or promoted to the desired type, the method will return 
`null`.
+   *
+   * @param javaClass the Java class type to extract the value from the 
current variant element.
+   * @return the extracted value if successful, or `null` if the value cannot 
be extracted or promoted.
+   */
+  <T> T get(Class<T> javaClass);
+
+  /**
+   * Retrieves the sub-element from the current variant based on the provided 
path.
+   * The path is an array of strings that represents the hierarchical path to 
access the sub-element
+   * within the variant, such as ["a", "b"], for the path `a.b`.
+   *
+   * <p>
+   * If the sub-element exists for the specified path, it will return the 
corresponding VariantLike` element.
+   * Otherwise, if the path is invalid or the sub-element is not found, this 
method will return `null`. If

Review Comment:
   I'm not sure we need to support empty or null as parameter args



-- 
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: issues-unsubscr...@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org
For additional commands, e-mail: issues-h...@iceberg.apache.org

Reply via email to