Uploaded image for project: 'Tajo'
  1. Tajo
  2. TAJO-1528 Implement JSON Functions
  3. TAJO-1529

Implement json_extract_path_text(string, string) function

    Details

    • Type: Sub-task
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 0.11.0, 0.10.1
    • Component/s: Function/UDF
    • Labels:
      None

      Description

      See the below sample:

      SELECT json_extract_path_text('{"sample" : {"name" : "tajo"}}','$.sample.name')
      
      1. TAJO-1529.patch
        8 kB
        Jinho Kim
      2. TAJO-1529_2.patch
        15 kB
        Jinho Kim

        Activity

        Hide
        hudson Hudson added a comment -

        SUCCESS: Integrated in Tajo-master-build #657 (See https://builds.apache.org/job/Tajo-master-build/657/)
        TAJO-1529: Implement json_extract_path_text(string, string) function. (jhkim: rev d160f6e189d4de6275e169a3e0fd74d9647481c4)

        • tajo-project/pom.xml
        • tajo-core/src/test/java/org/apache/tajo/engine/function/TestJsonFunctions.java
        • tajo-storage/tajo-storage-hdfs/src/main/java/org/apache/tajo/storage/json/JsonLineDeserializer.java
        • tajo-core/src/main/java/org/apache/tajo/engine/function/json/JsonExtractPathText.java
        • tajo-docs/src/main/sphinx/functions.rst
        • tajo-storage/tajo-storage-hdfs/src/main/java/org/apache/tajo/storage/text/TextFieldSerializerDeserializer.java
        • tajo-docs/src/main/sphinx/functions/json_func.rst
        • tajo-storage/tajo-storage-hdfs/pom.xml
        • tajo-storage/tajo-storage-hdfs/src/main/java/org/apache/tajo/storage/json/JsonLineSerializer.java
        • tajo-core/pom.xml
        • CHANGES
        Show
        hudson Hudson added a comment - SUCCESS: Integrated in Tajo-master-build #657 (See https://builds.apache.org/job/Tajo-master-build/657/ ) TAJO-1529 : Implement json_extract_path_text(string, string) function. (jhkim: rev d160f6e189d4de6275e169a3e0fd74d9647481c4) tajo-project/pom.xml tajo-core/src/test/java/org/apache/tajo/engine/function/TestJsonFunctions.java tajo-storage/tajo-storage-hdfs/src/main/java/org/apache/tajo/storage/json/JsonLineDeserializer.java tajo-core/src/main/java/org/apache/tajo/engine/function/json/JsonExtractPathText.java tajo-docs/src/main/sphinx/functions.rst tajo-storage/tajo-storage-hdfs/src/main/java/org/apache/tajo/storage/text/TextFieldSerializerDeserializer.java tajo-docs/src/main/sphinx/functions/json_func.rst tajo-storage/tajo-storage-hdfs/pom.xml tajo-storage/tajo-storage-hdfs/src/main/java/org/apache/tajo/storage/json/JsonLineSerializer.java tajo-core/pom.xml CHANGES
        Hide
        hudson Hudson added a comment -

        FAILURE: Integrated in Tajo-master-CODEGEN-build #295 (See https://builds.apache.org/job/Tajo-master-CODEGEN-build/295/)
        TAJO-1529: Implement json_extract_path_text(string, string) function. (jhkim: rev d160f6e189d4de6275e169a3e0fd74d9647481c4)

        • tajo-storage/tajo-storage-hdfs/src/main/java/org/apache/tajo/storage/json/JsonLineDeserializer.java
        • tajo-docs/src/main/sphinx/functions.rst
        • tajo-core/pom.xml
        • tajo-docs/src/main/sphinx/functions/json_func.rst
        • tajo-storage/tajo-storage-hdfs/pom.xml
        • tajo-project/pom.xml
        • tajo-storage/tajo-storage-hdfs/src/main/java/org/apache/tajo/storage/text/TextFieldSerializerDeserializer.java
        • tajo-storage/tajo-storage-hdfs/src/main/java/org/apache/tajo/storage/json/JsonLineSerializer.java
        • CHANGES
        • tajo-core/src/test/java/org/apache/tajo/engine/function/TestJsonFunctions.java
        • tajo-core/src/main/java/org/apache/tajo/engine/function/json/JsonExtractPathText.java
        Show
        hudson Hudson added a comment - FAILURE: Integrated in Tajo-master-CODEGEN-build #295 (See https://builds.apache.org/job/Tajo-master-CODEGEN-build/295/ ) TAJO-1529 : Implement json_extract_path_text(string, string) function. (jhkim: rev d160f6e189d4de6275e169a3e0fd74d9647481c4) tajo-storage/tajo-storage-hdfs/src/main/java/org/apache/tajo/storage/json/JsonLineDeserializer.java tajo-docs/src/main/sphinx/functions.rst tajo-core/pom.xml tajo-docs/src/main/sphinx/functions/json_func.rst tajo-storage/tajo-storage-hdfs/pom.xml tajo-project/pom.xml tajo-storage/tajo-storage-hdfs/src/main/java/org/apache/tajo/storage/text/TextFieldSerializerDeserializer.java tajo-storage/tajo-storage-hdfs/src/main/java/org/apache/tajo/storage/json/JsonLineSerializer.java CHANGES tajo-core/src/test/java/org/apache/tajo/engine/function/TestJsonFunctions.java tajo-core/src/main/java/org/apache/tajo/engine/function/json/JsonExtractPathText.java
        Hide
        jhkim Jinho Kim added a comment -

        committed it.
        Thanks

        Show
        jhkim Jinho Kim added a comment - committed it. Thanks
        Hide
        githubbot ASF GitHub Bot added a comment -

        Github user asfgit closed the pull request at:

        https://github.com/apache/tajo/pull/512

        Show
        githubbot ASF GitHub Bot added a comment - Github user asfgit closed the pull request at: https://github.com/apache/tajo/pull/512
        Hide
        githubbot ASF GitHub Bot added a comment -

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

        https://github.com/apache/tajo/pull/512#discussion_r27851381

        — Diff: tajo-core/src/main/java/org/apache/tajo/engine/function/json/JsonExtractPathText.java —
        @@ -0,0 +1,86 @@
        +/**
        + * 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
        + * <p/>
        + * http://www.apache.org/licenses/LICENSE-2.0
        + * <p/>
        + * 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.tajo.engine.function.json;
        +
        +import com.jayway.jsonpath.JsonPath;
        +import net.minidev.json.JSONObject;
        +import net.minidev.json.parser.JSONParser;
        +import org.apache.tajo.catalog.Column;
        +import org.apache.tajo.common.TajoDataTypes;
        +import org.apache.tajo.datum.Datum;
        +import org.apache.tajo.datum.DatumFactory;
        +import org.apache.tajo.datum.NullDatum;
        +import org.apache.tajo.engine.function.annotation.Description;
        +import org.apache.tajo.engine.function.annotation.ParamTypes;
        +import org.apache.tajo.plan.function.GeneralFunction;
        +import org.apache.tajo.storage.Tuple;
        +
        +/**
        + * json_extract_path_text(string, string) -
        + * Extracts JSON string from a JSON string based on json path specified,
        + * and returns JSON string pointed to by xPath.
        + *
        + *
        + * Returns null if either argument is null.
        + *
        + * Example:
        + * SELECT json_extract_path_text('{"sample" : {"name" : "tajo"}}','$.sample.name') FROM src LIMIT 1;\n"
        + * -> result: 'tajo'
        + */
        +@Description(
        + functionName = "json_extract_path_text",
        + description = "Returns JSON string pointed to by xPath",
        + detail = "Extracts JSON string from a JSON string based on json path specified,\n"
        + + "and returns JSON string pointed to by xPath.",
        + example = "> SELECT json_extract_path_text('{\"sample\" : {\"name\" : \"tajo\"}}','$.sample.name');\n"
        + + "tajo",
        + returnType = TajoDataTypes.Type.TEXT,
        + paramTypes = {@ParamTypes(paramTypes =

        {TajoDataTypes.Type.TEXT, TajoDataTypes.Type.TEXT}

        )}
        +)
        +public class JsonExtractPathText extends GeneralFunction {
        + private JSONParser parser;
        +
        + public JsonExtractPathText() {
        + super(new Column[]

        { + new Column("string", TajoDataTypes.Type.TEXT), + new Column("string", TajoDataTypes.Type.TEXT), + }

        );
        + parser = new JSONParser(JSONParser.MODE_JSON_SIMPLE | JSONParser.IGNORE_CONTROL_CHAR);
        — End diff –

        I agree, we need pre-initialization with const params

        Show
        githubbot ASF GitHub Bot added a comment - Github user jinossy commented on a diff in the pull request: https://github.com/apache/tajo/pull/512#discussion_r27851381 — Diff: tajo-core/src/main/java/org/apache/tajo/engine/function/json/JsonExtractPathText.java — @@ -0,0 +1,86 @@ +/** + * 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 + * <p/> + * http://www.apache.org/licenses/LICENSE-2.0 + * <p/> + * 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.tajo.engine.function.json; + +import com.jayway.jsonpath.JsonPath; +import net.minidev.json.JSONObject; +import net.minidev.json.parser.JSONParser; +import org.apache.tajo.catalog.Column; +import org.apache.tajo.common.TajoDataTypes; +import org.apache.tajo.datum.Datum; +import org.apache.tajo.datum.DatumFactory; +import org.apache.tajo.datum.NullDatum; +import org.apache.tajo.engine.function.annotation.Description; +import org.apache.tajo.engine.function.annotation.ParamTypes; +import org.apache.tajo.plan.function.GeneralFunction; +import org.apache.tajo.storage.Tuple; + +/** + * json_extract_path_text(string, string) - + * Extracts JSON string from a JSON string based on json path specified, + * and returns JSON string pointed to by xPath. + * + * + * Returns null if either argument is null. + * + * Example: + * SELECT json_extract_path_text('{"sample" : {"name" : "tajo"}}','$.sample.name') FROM src LIMIT 1;\n" + * -> result: 'tajo' + */ +@Description( + functionName = "json_extract_path_text", + description = "Returns JSON string pointed to by xPath", + detail = "Extracts JSON string from a JSON string based on json path specified,\n" + + "and returns JSON string pointed to by xPath.", + example = "> SELECT json_extract_path_text('{\"sample\" : {\"name\" : \"tajo\"}}','$.sample.name');\n" + + "tajo", + returnType = TajoDataTypes.Type.TEXT, + paramTypes = {@ParamTypes(paramTypes = {TajoDataTypes.Type.TEXT, TajoDataTypes.Type.TEXT} )} +) +public class JsonExtractPathText extends GeneralFunction { + private JSONParser parser; + + public JsonExtractPathText() { + super(new Column[] { + new Column("string", TajoDataTypes.Type.TEXT), + new Column("string", TajoDataTypes.Type.TEXT), + } ); + parser = new JSONParser(JSONParser.MODE_JSON_SIMPLE | JSONParser.IGNORE_CONTROL_CHAR); — End diff – I agree, we need pre-initialization with const params
        Hide
        githubbot ASF GitHub Bot added a comment -

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

        https://github.com/apache/tajo/pull/512#discussion_r27850825

        — Diff: tajo-core/src/main/java/org/apache/tajo/engine/function/json/JsonExtractPathText.java —
        @@ -0,0 +1,86 @@
        +/**
        + * 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
        + * <p/>
        + * http://www.apache.org/licenses/LICENSE-2.0
        + * <p/>
        + * 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.tajo.engine.function.json;
        +
        +import com.jayway.jsonpath.JsonPath;
        +import net.minidev.json.JSONObject;
        +import net.minidev.json.parser.JSONParser;
        +import org.apache.tajo.catalog.Column;
        +import org.apache.tajo.common.TajoDataTypes;
        +import org.apache.tajo.datum.Datum;
        +import org.apache.tajo.datum.DatumFactory;
        +import org.apache.tajo.datum.NullDatum;
        +import org.apache.tajo.engine.function.annotation.Description;
        +import org.apache.tajo.engine.function.annotation.ParamTypes;
        +import org.apache.tajo.plan.function.GeneralFunction;
        +import org.apache.tajo.storage.Tuple;
        +
        +/**
        + * json_extract_path_text(string, string) -
        + * Extracts JSON string from a JSON string based on json path specified,
        + * and returns JSON string pointed to by xPath.
        + *
        + *
        + * Returns null if either argument is null.
        + *
        + * Example:
        + * SELECT json_extract_path_text('{"sample" : {"name" : "tajo"}}','$.sample.name') FROM src LIMIT 1;\n"
        + * -> result: 'tajo'
        + */
        +@Description(
        + functionName = "json_extract_path_text",
        + description = "Returns JSON string pointed to by xPath",
        + detail = "Extracts JSON string from a JSON string based on json path specified,\n"
        + + "and returns JSON string pointed to by xPath.",
        + example = "> SELECT json_extract_path_text('{\"sample\" : {\"name\" : \"tajo\"}}','$.sample.name');\n"
        + + "tajo",
        + returnType = TajoDataTypes.Type.TEXT,
        + paramTypes = {@ParamTypes(paramTypes =

        {TajoDataTypes.Type.TEXT, TajoDataTypes.Type.TEXT}

        )}
        +)
        +public class JsonExtractPathText extends GeneralFunction {
        + private JSONParser parser;
        +
        + public JsonExtractPathText() {
        + super(new Column[]

        { + new Column("string", TajoDataTypes.Type.TEXT), + new Column("string", TajoDataTypes.Type.TEXT), + }

        );
        + parser = new JSONParser(JSONParser.MODE_JSON_SIMPLE | JSONParser.IGNORE_CONTROL_CHAR);
        — End diff –

        I misunderstood it. It's just a function. So, it does not have bind() method. We may need pre-initialization method like bind in Eval.

        Show
        githubbot ASF GitHub Bot added a comment - Github user hyunsik commented on a diff in the pull request: https://github.com/apache/tajo/pull/512#discussion_r27850825 — Diff: tajo-core/src/main/java/org/apache/tajo/engine/function/json/JsonExtractPathText.java — @@ -0,0 +1,86 @@ +/** + * 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 + * <p/> + * http://www.apache.org/licenses/LICENSE-2.0 + * <p/> + * 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.tajo.engine.function.json; + +import com.jayway.jsonpath.JsonPath; +import net.minidev.json.JSONObject; +import net.minidev.json.parser.JSONParser; +import org.apache.tajo.catalog.Column; +import org.apache.tajo.common.TajoDataTypes; +import org.apache.tajo.datum.Datum; +import org.apache.tajo.datum.DatumFactory; +import org.apache.tajo.datum.NullDatum; +import org.apache.tajo.engine.function.annotation.Description; +import org.apache.tajo.engine.function.annotation.ParamTypes; +import org.apache.tajo.plan.function.GeneralFunction; +import org.apache.tajo.storage.Tuple; + +/** + * json_extract_path_text(string, string) - + * Extracts JSON string from a JSON string based on json path specified, + * and returns JSON string pointed to by xPath. + * + * + * Returns null if either argument is null. + * + * Example: + * SELECT json_extract_path_text('{"sample" : {"name" : "tajo"}}','$.sample.name') FROM src LIMIT 1;\n" + * -> result: 'tajo' + */ +@Description( + functionName = "json_extract_path_text", + description = "Returns JSON string pointed to by xPath", + detail = "Extracts JSON string from a JSON string based on json path specified,\n" + + "and returns JSON string pointed to by xPath.", + example = "> SELECT json_extract_path_text('{\"sample\" : {\"name\" : \"tajo\"}}','$.sample.name');\n" + + "tajo", + returnType = TajoDataTypes.Type.TEXT, + paramTypes = {@ParamTypes(paramTypes = {TajoDataTypes.Type.TEXT, TajoDataTypes.Type.TEXT} )} +) +public class JsonExtractPathText extends GeneralFunction { + private JSONParser parser; + + public JsonExtractPathText() { + super(new Column[] { + new Column("string", TajoDataTypes.Type.TEXT), + new Column("string", TajoDataTypes.Type.TEXT), + } ); + parser = new JSONParser(JSONParser.MODE_JSON_SIMPLE | JSONParser.IGNORE_CONTROL_CHAR); — End diff – I misunderstood it. It's just a function. So, it does not have bind() method. We may need pre-initialization method like bind in Eval.
        Hide
        hyunsik Hyunsik Choi added a comment - - edited

        It does not require significant change. So, it could be committed to 0.10.1 too.

        Show
        hyunsik Hyunsik Choi added a comment - - edited It does not require significant change. So, it could be committed to 0.10.1 too.
        Hide
        githubbot ASF GitHub Bot added a comment -

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

        https://github.com/apache/tajo/pull/512#discussion_r27849794

        — Diff: tajo-core/src/main/java/org/apache/tajo/engine/function/json/JsonExtractPathText.java —
        @@ -0,0 +1,86 @@
        +/**
        + * 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
        + * <p/>
        + * http://www.apache.org/licenses/LICENSE-2.0
        + * <p/>
        + * 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.tajo.engine.function.json;
        +
        +import com.jayway.jsonpath.JsonPath;
        +import net.minidev.json.JSONObject;
        +import net.minidev.json.parser.JSONParser;
        +import org.apache.tajo.catalog.Column;
        +import org.apache.tajo.common.TajoDataTypes;
        +import org.apache.tajo.datum.Datum;
        +import org.apache.tajo.datum.DatumFactory;
        +import org.apache.tajo.datum.NullDatum;
        +import org.apache.tajo.engine.function.annotation.Description;
        +import org.apache.tajo.engine.function.annotation.ParamTypes;
        +import org.apache.tajo.plan.function.GeneralFunction;
        +import org.apache.tajo.storage.Tuple;
        +
        +/**
        + * json_extract_path_text(string, string) -
        + * Extracts JSON string from a JSON string based on json path specified,
        + * and returns JSON string pointed to by xPath.
        + *
        + *
        + * Returns null if either argument is null.
        + *
        + * Example:
        + * SELECT json_extract_path_text('{"sample" : {"name" : "tajo"}}','$.sample.name') FROM src LIMIT 1;\n"
        + * -> result: 'tajo'
        + */
        +@Description(
        + functionName = "json_extract_path_text",
        + description = "Returns JSON string pointed to by xPath",
        + detail = "Extracts JSON string from a JSON string based on json path specified,\n"
        + + "and returns JSON string pointed to by xPath.",
        + example = "> SELECT json_extract_path_text('{\"sample\" : {\"name\" : \"tajo\"}}','$.sample.name');\n"
        + + "tajo",
        + returnType = TajoDataTypes.Type.TEXT,
        + paramTypes = {@ParamTypes(paramTypes =

        {TajoDataTypes.Type.TEXT, TajoDataTypes.Type.TEXT}

        )}
        +)
        +public class JsonExtractPathText extends GeneralFunction {
        + private JSONParser parser;
        +
        + public JsonExtractPathText() {
        + super(new Column[]

        { + new Column("string", TajoDataTypes.Type.TEXT), + new Column("string", TajoDataTypes.Type.TEXT), + }

        );
        + parser = new JSONParser(JSONParser.MODE_JSON_SIMPLE | JSONParser.IGNORE_CONTROL_CHAR);
        — End diff –

        It would be better if this initialization is moved into bind(Schema) method.

        Show
        githubbot ASF GitHub Bot added a comment - Github user hyunsik commented on a diff in the pull request: https://github.com/apache/tajo/pull/512#discussion_r27849794 — Diff: tajo-core/src/main/java/org/apache/tajo/engine/function/json/JsonExtractPathText.java — @@ -0,0 +1,86 @@ +/** + * 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 + * <p/> + * http://www.apache.org/licenses/LICENSE-2.0 + * <p/> + * 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.tajo.engine.function.json; + +import com.jayway.jsonpath.JsonPath; +import net.minidev.json.JSONObject; +import net.minidev.json.parser.JSONParser; +import org.apache.tajo.catalog.Column; +import org.apache.tajo.common.TajoDataTypes; +import org.apache.tajo.datum.Datum; +import org.apache.tajo.datum.DatumFactory; +import org.apache.tajo.datum.NullDatum; +import org.apache.tajo.engine.function.annotation.Description; +import org.apache.tajo.engine.function.annotation.ParamTypes; +import org.apache.tajo.plan.function.GeneralFunction; +import org.apache.tajo.storage.Tuple; + +/** + * json_extract_path_text(string, string) - + * Extracts JSON string from a JSON string based on json path specified, + * and returns JSON string pointed to by xPath. + * + * + * Returns null if either argument is null. + * + * Example: + * SELECT json_extract_path_text('{"sample" : {"name" : "tajo"}}','$.sample.name') FROM src LIMIT 1;\n" + * -> result: 'tajo' + */ +@Description( + functionName = "json_extract_path_text", + description = "Returns JSON string pointed to by xPath", + detail = "Extracts JSON string from a JSON string based on json path specified,\n" + + "and returns JSON string pointed to by xPath.", + example = "> SELECT json_extract_path_text('{\"sample\" : {\"name\" : \"tajo\"}}','$.sample.name');\n" + + "tajo", + returnType = TajoDataTypes.Type.TEXT, + paramTypes = {@ParamTypes(paramTypes = {TajoDataTypes.Type.TEXT, TajoDataTypes.Type.TEXT} )} +) +public class JsonExtractPathText extends GeneralFunction { + private JSONParser parser; + + public JsonExtractPathText() { + super(new Column[] { + new Column("string", TajoDataTypes.Type.TEXT), + new Column("string", TajoDataTypes.Type.TEXT), + } ); + parser = new JSONParser(JSONParser.MODE_JSON_SIMPLE | JSONParser.IGNORE_CONTROL_CHAR); — End diff – It would be better if this initialization is moved into bind(Schema) method.
        Hide
        githubbot ASF GitHub Bot added a comment -

        Github user jihoonson commented on the pull request:

        https://github.com/apache/tajo/pull/512#issuecomment-90106275

        +1
        Thanks for your nice work!

        Show
        githubbot ASF GitHub Bot added a comment - Github user jihoonson commented on the pull request: https://github.com/apache/tajo/pull/512#issuecomment-90106275 +1 Thanks for your nice work!
        Hide
        tajoqa Tajo QA added a comment -

        -1 overall. Here are the results of testing the latest attachment
        http://issues.apache.org/jira/secure/attachment/12723321/TAJO-1529_2.patch
        against master revision release-0.9.0-rc0-242-g72948b6.

        +1 @author. The patch does not contain any @author tags.

        +1 tests included. The patch appears to include 1 new or modified test files.

        +1 javac. The applied patch does not increase the total number of javac compiler warnings.

        +1 javadoc. The applied patch does not increase the total number of javadoc warnings.

        +1 checkstyle. The patch generated 0 code style errors.

        -1 findbugs. The patch appears to introduce 19 new Findbugs (version 2.0.3) warnings.

        +1 release audit. The applied patch does not increase the total number of release audit warnings.

        +1 core tests. The patch passed unit tests in tajo-core tajo-storage/tajo-storage-hdfs.

        Test results: https://builds.apache.org/job/PreCommit-TAJO-Build/714//testReport/
        Findbugs warnings: https://builds.apache.org/job/PreCommit-TAJO-Build/714//artifact/incubator-tajo/patchprocess/newPatchFindbugsWarningstajo-core.html
        Findbugs warnings: https://builds.apache.org/job/PreCommit-TAJO-Build/714//artifact/incubator-tajo/patchprocess/newPatchFindbugsWarningstajo-storage-hdfs.html
        Console output: https://builds.apache.org/job/PreCommit-TAJO-Build/714//console

        This message is automatically generated.

        Show
        tajoqa Tajo QA added a comment - -1 overall. Here are the results of testing the latest attachment http://issues.apache.org/jira/secure/attachment/12723321/TAJO-1529_2.patch against master revision release-0.9.0-rc0-242-g72948b6. +1 @author. The patch does not contain any @author tags. +1 tests included. The patch appears to include 1 new or modified test files. +1 javac. The applied patch does not increase the total number of javac compiler warnings. +1 javadoc. The applied patch does not increase the total number of javadoc warnings. +1 checkstyle. The patch generated 0 code style errors. -1 findbugs. The patch appears to introduce 19 new Findbugs (version 2.0.3) warnings. +1 release audit. The applied patch does not increase the total number of release audit warnings. +1 core tests. The patch passed unit tests in tajo-core tajo-storage/tajo-storage-hdfs. Test results: https://builds.apache.org/job/PreCommit-TAJO-Build/714//testReport/ Findbugs warnings: https://builds.apache.org/job/PreCommit-TAJO-Build/714//artifact/incubator-tajo/patchprocess/newPatchFindbugsWarningstajo-core.html Findbugs warnings: https://builds.apache.org/job/PreCommit-TAJO-Build/714//artifact/incubator-tajo/patchprocess/newPatchFindbugsWarningstajo-storage-hdfs.html Console output: https://builds.apache.org/job/PreCommit-TAJO-Build/714//console This message is automatically generated.
        Hide
        tajoqa Tajo QA added a comment -

        -1 overall. Here are the results of testing the latest attachment
        http://issues.apache.org/jira/secure/attachment/12723305/TAJO-1529.patch
        against master revision release-0.9.0-rc0-242-g72948b6.

        +1 @author. The patch does not contain any @author tags.

        +1 tests included. The patch appears to include 1 new or modified test files.

        +1 javac. The applied patch does not increase the total number of javac compiler warnings.

        +1 javadoc. The applied patch does not increase the total number of javadoc warnings.

        +1 checkstyle. The patch generated 0 code style errors.

        -1 findbugs. The patch appears to introduce 19 new Findbugs (version 2.0.3) warnings.

        +1 release audit. The applied patch does not increase the total number of release audit warnings.

        -1 core tests. The patch failed these unit tests in tajo-core tajo-storage/tajo-storage-hdfs:
        org.apache.tajo.storage.TestStorages

        Test results: https://builds.apache.org/job/PreCommit-TAJO-Build/712//testReport/
        Findbugs warnings: https://builds.apache.org/job/PreCommit-TAJO-Build/712//artifact/incubator-tajo/patchprocess/newPatchFindbugsWarningstajo-core.html
        Findbugs warnings: https://builds.apache.org/job/PreCommit-TAJO-Build/712//artifact/incubator-tajo/patchprocess/newPatchFindbugsWarningstajo-storage-hdfs.html
        Console output: https://builds.apache.org/job/PreCommit-TAJO-Build/712//console

        This message is automatically generated.

        Show
        tajoqa Tajo QA added a comment - -1 overall. Here are the results of testing the latest attachment http://issues.apache.org/jira/secure/attachment/12723305/TAJO-1529.patch against master revision release-0.9.0-rc0-242-g72948b6. +1 @author. The patch does not contain any @author tags. +1 tests included. The patch appears to include 1 new or modified test files. +1 javac. The applied patch does not increase the total number of javac compiler warnings. +1 javadoc. The applied patch does not increase the total number of javadoc warnings. +1 checkstyle. The patch generated 0 code style errors. -1 findbugs. The patch appears to introduce 19 new Findbugs (version 2.0.3) warnings. +1 release audit. The applied patch does not increase the total number of release audit warnings. -1 core tests. The patch failed these unit tests in tajo-core tajo-storage/tajo-storage-hdfs: org.apache.tajo.storage.TestStorages Test results: https://builds.apache.org/job/PreCommit-TAJO-Build/712//testReport/ Findbugs warnings: https://builds.apache.org/job/PreCommit-TAJO-Build/712//artifact/incubator-tajo/patchprocess/newPatchFindbugsWarningstajo-core.html Findbugs warnings: https://builds.apache.org/job/PreCommit-TAJO-Build/712//artifact/incubator-tajo/patchprocess/newPatchFindbugsWarningstajo-storage-hdfs.html Console output: https://builds.apache.org/job/PreCommit-TAJO-Build/712//console This message is automatically generated.
        Hide
        githubbot ASF GitHub Bot added a comment -

        GitHub user jinossy opened a pull request:

        https://github.com/apache/tajo/pull/512

        TAJO-1529: Implement json_extract_path_text(string, string) function

        You can merge this pull request into a Git repository by running:

        $ git pull https://github.com/jinossy/tajo TAJO-1529

        Alternatively you can review and apply these changes as the patch at:

        https://github.com/apache/tajo/pull/512.patch

        To close this pull request, make a commit to your master/trunk branch
        with (at least) the following in the commit message:

        This closes #512


        commit dcad10beb9263592f453492245d6b62802927c68
        Author: Jinho Kim <jhkim@apache.org>
        Date: 2015-04-06T06:23:33Z

        TAJO-1529: Implement json_extract_path_text(string, string) function

        commit 74a6ec6d1c3da3fdcf011836cb0d4c9c0a26a5ef
        Author: Jinho Kim <jhkim@apache.org>
        Date: 2015-04-06T06:23:48Z

        Merge branch 'master' of https://git-wip-us.apache.org/repos/asf/tajo into TAJO-1529


        Show
        githubbot ASF GitHub Bot added a comment - GitHub user jinossy opened a pull request: https://github.com/apache/tajo/pull/512 TAJO-1529 : Implement json_extract_path_text(string, string) function You can merge this pull request into a Git repository by running: $ git pull https://github.com/jinossy/tajo TAJO-1529 Alternatively you can review and apply these changes as the patch at: https://github.com/apache/tajo/pull/512.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #512 commit dcad10beb9263592f453492245d6b62802927c68 Author: Jinho Kim <jhkim@apache.org> Date: 2015-04-06T06:23:33Z TAJO-1529 : Implement json_extract_path_text(string, string) function commit 74a6ec6d1c3da3fdcf011836cb0d4c9c0a26a5ef Author: Jinho Kim <jhkim@apache.org> Date: 2015-04-06T06:23:48Z Merge branch 'master' of https://git-wip-us.apache.org/repos/asf/tajo into TAJO-1529

          People

          • Assignee:
            jhkim Jinho Kim
            Reporter:
            jhkim Jinho Kim
          • Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development