mcvsubbu commented on a change in pull request #3728: Support for specifying 
Object Type in Schema
URL: https://github.com/apache/incubator-pinot/pull/3728#discussion_r249569260
 
 

 ##########
 File path: 
pinot-common/src/main/java/org/apache/pinot/common/data/objects/MapObject.java
 ##########
 @@ -0,0 +1,66 @@
+/**
+ * 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.pinot.common.data.objects;
+
+import java.io.IOException;
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.pinot.common.data.PinotObject;
+
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.google.common.collect.Lists;
+
+public class MapObject implements PinotObject {
+
+  private static ObjectMapper _MAPPER = new ObjectMapper();
+  Map<String, Object> _stringMap;
+
+  @SuppressWarnings("unchecked")
+  @Override
+  public void init(byte[] bytes) {
+    try {
+      _stringMap = _MAPPER.readValue(bytes, Map.class);
+    } catch (IOException e) {
+      _stringMap = Collections.emptyMap();
 
 Review comment:
   Not sure how this is used, but I am noting that we may not want to swallow 
exceptions all the time. If (say) hadoop job is trying to ingest objects. we 
may want to return an exception right away instead of replacing the value with 
our own choice. On the other hand, while processing a query, perhaps returning 
an empty string is ok (but ideally we should just discard the docid?)
   
   I assume that the answer to my question about serialization contract is that 
the ingesting entity has to use Pinot library (which we shall preserve backward 
compatibility, with appropriate versioning etc.). In that case should these 
definitions move to pinot-api package?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to