[ https://issues.apache.org/jira/browse/PHOENIX-174?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14508384#comment-14508384 ]
ASF GitHub Bot commented on PHOENIX-174: ---------------------------------------- Github user JamesRTaylor commented on a diff in the pull request: https://github.com/apache/phoenix/pull/75#discussion_r28934392 --- 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 -- Probably best to throw a SQLException here with the JsonParseException or IOException nested inside. Perhaps create an INVALID_JSON_DATA exception in SQLExceptionCode that you can use for the JsonParseException. > Zookeeper parameter in Phoenix JDBC URL should be optional as it can be > specified in hbase-site.xml > --------------------------------------------------------------------------------------------------- > > Key: PHOENIX-174 > URL: https://issues.apache.org/jira/browse/PHOENIX-174 > Project: Phoenix > Issue Type: Task > Affects Versions: 1.1 > Reporter: mujtaba > Labels: enhancement > > Currently, value from HBase zookeeper/port specified in Phoenix JDBC URL > overrides the value specified in hbase-site.xml. Override is fine, but it > should use value specified in hbase-site.xml if no value is specified in > phoenix JDBC URL i.e. to make this parameter optional. -- This message was sent by Atlassian JIRA (v6.3.4#6332)