Github user AakashPradeep commented on a diff in the pull request:

    https://github.com/apache/phoenix/pull/75#discussion_r28935794
  
    --- Diff: 
phoenix-core/src/main/java/org/apache/phoenix/schema/json/PhoenixJson.java ---
    @@ -0,0 +1,216 @@
    +package org.apache.phoenix.schema.json;
    +
    +import java.io.IOException;
    +import java.sql.SQLException;
    +
    +import org.apache.hadoop.hbase.util.Bytes;
    +import org.codehaus.jackson.JsonFactory;
    +import org.codehaus.jackson.JsonNode;
    +import org.codehaus.jackson.JsonParseException;
    +import org.codehaus.jackson.JsonParser;
    +import org.codehaus.jackson.JsonParser.Feature;
    +import org.codehaus.jackson.map.ObjectMapper;
    +import org.codehaus.jackson.node.ValueNode;
    +
    +import com.google.common.base.Preconditions;
    +
    +/**
    + * The {@link PhoenixJson} wraps json and uses Jackson library to parse 
and traverse the json. It
    + * should be used to represent the JSON data type and also should be used 
to parse Json data and
    + * read the value from it. It always conside the last value if same key 
exist more than once.
    + */
    +public class PhoenixJson {
    +    private final JsonNode node;
    +    private String jsonAsString;
    +
    +    /**
    +     * Static Factory method to get an {@link PhoenixJson} object. It also 
validates the json and
    +     * throws {@link JsonParseException} if it is invalid with line number 
and character, which
    +     * should be wrapped in {@link SQLException} by caller.
    +     * @param data Buffer that contains data to parse
    +     * @param offset Offset of the first data byte within buffer
    +     * @param length Length of contents to parse within buffer
    +     * @return {@link PhoenixJson}.
    +     * @throws JsonParseException
    +     * @throws IOException
    +     */
    +    public static PhoenixJson getPhoenixJson(byte[] jsonData, int offset, 
int length)
    +            throws JsonParseException, IOException {
    --- End diff --
    
    Nice suggestion, will make this change.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to