xiangfu0 commented on code in PR #13905:
URL: https://github.com/apache/pinot/pull/13905#discussion_r1735177330


##########
pinot-spi/src/main/java/org/apache/pinot/spi/data/ComplexFieldSpec.java:
##########
@@ -87,6 +98,58 @@ public FieldType getFieldType() {
 
   @Override
   public String toString() {
-    return "field type: COMPLEX, field name: " + _name + ", root data type: " 
+ _dataType;
+    return "field type: COMPLEX, field name: " + _name + ", root data type: " 
+ _dataType + ", child field specs: "
+        + _childFieldSpecs;
+  }
+
+  public static class MapFieldSpec {
+    private final String _fieldName;
+    private final FieldSpec _keyFieldSpec;
+    private final FieldSpec _valueFieldSpec;
+
+    private MapFieldSpec(ComplexFieldSpec complexFieldSpec) {
+      
Preconditions.checkState(complexFieldSpec.getChildFieldSpecs().containsKey(KEY_FIELD),
+          "Missing 'key' in the 'childFieldSpec'");
+      
Preconditions.checkState(complexFieldSpec.getChildFieldSpecs().containsKey(VALUE_FIELD),
+          "Missing 'value' in the 'childFieldSpec'");
+      _keyFieldSpec = complexFieldSpec.getChildFieldSpec(KEY_FIELD);
+      _valueFieldSpec = complexFieldSpec.getChildFieldSpec(VALUE_FIELD);
+      _fieldName = complexFieldSpec.getName();
+    }
+
+    public String getFieldName() {
+      return _fieldName;
+    }
+
+    public FieldSpec getKeyFieldSpec() {
+      return _keyFieldSpec;
+    }
+
+    public FieldSpec getValueFieldSpec() {
+      return _valueFieldSpec;
+    }
+  }
+
+  public static MapFieldSpec fromMapFieldSpec(ComplexFieldSpec 
complexFieldSpec) {

Review Comment:
   done.



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

Reply via email to