phoenix-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (PHOENIX-174) Zookeeper parameter in Phoenix JDBC URL should be optional as it can be specified in hbase-site.xml
Date Thu, 23 Apr 2015 03:54:38 GMT

    [ https://issues.apache.org/jira/browse/PHOENIX-174?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14508411#comment-14508411
] 

ASF GitHub Bot commented on PHOENIX-174:
----------------------------------------

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

    https://github.com/apache/phoenix/pull/75#discussion_r28935112
  
    --- Diff: phoenix-core/src/main/java/org/apache/phoenix/expression/function/JsonExtractPathTextFunction.java
---
    @@ -0,0 +1,108 @@
    +package org.apache.phoenix.expression.function;
    +
    +import java.sql.SQLException;
    +import java.util.List;
    +
    +import org.apache.hadoop.hbase.io.ImmutableBytesWritable;
    +import org.apache.phoenix.compile.KeyPart;
    +import org.apache.phoenix.exception.SQLExceptionCode;
    +import org.apache.phoenix.exception.SQLExceptionInfo;
    +import org.apache.phoenix.expression.Expression;
    +import org.apache.phoenix.parse.FunctionParseNode.Argument;
    +import org.apache.phoenix.parse.FunctionParseNode.BuiltInFunction;
    +import org.apache.phoenix.schema.IllegalDataException;
    +import org.apache.phoenix.schema.json.PhoenixJson;
    +import org.apache.phoenix.schema.tuple.Tuple;
    +import org.apache.phoenix.schema.types.PDataType;
    +import org.apache.phoenix.schema.types.PJsonDataType;
    +import org.apache.phoenix.schema.types.PVarchar;
    +import org.apache.phoenix.schema.types.PVarcharArray;
    +import org.apache.phoenix.schema.types.PhoenixArray;
    +import org.apache.phoenix.util.ByteUtil;
    +
    +@BuiltInFunction(name = JsonExtractPathTextFunction.NAME, args = {
    +        @Argument(allowedTypes = { PJsonDataType.class }),
    +        @Argument(allowedTypes = { PVarcharArray.class }) })
    +public class JsonExtractPathTextFunction extends ScalarFunction {
    +    public static final String NAME = "JSON_EXTRACT_PATH_TEXT";
    +
    +    public JsonExtractPathTextFunction() {
    +        super();
    +    }
    +
    +    public JsonExtractPathTextFunction(List<Expression> children) {
    +        super(children);
    +    }
    +
    +    @Override
    +    public boolean evaluate(Tuple tuple, ImmutableBytesWritable ptr) {
    +        Expression jsonExpression = this.children.get(0);
    +        if (!jsonExpression.evaluate(tuple, ptr)) {
    +            return false;
    +        }
    +        if (ptr.getLength() == 0) {
    +            return false;
    +        }
    +        PhoenixJson phoenixJson =
    +                (PhoenixJson) PJsonDataType.INSTANCE.toObject(ptr.get(), ptr.getOffset(),
    +                    ptr.getLength());
    +
    +        Expression jsonPathArrayExpression = children.get(1);
    +        if (!jsonPathArrayExpression.evaluate(tuple, ptr)) {
    +            return false;
    +        }
    +
    +        if (ptr.getLength() == 0) {
    +            return false;
    +        }
    +
    +        PhoenixArray phoenixArray = (PhoenixArray) PVarcharArray.INSTANCE.toObject(ptr);
    +        try {
    +            String[] jsonPaths = (String[]) phoenixArray.getArray();
    +            PhoenixJson phoenixJson2 = phoenixJson.getNullablePhoenixJson(jsonPaths);
    +            if (phoenixJson2 == null) {
    +                ptr.set(ByteUtil.EMPTY_BYTE_ARRAY);
    +            } else {
    +                byte[] json = PVarchar.INSTANCE.toBytes(phoenixJson2.serializeToString());
    +                ptr.set(json);
    +            }
    +
    +        } catch (SQLException sqe) {
    +            new IllegalDataException(new SQLExceptionInfo.Builder(SQLExceptionCode.ILLEGAL_DATA)
    --- End diff --
    
    Yeah I missed that. I will add them.


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

Mime
View raw message