wgtmac commented on code in PR #194:
URL: https://github.com/apache/iceberg-cpp/pull/194#discussion_r2303465478


##########
src/iceberg/type.cc:
##########
@@ -105,23 +149,29 @@ std::string ListType::ToString() const {
   return repr;
 }
 std::span<const SchemaField> ListType::fields() const { return {&element_, 1}; 
}
-std::optional<std::reference_wrapper<const SchemaField>> 
ListType::GetFieldById(
+Result<std::optional<std::reference_wrapper<const SchemaField>>> 
ListType::GetFieldById(
     int32_t field_id) const {
   if (field_id == element_.field_id()) {
     return std::cref(element_);
   }
   return std::nullopt;
 }
-std::optional<std::reference_wrapper<const SchemaField>> 
ListType::GetFieldByIndex(
-    int index) const {
+Result<std::optional<std::reference_wrapper<const SchemaField>>>
+ListType::GetFieldByIndex(int index) const {
   if (index == 0) {
     return std::cref(element_);
   }
   return std::nullopt;
 }
-std::optional<std::reference_wrapper<const SchemaField>> 
ListType::GetFieldByName(
-    std::string_view name) const {
-  if (name == element_.name()) {
+Result<std::optional<std::reference_wrapper<const SchemaField>>> 
ListType::GetFieldByName(
+    std::string_view name, bool case_sensitive) const {
+  if (case_sensitive) {
+    if (name == element_.name()) {
+      return std::cref(element_);
+    }
+    return std::nullopt;
+  }
+  if (StringUtils::ToLower(name) == StringUtils::ToLower(element_.name())) {

Review Comment:
   I think it's fine to support case-sensitive search for map and list type. 
This is consistent with the `Schema` implementation.



-- 
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