Repository: apache/gravitino (Java)

Issue:
[Improvement] Fully suport nullable simpleStrings in Types.java
### What would you like to be improved?

Improve api/src/main/java/org/apache/gravitino/rel/types/Types.java to fully suport nallable simpleStrings.

Some test code:
```
    Types.MapType mapTypeNotNull =
        Types.MapType.valueNotNull(Types.IntegerType.get(), Types.StringType.get());
    Assertions.assertEquals(Type.Name.MAP, mapTypeNotNull.name());
    Assertions.assertEquals(Types.IntegerType.get(), mapTypeNotNull.keyType());
    Assertions.assertEquals(Types.StringType.get(), mapTypeNotNull.valueType());
    Assertions.assertEquals("map<integer,string, NOT NULL>", mapTypeNotNull.simpleString());
    Assertions.assertEquals(
        mapTypeNotNull,
        Types.MapType.valueNotNull(Types.IntegerType.get(), Types.StringType.get()));
```

### How should we improve?

Change the simpleString method so that the returned string reflects whether the map’s values are nullable or not, appending NOT NULL when appropriate


Discussion:
@justinmclean Considering I've previously worked on a "good first issue", would it be appropriate for me to take this? If not, would you have a recommendation for an issue that I could work on?
You are welcome to work on this. It's not a simple fix, but you can do it.
If you get stuck or don't know what to do, just ask for help.
I've been thinking about this for a while. Aren't the values of a map always nullable, since they are always reference types? I think I've misunderstood something here.
SimpleStrings can be nullable or not nullable, it's a property they have vs them having an actual null value - does that help? 



Patch:
diff --git a/api/src/main/java/org/apache/gravitino/rel/types/Types.java b/api/src/main/java/org/apache/gravitino/rel/types/Types.java
index 61520f42207..8b7b78895d7 100644
--- a/api/src/main/java/org/apache/gravitino/rel/types/Types.java
+++ b/api/src/main/java/org/apache/gravitino/rel/types/Types.java
@@ -1096,7 +1096,9 @@ public boolean valueNullable() {
 
     @Override
     public String simpleString() {
-      return "map<" + keyType.simpleString() + "," + valueType.simpleString() + ">";
+      return valueNullable
+          ? "map<" + keyType.simpleString() + "," + valueType.simpleString() + ">"
+          : "map<" + keyType.simpleString() + "," + valueType.simpleString() + ", NOT NULL>";
     }
 
     @Override


Test patch:
diff --git a/api/src/test/java/org/apache/gravitino/rel/TestTypes.java b/api/src/test/java/org/apache/gravitino/rel/TestTypes.java
index ddf70541f04..75da38db6ea 100644
--- a/api/src/test/java/org/apache/gravitino/rel/TestTypes.java
+++ b/api/src/test/java/org/apache/gravitino/rel/TestTypes.java
@@ -202,6 +202,13 @@ public void testComplexTypes() {
     Assertions.assertEquals("list<integer>", listType.simpleString());
     Assertions.assertEquals(listType, Types.ListType.nullable(Types.IntegerType.get()));
 
+    Types.ListType listTypeNotNull = Types.ListType.notNull(Types.StringType.get());
+    Assertions.assertEquals(Type.Name.LIST, listTypeNotNull.name());
+    Assertions.assertFalse(listTypeNotNull.elementNullable());
+    Assertions.assertEquals(Types.StringType.get(), listTypeNotNull.elementType());
+    Assertions.assertEquals("list<string, NOT NULL>", listTypeNotNull.simpleString());
+    Assertions.assertEquals(listTypeNotNull, Types.ListType.notNull(Types.StringType.get()));
+
     Types.MapType mapType =
         Types.MapType.valueNullable(Types.IntegerType.get(), Types.StringType.get());
     Assertions.assertEquals(Type.Name.MAP, mapType.name());
@@ -211,6 +218,16 @@ public void testComplexTypes() {
     Assertions.assertEquals(
         mapType, Types.MapType.valueNullable(Types.IntegerType.get(), Types.StringType.get()));
 
+    Types.MapType mapTypeNotNull =
+        Types.MapType.valueNotNull(Types.IntegerType.get(), Types.StringType.get());
+    Assertions.assertEquals(Type.Name.MAP, mapTypeNotNull.name());
+    Assertions.assertEquals(Types.IntegerType.get(), mapTypeNotNull.keyType());
+    Assertions.assertEquals(Types.StringType.get(), mapTypeNotNull.valueType());
+    Assertions.assertEquals("map<integer,string, NOT NULL>", mapTypeNotNull.simpleString());
+    Assertions.assertEquals(
+        mapTypeNotNull,
+        Types.MapType.valueNotNull(Types.IntegerType.get(), Types.StringType.get()));
+
     Types.UnionType unionType =
         Types.UnionType.of(
             Types.IntegerType.get(), Types.StringType.get(), Types.BooleanType.get());