[jira] [Commented] (PHOENIX-628) Support native JSON data type

2024-06-12 Thread Viraj Jasani (Jira)


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

Viraj Jasani commented on PHOENIX-628:
--

Given that this is new feature, let's keep it only in master branch for 5.3.0 
release. Keeping it on 5.2 branch would now mean, releasing the feature on 
maintenance release: 5.2.1. Let's revert the feature from 5.2 branch as we 
usually don't put new features on maintenance/patch releases. If required, we 
can revisit this later.

> Support native JSON data type
> -
>
> Key: PHOENIX-628
> URL: https://issues.apache.org/jira/browse/PHOENIX-628
> Project: Phoenix
>  Issue Type: New Feature
>Affects Versions: 5.1.4
>Reporter: James R. Taylor
>Assignee: Ranganath Govardhanagiri
>Priority: Blocker
>  Labels: JSON, Java, SQL
> Fix For: 4.4.1, 5.3.0
>
> Attachments: JSON Support for Phoenix.docx, Screen Shot 2022-02-02 at 
> 12.23.24 PM.png, image-2023-12-07-11-26-56-198.png
>
>
> MongoDB and Postgres do some interesting things with JSON. We should look at 
> adding similar support. For a detailed description, see JSONB support in 
> Postgres: 
> [http://www.craigkerstiens.com/2014/03/24/Postgres-9.4-Looking-up]
> [http://www.depesz.com/2014/03/25/waiting-for-9-4-introduce-jsonb-a-structured-format-for-storing-json/]
> [http://michael.otacoo.com/postgresql-2/manipulating-jsonb-data-with-key-unique/]



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Commented] (PHOENIX-628) Support native JSON data type

2024-05-11 Thread Viraj Jasani (Jira)


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

Viraj Jasani commented on PHOENIX-628:
--

Once 5.2 backport PR is ready, I will reopen this Jira to update the fix 
version. We can move additional follow-up support (e.g. JSON_MODIFY as Atomic 
Upsert) as separate Jira tasks and link to this Jira.

> Support native JSON data type
> -
>
> Key: PHOENIX-628
> URL: https://issues.apache.org/jira/browse/PHOENIX-628
> Project: Phoenix
>  Issue Type: New Feature
>Affects Versions: 5.1.4
>Reporter: James R. Taylor
>Assignee: Ranganath Govardhanagiri
>Priority: Blocker
>  Labels: JSON, Java, SQL
> Fix For: 4.4.1, 5.3.0
>
> Attachments: JSON Support for Phoenix.docx, Screen Shot 2022-02-02 at 
> 12.23.24 PM.png, image-2023-12-07-11-26-56-198.png
>
>
> MongoDB and Postgres do some interesting things with JSON. We should look at 
> adding similar support. For a detailed description, see JSONB support in 
> Postgres: 
> [http://www.craigkerstiens.com/2014/03/24/Postgres-9.4-Looking-up]
> [http://www.depesz.com/2014/03/25/waiting-for-9-4-introduce-jsonb-a-structured-format-for-storing-json/]
> [http://michael.otacoo.com/postgresql-2/manipulating-jsonb-data-with-key-unique/]



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Commented] (PHOENIX-628) Support native JSON data type

2024-05-11 Thread Viraj Jasani (Jira)


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

Viraj Jasani commented on PHOENIX-628:
--

As we don't have any System table schema changes, we can target backport to 5.2 
branch as well. 5.2.1 release can also enjoy this feature.

> Support native JSON data type
> -
>
> Key: PHOENIX-628
> URL: https://issues.apache.org/jira/browse/PHOENIX-628
> Project: Phoenix
>  Issue Type: New Feature
>Affects Versions: 5.1.4
>Reporter: James R. Taylor
>Assignee: Ranganath Govardhanagiri
>  Labels: JSON, Java, SQL
> Fix For: 4.4.1, 5.3.0
>
> Attachments: JSON Support for Phoenix.docx, Screen Shot 2022-02-02 at 
> 12.23.24 PM.png, image-2023-12-07-11-26-56-198.png
>
>
> MongoDB and Postgres do some interesting things with JSON. We should look at 
> adding similar support. For a detailed description, see JSONB support in 
> Postgres: 
> [http://www.craigkerstiens.com/2014/03/24/Postgres-9.4-Looking-up]
> [http://www.depesz.com/2014/03/25/waiting-for-9-4-introduce-jsonb-a-structured-format-for-storing-json/]
> [http://michael.otacoo.com/postgresql-2/manipulating-jsonb-data-with-key-unique/]



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Commented] (PHOENIX-628) Support native JSON data type

2024-02-27 Thread ASF GitHub Bot (Jira)


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

ASF GitHub Bot commented on PHOENIX-628:


virajjasani commented on PR #1780:
URL: https://github.com/apache/phoenix/pull/1780#issuecomment-1967019624

   Re-triggered after fixing build failure on master branch: 
https://ci-hadoop.apache.org/job/Phoenix/job/Phoenix-PreCommit-GitHub-PR/job/PR-1780/16/




> Support native JSON data type
> -
>
> Key: PHOENIX-628
> URL: https://issues.apache.org/jira/browse/PHOENIX-628
> Project: Phoenix
>  Issue Type: Task
>Affects Versions: 5.1.4
>Reporter: James R. Taylor
>Assignee: Ranganath Govardhanagiri
>  Labels: JSON, Java, SQL
> Fix For: 4.4.1, 5.2.0
>
> Attachments: JSON Support for Phoenix.docx, Screen Shot 2022-02-02 at 
> 12.23.24 PM.png, image-2023-12-07-11-26-56-198.png
>
>
> MongoDB and Postgres do some interesting things with JSON. We should look at 
> adding similar support. For a detailed description, see JSONB support in 
> Postgres: 
> [http://www.craigkerstiens.com/2014/03/24/Postgres-9.4-Looking-up]
> [http://www.depesz.com/2014/03/25/waiting-for-9-4-introduce-jsonb-a-structured-format-for-storing-json/]
> [http://michael.otacoo.com/postgresql-2/manipulating-jsonb-data-with-key-unique/]



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Commented] (PHOENIX-628) Support native JSON data type

2024-01-24 Thread ASF GitHub Bot (Jira)


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

ASF GitHub Bot commented on PHOENIX-628:


kadirozde commented on code in PR #1780:
URL: https://github.com/apache/phoenix/pull/1780#discussion_r1465208297


##
phoenix-core-client/src/main/java/org/apache/phoenix/util/json/BsonJsonProvider.java:
##
@@ -0,0 +1,250 @@
+/*
+ * 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.phoenix.util.json;
+
+import com.jayway.jsonpath.InvalidJsonException;
+import com.jayway.jsonpath.spi.json.AbstractJsonProvider;
+import org.bson.BsonArray;
+import org.bson.BsonBinary;
+import org.bson.BsonBoolean;
+import org.bson.BsonDocument;
+import org.bson.BsonDouble;
+import org.bson.BsonInt32;
+import org.bson.BsonInt64;
+import org.bson.BsonObjectId;
+import org.bson.BsonString;
+import org.bson.BsonType;
+import org.bson.BsonValue;
+import org.bson.Document;
+import org.bson.json.JsonReader;
+import org.bson.types.ObjectId;
+
+import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+
+public class BsonJsonProvider extends AbstractJsonProvider {
+
+@Override
+public Object parse(final String json) throws InvalidJsonException {
+JsonReader jsonReader = new JsonReader(json);
+BsonType bsonType = jsonReader.readBsonType();
+switch (bsonType) {
+case ARRAY:
+return BsonArray.parse(json);
+case DOCUMENT:
+return BsonDocument.parse(json);
+case STRING:
+return new BsonString(jsonReader.readString());
+case INT32:
+return new BsonInt32(jsonReader.readInt32());
+default:
+throw new InvalidJsonException(String.format("Unsupported bson 
type %s", bsonType));
+}
+}
+
+@Override
+public Object parse(InputStream jsonStream, String charset) throws 
InvalidJsonException {
+return null;
+}
+
+@Override
+public String toJson(Object obj) {
+return null;
+}
+
+@Override
+public Object createArray() {
+return new BsonArray();
+}
+
+@Override
+public boolean isArray(final Object obj) {
+
+return (obj instanceof BsonArray || obj instanceof List);
+}
+
+@Override
+public Object getArrayIndex(final Object obj, final int idx) {
+
+return toBsonArray(obj).get(idx);
+}
+
+@Override
+public void setArrayIndex(final Object array, final int index, final 
Object newValue) {
+if (!isArray(array)) {
+throw new UnsupportedOperationException();
+} else {
+BsonArray arr = toBsonArray(array);
+if (index == arr.size()) {
+arr.add(toBsonValue(newValue));
+} else {
+arr.set(index, toBsonValue(newValue));
+}
+}
+}
+
+@Override
+public Object createMap() {
+return new BsonDocument();
+}
+
+@Override
+public boolean isMap(final Object obj) {
+return (obj instanceof BsonDocument);
+}
+
+@Override
+public Object getMapValue(final Object obj, final String key) {
+BsonDocument bsonDocument = toBsonDocument(obj);
+Object o = bsonDocument.get(key);
+if (!bsonDocument.containsKey(key)) {
+return UNDEFINED;
+} else {
+return unwrap(o);
+}
+}
+
+@Override
+public Iterable toIterable(final Object obj) {
+BsonArray arr = toBsonArray(obj);
+List values = new ArrayList(arr.size());
+for (Object o : arr) {
+values.add(toJavaType(toBsonValue(o)));
+}
+return values;
+}
+
+@Override
+public void setProperty(final Object obj, final Object key, final Object 
value) {
+if (isMap(obj)) {
+toBsonDocument(obj).put(key.toString(), toBsonValue(value));
+} else {
+BsonArray array = toBsonArray(obj);
+int index;
+if (key != null) {
+index = key instanceof Integer ? (Integer) key : 

[jira] [Commented] (PHOENIX-628) Support native JSON data type

2024-01-24 Thread ASF GitHub Bot (Jira)


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

ASF GitHub Bot commented on PHOENIX-628:


ranganathg commented on code in PR #1780:
URL: https://github.com/apache/phoenix/pull/1780#discussion_r1464572192


##
phoenix-core-client/src/main/java/org/apache/phoenix/util/json/BsonJsonProvider.java:
##
@@ -0,0 +1,250 @@
+/*
+ * 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.phoenix.util.json;
+
+import com.jayway.jsonpath.InvalidJsonException;
+import com.jayway.jsonpath.spi.json.AbstractJsonProvider;
+import org.bson.BsonArray;
+import org.bson.BsonBinary;
+import org.bson.BsonBoolean;
+import org.bson.BsonDocument;
+import org.bson.BsonDouble;
+import org.bson.BsonInt32;
+import org.bson.BsonInt64;
+import org.bson.BsonObjectId;
+import org.bson.BsonString;
+import org.bson.BsonType;
+import org.bson.BsonValue;
+import org.bson.Document;
+import org.bson.json.JsonReader;
+import org.bson.types.ObjectId;
+
+import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+
+public class BsonJsonProvider extends AbstractJsonProvider {
+
+@Override
+public Object parse(final String json) throws InvalidJsonException {
+JsonReader jsonReader = new JsonReader(json);
+BsonType bsonType = jsonReader.readBsonType();
+switch (bsonType) {
+case ARRAY:
+return BsonArray.parse(json);
+case DOCUMENT:
+return BsonDocument.parse(json);
+case STRING:
+return new BsonString(jsonReader.readString());
+case INT32:
+return new BsonInt32(jsonReader.readInt32());
+default:
+throw new InvalidJsonException(String.format("Unsupported bson 
type %s", bsonType));
+}
+}
+
+@Override
+public Object parse(InputStream jsonStream, String charset) throws 
InvalidJsonException {
+return null;
+}
+
+@Override
+public String toJson(Object obj) {
+return null;
+}
+
+@Override
+public Object createArray() {
+return new BsonArray();
+}
+
+@Override
+public boolean isArray(final Object obj) {
+
+return (obj instanceof BsonArray || obj instanceof List);
+}
+
+@Override
+public Object getArrayIndex(final Object obj, final int idx) {
+
+return toBsonArray(obj).get(idx);
+}
+
+@Override
+public void setArrayIndex(final Object array, final int index, final 
Object newValue) {
+if (!isArray(array)) {
+throw new UnsupportedOperationException();
+} else {
+BsonArray arr = toBsonArray(array);
+if (index == arr.size()) {
+arr.add(toBsonValue(newValue));
+} else {
+arr.set(index, toBsonValue(newValue));
+}
+}
+}
+
+@Override
+public Object createMap() {
+return new BsonDocument();
+}
+
+@Override
+public boolean isMap(final Object obj) {
+return (obj instanceof BsonDocument);
+}
+
+@Override
+public Object getMapValue(final Object obj, final String key) {
+BsonDocument bsonDocument = toBsonDocument(obj);
+Object o = bsonDocument.get(key);
+if (!bsonDocument.containsKey(key)) {
+return UNDEFINED;
+} else {
+return unwrap(o);
+}
+}
+
+@Override
+public Iterable toIterable(final Object obj) {
+BsonArray arr = toBsonArray(obj);
+List values = new ArrayList(arr.size());
+for (Object o : arr) {
+values.add(toJavaType(toBsonValue(o)));
+}
+return values;
+}
+
+@Override
+public void setProperty(final Object obj, final Object key, final Object 
value) {
+if (isMap(obj)) {
+toBsonDocument(obj).put(key.toString(), toBsonValue(value));
+} else {
+BsonArray array = toBsonArray(obj);
+int index;
+if (key != null) {
+index = key instanceof Integer ? (Integer) key : 

[jira] [Commented] (PHOENIX-628) Support native JSON data type

2024-01-24 Thread ASF GitHub Bot (Jira)


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

ASF GitHub Bot commented on PHOENIX-628:


kadirozde commented on code in PR #1780:
URL: https://github.com/apache/phoenix/pull/1780#discussion_r1464542900


##
phoenix-core-client/src/main/java/org/apache/phoenix/util/json/BsonJsonProvider.java:
##
@@ -0,0 +1,250 @@
+/*
+ * 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.phoenix.util.json;
+
+import com.jayway.jsonpath.InvalidJsonException;
+import com.jayway.jsonpath.spi.json.AbstractJsonProvider;
+import org.bson.BsonArray;
+import org.bson.BsonBinary;
+import org.bson.BsonBoolean;
+import org.bson.BsonDocument;
+import org.bson.BsonDouble;
+import org.bson.BsonInt32;
+import org.bson.BsonInt64;
+import org.bson.BsonObjectId;
+import org.bson.BsonString;
+import org.bson.BsonType;
+import org.bson.BsonValue;
+import org.bson.Document;
+import org.bson.json.JsonReader;
+import org.bson.types.ObjectId;
+
+import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+
+public class BsonJsonProvider extends AbstractJsonProvider {
+
+@Override
+public Object parse(final String json) throws InvalidJsonException {
+JsonReader jsonReader = new JsonReader(json);
+BsonType bsonType = jsonReader.readBsonType();
+switch (bsonType) {
+case ARRAY:
+return BsonArray.parse(json);
+case DOCUMENT:
+return BsonDocument.parse(json);
+case STRING:
+return new BsonString(jsonReader.readString());
+case INT32:
+return new BsonInt32(jsonReader.readInt32());
+default:
+throw new InvalidJsonException(String.format("Unsupported bson 
type %s", bsonType));
+}
+}
+
+@Override
+public Object parse(InputStream jsonStream, String charset) throws 
InvalidJsonException {
+return null;
+}
+
+@Override
+public String toJson(Object obj) {
+return null;
+}
+
+@Override
+public Object createArray() {
+return new BsonArray();
+}
+
+@Override
+public boolean isArray(final Object obj) {
+
+return (obj instanceof BsonArray || obj instanceof List);
+}
+
+@Override
+public Object getArrayIndex(final Object obj, final int idx) {
+
+return toBsonArray(obj).get(idx);
+}
+
+@Override
+public void setArrayIndex(final Object array, final int index, final 
Object newValue) {
+if (!isArray(array)) {
+throw new UnsupportedOperationException();
+} else {
+BsonArray arr = toBsonArray(array);
+if (index == arr.size()) {
+arr.add(toBsonValue(newValue));
+} else {
+arr.set(index, toBsonValue(newValue));
+}
+}
+}
+
+@Override
+public Object createMap() {
+return new BsonDocument();
+}
+
+@Override
+public boolean isMap(final Object obj) {
+return (obj instanceof BsonDocument);
+}
+
+@Override
+public Object getMapValue(final Object obj, final String key) {
+BsonDocument bsonDocument = toBsonDocument(obj);
+Object o = bsonDocument.get(key);
+if (!bsonDocument.containsKey(key)) {
+return UNDEFINED;
+} else {
+return unwrap(o);
+}
+}
+
+@Override
+public Iterable toIterable(final Object obj) {
+BsonArray arr = toBsonArray(obj);
+List values = new ArrayList(arr.size());
+for (Object o : arr) {
+values.add(toJavaType(toBsonValue(o)));
+}
+return values;
+}
+
+@Override
+public void setProperty(final Object obj, final Object key, final Object 
value) {
+if (isMap(obj)) {
+toBsonDocument(obj).put(key.toString(), toBsonValue(value));
+} else {
+BsonArray array = toBsonArray(obj);
+int index;
+if (key != null) {
+index = key instanceof Integer ? (Integer) key : 

[jira] [Commented] (PHOENIX-628) Support native JSON data type

2024-01-17 Thread ASF GitHub Bot (Jira)


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

ASF GitHub Bot commented on PHOENIX-628:


ranganathg commented on code in PR #1780:
URL: https://github.com/apache/phoenix/pull/1780#discussion_r1456944432


##
phoenix-core-client/src/main/java/org/apache/phoenix/compile/ProjectionCompiler.java:
##
@@ -497,42 +502,106 @@ public static RowProjector compile(StatementContext 
context, SelectStatement sta
 index++;
 }
 
-for (int i = arrayProjectedColumnRefs.size() - 1; i >= 0; i--) {
-Expression expression = arrayProjectedColumnRefs.get(i);
-Integer count = arrayExpressionCounts.get(expression);
+for (int i = serverParsedProjectedColumnRefs.size() - 1; i >= 0; i--) {
+Expression expression = serverParsedProjectedColumnRefs.get(i);
+Integer count = serverParsedExpressionCounts.get(expression);
 if (count != 0) {
-arrayKVRefs.remove(i);
-arrayKVFuncs.remove(i);
-arrayOldFuncs.remove(i);
+serverParsedKVRefs.remove(i);
+serverParsedKVFuncs.remove(i);
+serverParsedOldFuncs.remove(i);
 }
 }
 
-if (arrayKVFuncs.size() > 0 && arrayKVRefs.size() > 0) {
-serailizeArrayIndexInformationAndSetInScan(context, arrayKVFuncs, 
arrayKVRefs);
+if (serverParsedKVFuncs.size() > 0 && serverParsedKVRefs.size() > 0) {

Review Comment:
   Replacement map is required for JSON functions too. One refactoring I can 
think of is having a new base class for both ArrayIndexExpression and 
JSONPathExpression. 





> Support native JSON data type
> -
>
> Key: PHOENIX-628
> URL: https://issues.apache.org/jira/browse/PHOENIX-628
> Project: Phoenix
>  Issue Type: Task
>Affects Versions: 5.1.4
>Reporter: James R. Taylor
>Assignee: Ranganath Govardhanagiri
>  Labels: JSON, Java, SQL
> Fix For: 4.4.1, 5.2.0
>
> Attachments: JSON Support for Phoenix.docx, Screen Shot 2022-02-02 at 
> 12.23.24 PM.png, image-2023-12-07-11-26-56-198.png
>
>
> MongoDB and Postgres do some interesting things with JSON. We should look at 
> adding similar support. For a detailed description, see JSONB support in 
> Postgres: 
> [http://www.craigkerstiens.com/2014/03/24/Postgres-9.4-Looking-up]
> [http://www.depesz.com/2014/03/25/waiting-for-9-4-introduce-jsonb-a-structured-format-for-storing-json/]
> [http://michael.otacoo.com/postgresql-2/manipulating-jsonb-data-with-key-unique/]



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Commented] (PHOENIX-628) Support native JSON data type

2024-01-11 Thread ASF GitHub Bot (Jira)


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

ASF GitHub Bot commented on PHOENIX-628:


kadirozde commented on code in PR #1780:
URL: https://github.com/apache/phoenix/pull/1780#discussion_r1449987045


##
phoenix-core-client/src/main/java/org/apache/phoenix/compile/ProjectionCompiler.java:
##
@@ -497,42 +502,106 @@ public static RowProjector compile(StatementContext 
context, SelectStatement sta
 index++;
 }
 
-for (int i = arrayProjectedColumnRefs.size() - 1; i >= 0; i--) {
-Expression expression = arrayProjectedColumnRefs.get(i);
-Integer count = arrayExpressionCounts.get(expression);
+for (int i = serverParsedProjectedColumnRefs.size() - 1; i >= 0; i--) {
+Expression expression = serverParsedProjectedColumnRefs.get(i);
+Integer count = serverParsedExpressionCounts.get(expression);
 if (count != 0) {
-arrayKVRefs.remove(i);
-arrayKVFuncs.remove(i);
-arrayOldFuncs.remove(i);
+serverParsedKVRefs.remove(i);
+serverParsedKVFuncs.remove(i);
+serverParsedOldFuncs.remove(i);
 }
 }
 
-if (arrayKVFuncs.size() > 0 && arrayKVRefs.size() > 0) {
-serailizeArrayIndexInformationAndSetInScan(context, arrayKVFuncs, 
arrayKVRefs);
+if (serverParsedKVFuncs.size() > 0 && serverParsedKVRefs.size() > 0) {

Review Comment:
   The replacement map was only for array index functions (old vs new). Now 
that JSON path function inherits from the array index function, the code gives 
the impression that the replacement is needed for the JSON path function too. 
The code has been introduce to handle this replacement even though there is no 
such replacement is needed for the JSON functions as far as I understand. That 
is another reason I suggested that JSON path should not inherit from ArrayIndex 
but from Scalar. 
   
   The refactoring I suggested is to keep track of array index and JSON 
functions separately and old vs new replacement should be applied to array 
index only. Maybe I misunderstood the whole thing. 
   





> Support native JSON data type
> -
>
> Key: PHOENIX-628
> URL: https://issues.apache.org/jira/browse/PHOENIX-628
> Project: Phoenix
>  Issue Type: Task
>Affects Versions: 5.1.4
>Reporter: James R. Taylor
>Assignee: Ranganath Govardhanagiri
>  Labels: JSON, Java, SQL
> Fix For: 4.4.1, 5.2.0
>
> Attachments: JSON Support for Phoenix.docx, Screen Shot 2022-02-02 at 
> 12.23.24 PM.png, image-2023-12-07-11-26-56-198.png
>
>
> MongoDB and Postgres do some interesting things with JSON. We should look at 
> adding similar support. For a detailed description, see JSONB support in 
> Postgres: 
> [http://www.craigkerstiens.com/2014/03/24/Postgres-9.4-Looking-up]
> [http://www.depesz.com/2014/03/25/waiting-for-9-4-introduce-jsonb-a-structured-format-for-storing-json/]
> [http://michael.otacoo.com/postgresql-2/manipulating-jsonb-data-with-key-unique/]



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Commented] (PHOENIX-628) Support native JSON data type

2024-01-11 Thread ASF GitHub Bot (Jira)


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

ASF GitHub Bot commented on PHOENIX-628:


ranganathg commented on code in PR #1780:
URL: https://github.com/apache/phoenix/pull/1780#discussion_r1448796205


##
phoenix-core-client/src/main/java/org/apache/phoenix/compile/ProjectionCompiler.java:
##
@@ -497,42 +502,106 @@ public static RowProjector compile(StatementContext 
context, SelectStatement sta
 index++;
 }
 
-for (int i = arrayProjectedColumnRefs.size() - 1; i >= 0; i--) {
-Expression expression = arrayProjectedColumnRefs.get(i);
-Integer count = arrayExpressionCounts.get(expression);
+for (int i = serverParsedProjectedColumnRefs.size() - 1; i >= 0; i--) {
+Expression expression = serverParsedProjectedColumnRefs.get(i);
+Integer count = serverParsedExpressionCounts.get(expression);
 if (count != 0) {
-arrayKVRefs.remove(i);
-arrayKVFuncs.remove(i);
-arrayOldFuncs.remove(i);
+serverParsedKVRefs.remove(i);
+serverParsedKVFuncs.remove(i);
+serverParsedOldFuncs.remove(i);
 }
 }
 
-if (arrayKVFuncs.size() > 0 && arrayKVRefs.size() > 0) {
-serailizeArrayIndexInformationAndSetInScan(context, arrayKVFuncs, 
arrayKVRefs);
+if (serverParsedKVFuncs.size() > 0 && serverParsedKVRefs.size() > 0) {

Review Comment:
   Sorry I didn't understand : SelectClauseVisitor constructor didn't change - 
which params passed to the constructor are you referring to?
   You mean to say instead of using same ServerParsedkvFunctions and Refs - use 
different variables for arrays and Json and then have different getters for 
array index and json expressions?. That can be done but these variables are bit 
spread around for ref counting and other things.





> Support native JSON data type
> -
>
> Key: PHOENIX-628
> URL: https://issues.apache.org/jira/browse/PHOENIX-628
> Project: Phoenix
>  Issue Type: Task
>Affects Versions: 5.1.4
>Reporter: James R. Taylor
>Assignee: Ranganath Govardhanagiri
>  Labels: JSON, Java, SQL
> Fix For: 4.4.1, 5.2.0
>
> Attachments: JSON Support for Phoenix.docx, Screen Shot 2022-02-02 at 
> 12.23.24 PM.png, image-2023-12-07-11-26-56-198.png
>
>
> MongoDB and Postgres do some interesting things with JSON. We should look at 
> adding similar support. For a detailed description, see JSONB support in 
> Postgres: 
> [http://www.craigkerstiens.com/2014/03/24/Postgres-9.4-Looking-up]
> [http://www.depesz.com/2014/03/25/waiting-for-9-4-introduce-jsonb-a-structured-format-for-storing-json/]
> [http://michael.otacoo.com/postgresql-2/manipulating-jsonb-data-with-key-unique/]



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Commented] (PHOENIX-628) Support native JSON data type

2024-01-11 Thread ASF GitHub Bot (Jira)


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

ASF GitHub Bot commented on PHOENIX-628:


ranganathg commented on code in PR #1780:
URL: https://github.com/apache/phoenix/pull/1780#discussion_r1448645884


##
phoenix-core-client/src/main/java/org/apache/phoenix/compile/ProjectionCompiler.java:
##
@@ -641,19 +710,32 @@ public  T accept(ExpressionVisitor visitor) {
 return null;
 }
 }
-private static void 
serailizeArrayIndexInformationAndSetInScan(StatementContext context, 
List arrayKVFuncs,
-List arrayKVRefs) {
+
+static class JsonPathExpression extends ArrayIndexExpression {

Review Comment:
   Actually JsonPath and ArrayIndex expressions in a way look identical like 
for eg: ARRAY_ELEM(column, index) and JSON_VALUE(column, Path). By identical I 
don't mean function name and number of params but like operations on a map. one 
is by index and other is by path(or key). Actually there wasn't really a need 
to have a JsonPathExpression separately as ArrayIndexExpression has all the 
logic required - I have added JsonPathExp just to have a code level separation 
in case we happen to make any modifications in the future we can only modify 
JsonPath without changing ArrayIndex.
   I'm not sure if we need to extend from ScalarFunction for JsonPathExp. It 
can be from BaseTerminalExpression but then would be a complete copy of 
ArrayIndexExp





> Support native JSON data type
> -
>
> Key: PHOENIX-628
> URL: https://issues.apache.org/jira/browse/PHOENIX-628
> Project: Phoenix
>  Issue Type: Task
>Affects Versions: 5.1.4
>Reporter: James R. Taylor
>Assignee: Ranganath Govardhanagiri
>  Labels: JSON, Java, SQL
> Fix For: 4.4.1, 5.2.0
>
> Attachments: JSON Support for Phoenix.docx, Screen Shot 2022-02-02 at 
> 12.23.24 PM.png, image-2023-12-07-11-26-56-198.png
>
>
> MongoDB and Postgres do some interesting things with JSON. We should look at 
> adding similar support. For a detailed description, see JSONB support in 
> Postgres: 
> [http://www.craigkerstiens.com/2014/03/24/Postgres-9.4-Looking-up]
> [http://www.depesz.com/2014/03/25/waiting-for-9-4-introduce-jsonb-a-structured-format-for-storing-json/]
> [http://michael.otacoo.com/postgresql-2/manipulating-jsonb-data-with-key-unique/]



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Commented] (PHOENIX-628) Support native JSON data type

2024-01-11 Thread ASF GitHub Bot (Jira)


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

ASF GitHub Bot commented on PHOENIX-628:


ranganathg commented on code in PR #1780:
URL: https://github.com/apache/phoenix/pull/1780#discussion_r1448645884


##
phoenix-core-client/src/main/java/org/apache/phoenix/compile/ProjectionCompiler.java:
##
@@ -641,19 +710,32 @@ public  T accept(ExpressionVisitor visitor) {
 return null;
 }
 }
-private static void 
serailizeArrayIndexInformationAndSetInScan(StatementContext context, 
List arrayKVFuncs,
-List arrayKVRefs) {
+
+static class JsonPathExpression extends ArrayIndexExpression {

Review Comment:
   Actually JsonPath and ArrayIndex expressions in a way look identical like 
for eg: ARRAY_ELEM(column, index) and JSON_VALUE(column, Path). By identical I 
don't mean function name and number of params but like operations on a map. one 
is my index and other is by path(or key). Actually there wasn't really a need 
to have a JsonPathExpression separately as ArrayIndexExpression has all the 
logic required - I have added JsonPathExp just to have a code level separation 
in case we happen to make any modifications in the future we can only modify 
JsonPath without changing ArrayIndex.
   I'm not sure if we need to extend from ScalarFunction for JsonPathExp. It 
can be from BaseTerminalExpression but then would be a complete copy of 
ArrayIndexExp





> Support native JSON data type
> -
>
> Key: PHOENIX-628
> URL: https://issues.apache.org/jira/browse/PHOENIX-628
> Project: Phoenix
>  Issue Type: Task
>Affects Versions: 5.1.4
>Reporter: James R. Taylor
>Assignee: Ranganath Govardhanagiri
>  Labels: JSON, Java, SQL
> Fix For: 4.4.1, 5.2.0
>
> Attachments: JSON Support for Phoenix.docx, Screen Shot 2022-02-02 at 
> 12.23.24 PM.png, image-2023-12-07-11-26-56-198.png
>
>
> MongoDB and Postgres do some interesting things with JSON. We should look at 
> adding similar support. For a detailed description, see JSONB support in 
> Postgres: 
> [http://www.craigkerstiens.com/2014/03/24/Postgres-9.4-Looking-up]
> [http://www.depesz.com/2014/03/25/waiting-for-9-4-introduce-jsonb-a-structured-format-for-storing-json/]
> [http://michael.otacoo.com/postgresql-2/manipulating-jsonb-data-with-key-unique/]



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Commented] (PHOENIX-628) Support native JSON data type

2024-01-09 Thread ASF GitHub Bot (Jira)


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

ASF GitHub Bot commented on PHOENIX-628:


kadirozde commented on code in PR #1780:
URL: https://github.com/apache/phoenix/pull/1780#discussion_r1445931236


##
phoenix-core-client/src/main/java/org/apache/phoenix/compile/ProjectionCompiler.java:
##
@@ -641,19 +710,32 @@ public  T accept(ExpressionVisitor visitor) {
 return null;
 }
 }
-private static void 
serailizeArrayIndexInformationAndSetInScan(StatementContext context, 
List arrayKVFuncs,
-List arrayKVRefs) {
+
+static class JsonPathExpression extends ArrayIndexExpression {

Review Comment:
   This inheritance relationship does not sound right to me. Can 
JsonPathExpression extend ScalarFunction?





> Support native JSON data type
> -
>
> Key: PHOENIX-628
> URL: https://issues.apache.org/jira/browse/PHOENIX-628
> Project: Phoenix
>  Issue Type: Task
>Affects Versions: 5.1.4
>Reporter: James R. Taylor
>Assignee: Ranganath Govardhanagiri
>  Labels: JSON, Java, SQL
> Fix For: 4.4.1, 5.2.0
>
> Attachments: JSON Support for Phoenix.docx, Screen Shot 2022-02-02 at 
> 12.23.24 PM.png, image-2023-12-07-11-26-56-198.png
>
>
> MongoDB and Postgres do some interesting things with JSON. We should look at 
> adding similar support. For a detailed description, see JSONB support in 
> Postgres: 
> [http://www.craigkerstiens.com/2014/03/24/Postgres-9.4-Looking-up]
> [http://www.depesz.com/2014/03/25/waiting-for-9-4-introduce-jsonb-a-structured-format-for-storing-json/]
> [http://michael.otacoo.com/postgresql-2/manipulating-jsonb-data-with-key-unique/]



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Commented] (PHOENIX-628) Support native JSON data type

2024-01-09 Thread ASF GitHub Bot (Jira)


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

ASF GitHub Bot commented on PHOENIX-628:


kadirozde commented on code in PR #1780:
URL: https://github.com/apache/phoenix/pull/1780#discussion_r1445931236


##
phoenix-core-client/src/main/java/org/apache/phoenix/compile/ProjectionCompiler.java:
##
@@ -641,19 +710,32 @@ public  T accept(ExpressionVisitor visitor) {
 return null;
 }
 }
-private static void 
serailizeArrayIndexInformationAndSetInScan(StatementContext context, 
List arrayKVFuncs,
-List arrayKVRefs) {
+
+static class JsonPathExpression extends ArrayIndexExpression {

Review Comment:
   This inheritance relationship does not sound right to me. Can we introduce 
an abstract class both JsonPathExpression and ArrayIndexExpression can extend 
or something similar?





> Support native JSON data type
> -
>
> Key: PHOENIX-628
> URL: https://issues.apache.org/jira/browse/PHOENIX-628
> Project: Phoenix
>  Issue Type: Task
>Affects Versions: 5.1.4
>Reporter: James R. Taylor
>Assignee: Ranganath Govardhanagiri
>  Labels: JSON, Java, SQL
> Fix For: 4.4.1, 5.2.0
>
> Attachments: JSON Support for Phoenix.docx, Screen Shot 2022-02-02 at 
> 12.23.24 PM.png, image-2023-12-07-11-26-56-198.png
>
>
> MongoDB and Postgres do some interesting things with JSON. We should look at 
> adding similar support. For a detailed description, see JSONB support in 
> Postgres: 
> [http://www.craigkerstiens.com/2014/03/24/Postgres-9.4-Looking-up]
> [http://www.depesz.com/2014/03/25/waiting-for-9-4-introduce-jsonb-a-structured-format-for-storing-json/]
> [http://michael.otacoo.com/postgresql-2/manipulating-jsonb-data-with-key-unique/]



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Commented] (PHOENIX-628) Support native JSON data type

2024-01-09 Thread ASF GitHub Bot (Jira)


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

ASF GitHub Bot commented on PHOENIX-628:


kadirozde commented on code in PR #1780:
URL: https://github.com/apache/phoenix/pull/1780#discussion_r1445922768


##
phoenix-core-client/src/main/java/org/apache/phoenix/compile/ProjectionCompiler.java:
##
@@ -497,42 +502,106 @@ public static RowProjector compile(StatementContext 
context, SelectStatement sta
 index++;
 }
 
-for (int i = arrayProjectedColumnRefs.size() - 1; i >= 0; i--) {
-Expression expression = arrayProjectedColumnRefs.get(i);
-Integer count = arrayExpressionCounts.get(expression);
+for (int i = serverParsedProjectedColumnRefs.size() - 1; i >= 0; i--) {
+Expression expression = serverParsedProjectedColumnRefs.get(i);
+Integer count = serverParsedExpressionCounts.get(expression);
 if (count != 0) {
-arrayKVRefs.remove(i);
-arrayKVFuncs.remove(i);
-arrayOldFuncs.remove(i);
+serverParsedKVRefs.remove(i);
+serverParsedKVFuncs.remove(i);
+serverParsedOldFuncs.remove(i);
 }
 }
 
-if (arrayKVFuncs.size() > 0 && arrayKVRefs.size() > 0) {
-serailizeArrayIndexInformationAndSetInScan(context, arrayKVFuncs, 
arrayKVRefs);
+if (serverParsedKVFuncs.size() > 0 && serverParsedKVRefs.size() > 0) {

Review Comment:
   The rest of the code is confusing since JSON functions and ArrayIndex 
functions are returned in the same output parameter. Can we refactor 
SelectClauseVisitor and add different getters for ArrayIndex and JSON functions 
instead of getting them using parameters passed to the constructor?





> Support native JSON data type
> -
>
> Key: PHOENIX-628
> URL: https://issues.apache.org/jira/browse/PHOENIX-628
> Project: Phoenix
>  Issue Type: Task
>Affects Versions: 5.1.4
>Reporter: James R. Taylor
>Assignee: Ranganath Govardhanagiri
>  Labels: JSON, Java, SQL
> Fix For: 4.4.1, 5.2.0
>
> Attachments: JSON Support for Phoenix.docx, Screen Shot 2022-02-02 at 
> 12.23.24 PM.png, image-2023-12-07-11-26-56-198.png
>
>
> MongoDB and Postgres do some interesting things with JSON. We should look at 
> adding similar support. For a detailed description, see JSONB support in 
> Postgres: 
> [http://www.craigkerstiens.com/2014/03/24/Postgres-9.4-Looking-up]
> [http://www.depesz.com/2014/03/25/waiting-for-9-4-introduce-jsonb-a-structured-format-for-storing-json/]
> [http://michael.otacoo.com/postgresql-2/manipulating-jsonb-data-with-key-unique/]



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Commented] (PHOENIX-628) Support native JSON data type

2024-01-03 Thread ASF GitHub Bot (Jira)


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

ASF GitHub Bot commented on PHOENIX-628:


virajjasani commented on PR #1780:
URL: https://github.com/apache/phoenix/pull/1780#issuecomment-1876107380

   It's good to continue the review, however just wanted to bring up this 
discuss thread: Discuss thread: 
https://lists.apache.org/thread/xhwqfwytlklylt6kwqm1botsxr7dd4zb
   
   I am hopeful that in a couple of weeks, we should be well positioned to get 
this PR move forward, but review can definitely continue in parallel.
   Thank you @ranganathg!




> Support native JSON data type
> -
>
> Key: PHOENIX-628
> URL: https://issues.apache.org/jira/browse/PHOENIX-628
> Project: Phoenix
>  Issue Type: Task
>Affects Versions: 5.1.4
>Reporter: James R. Taylor
>Assignee: Ranganath Govardhanagiri
>  Labels: JSON, Java, SQL
> Fix For: 4.4.1, 5.2.0
>
> Attachments: JSON Support for Phoenix.docx, Screen Shot 2022-02-02 at 
> 12.23.24 PM.png, image-2023-12-07-11-26-56-198.png
>
>
> MongoDB and Postgres do some interesting things with JSON. We should look at 
> adding similar support. For a detailed description, see JSONB support in 
> Postgres: 
> [http://www.craigkerstiens.com/2014/03/24/Postgres-9.4-Looking-up]
> [http://www.depesz.com/2014/03/25/waiting-for-9-4-introduce-jsonb-a-structured-format-for-storing-json/]
> [http://michael.otacoo.com/postgresql-2/manipulating-jsonb-data-with-key-unique/]



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Commented] (PHOENIX-628) Support native JSON data type

2024-01-03 Thread ASF GitHub Bot (Jira)


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

ASF GitHub Bot commented on PHOENIX-628:


stoty commented on PR #1780:
URL: https://github.com/apache/phoenix/pull/1780#issuecomment-1875276038

   The convention is to use the JIRA description for the first line of the 
commit message.
   
   If you think that the JIRA description is not sufficient, you may want to 
change the JIRA ticket description, just keep it in sync with the commit 
message.




> Support native JSON data type
> -
>
> Key: PHOENIX-628
> URL: https://issues.apache.org/jira/browse/PHOENIX-628
> Project: Phoenix
>  Issue Type: Task
>Affects Versions: 5.1.4
>Reporter: James R. Taylor
>Assignee: Ranganath Govardhanagiri
>  Labels: JSON, Java, SQL
> Fix For: 4.4.1, 5.2.0
>
> Attachments: JSON Support for Phoenix.docx, Screen Shot 2022-02-02 at 
> 12.23.24 PM.png, image-2023-12-07-11-26-56-198.png
>
>
> MongoDB and Postgres do some interesting things with JSON. We should look at 
> adding similar support. For a detailed description, see JSONB support in 
> Postgres: 
> [http://www.craigkerstiens.com/2014/03/24/Postgres-9.4-Looking-up]
> [http://www.depesz.com/2014/03/25/waiting-for-9-4-introduce-jsonb-a-structured-format-for-storing-json/]
> [http://michael.otacoo.com/postgresql-2/manipulating-jsonb-data-with-key-unique/]



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Commented] (PHOENIX-628) Support native JSON data type

2024-01-03 Thread Ranganath Govardhanagiri (Jira)


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

Ranganath Govardhanagiri commented on PHOENIX-628:
--

Added the same description as the commit message excluding the http links - 
would that be fine?

> Support native JSON data type
> -
>
> Key: PHOENIX-628
> URL: https://issues.apache.org/jira/browse/PHOENIX-628
> Project: Phoenix
>  Issue Type: Task
>Affects Versions: 5.1.4
>Reporter: James R. Taylor
>Assignee: Ranganath Govardhanagiri
>  Labels: JSON, Java, SQL
> Fix For: 4.4.1, 5.2.0
>
> Attachments: JSON Support for Phoenix.docx, Screen Shot 2022-02-02 at 
> 12.23.24 PM.png, image-2023-12-07-11-26-56-198.png
>
>
> MongoDB and Postgres do some interesting things with JSON. We should look at 
> adding similar support. For a detailed description, see JSONB support in 
> Postgres: 
> [http://www.craigkerstiens.com/2014/03/24/Postgres-9.4-Looking-up]
> [http://www.depesz.com/2014/03/25/waiting-for-9-4-introduce-jsonb-a-structured-format-for-storing-json/]
> [http://michael.otacoo.com/postgresql-2/manipulating-jsonb-data-with-key-unique/]



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Commented] (PHOENIX-628) Support native JSON data type

2024-01-03 Thread Istvan Toth (Jira)


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

Istvan Toth commented on PHOENIX-628:
-

The convention is to use the same text.

You may want to rename the ticket if you feel that it is not descriptive enough.

> Support native JSON data type
> -
>
> Key: PHOENIX-628
> URL: https://issues.apache.org/jira/browse/PHOENIX-628
> Project: Phoenix
>  Issue Type: Task
>Affects Versions: 5.1.4
>Reporter: James R. Taylor
>Assignee: Ranganath Govardhanagiri
>  Labels: JSON, Java, SQL
> Fix For: 4.4.1, 5.2.0
>
> Attachments: JSON Support for Phoenix.docx, Screen Shot 2022-02-02 at 
> 12.23.24 PM.png, image-2023-12-07-11-26-56-198.png
>
>
> MongoDB and Postgres do some interesting things with JSON. We should look at 
> adding similar support. For a detailed description, see JSONB support in 
> Postgres: 
> [http://www.craigkerstiens.com/2014/03/24/Postgres-9.4-Looking-up]
> [http://www.depesz.com/2014/03/25/waiting-for-9-4-introduce-jsonb-a-structured-format-for-storing-json/]
> [http://michael.otacoo.com/postgresql-2/manipulating-jsonb-data-with-key-unique/]



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Commented] (PHOENIX-628) Support native JSON data type

2024-01-03 Thread ASF GitHub Bot (Jira)


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

ASF GitHub Bot commented on PHOENIX-628:


ranganathg commented on PR #1780:
URL: https://github.com/apache/phoenix/pull/1780#issuecomment-1875156638

   > The commit message doesn't match the JIRA ticket description
   
   Can it be different from the JIRA description? I think the description has a 
recommendation - can I add the message as "Adding JSON native datatype and JSON 
functions" - That would be more relevant to the comment instead of the JIRA 
description?




> Support native JSON data type
> -
>
> Key: PHOENIX-628
> URL: https://issues.apache.org/jira/browse/PHOENIX-628
> Project: Phoenix
>  Issue Type: Task
>Affects Versions: 5.1.4
>Reporter: James R. Taylor
>Assignee: Ranganath Govardhanagiri
>  Labels: JSON, Java, SQL
> Fix For: 4.4.1, 5.2.0
>
> Attachments: JSON Support for Phoenix.docx, Screen Shot 2022-02-02 at 
> 12.23.24 PM.png, image-2023-12-07-11-26-56-198.png
>
>
> MongoDB and Postgres do some interesting things with JSON. We should look at 
> adding similar support. For a detailed description, see JSONB support in 
> Postgres: 
> [http://www.craigkerstiens.com/2014/03/24/Postgres-9.4-Looking-up]
> [http://www.depesz.com/2014/03/25/waiting-for-9-4-introduce-jsonb-a-structured-format-for-storing-json/]
> [http://michael.otacoo.com/postgresql-2/manipulating-jsonb-data-with-key-unique/]



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Commented] (PHOENIX-628) Support native JSON data type

2024-01-03 Thread ASF GitHub Bot (Jira)


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

ASF GitHub Bot commented on PHOENIX-628:


stoty commented on PR #1780:
URL: https://github.com/apache/phoenix/pull/1780#issuecomment-1875139603

   The commit message doesn't match the JIRA ticket description




> Support native JSON data type
> -
>
> Key: PHOENIX-628
> URL: https://issues.apache.org/jira/browse/PHOENIX-628
> Project: Phoenix
>  Issue Type: Task
>Affects Versions: 5.1.4
>Reporter: James R. Taylor
>Assignee: Ranganath Govardhanagiri
>  Labels: JSON, Java, SQL
> Fix For: 4.4.1, 5.2.0
>
> Attachments: JSON Support for Phoenix.docx, Screen Shot 2022-02-02 at 
> 12.23.24 PM.png, image-2023-12-07-11-26-56-198.png
>
>
> MongoDB and Postgres do some interesting things with JSON. We should look at 
> adding similar support. For a detailed description, see JSONB support in 
> Postgres: 
> [http://www.craigkerstiens.com/2014/03/24/Postgres-9.4-Looking-up]
> [http://www.depesz.com/2014/03/25/waiting-for-9-4-introduce-jsonb-a-structured-format-for-storing-json/]
> [http://michael.otacoo.com/postgresql-2/manipulating-jsonb-data-with-key-unique/]



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Commented] (PHOENIX-628) Support native JSON data type

2024-01-03 Thread ASF GitHub Bot (Jira)


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

ASF GitHub Bot commented on PHOENIX-628:


stoty commented on PR #1780:
URL: https://github.com/apache/phoenix/pull/1780#issuecomment-1875099311

   Can you clean up the commit message ?
   
   Use of colons, dashes, etc is inconsitent.




> Support native JSON data type
> -
>
> Key: PHOENIX-628
> URL: https://issues.apache.org/jira/browse/PHOENIX-628
> Project: Phoenix
>  Issue Type: Task
>Affects Versions: 5.1.4
>Reporter: James R. Taylor
>Assignee: Ranganath Govardhanagiri
>  Labels: JSON, Java, SQL
> Fix For: 4.4.1, 5.2.0
>
> Attachments: JSON Support for Phoenix.docx, Screen Shot 2022-02-02 at 
> 12.23.24 PM.png, image-2023-12-07-11-26-56-198.png
>
>
> MongoDB and Postgres do some interesting things with JSON. We should look at 
> adding similar support. For a detailed description, see JSONB support in 
> Postgres: 
> [http://www.craigkerstiens.com/2014/03/24/Postgres-9.4-Looking-up]
> [http://www.depesz.com/2014/03/25/waiting-for-9-4-introduce-jsonb-a-structured-format-for-storing-json/]
> [http://michael.otacoo.com/postgresql-2/manipulating-jsonb-data-with-key-unique/]



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Commented] (PHOENIX-628) Support native JSON data type

2024-01-03 Thread ASF GitHub Bot (Jira)


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

ASF GitHub Bot commented on PHOENIX-628:


ranganathg opened a new pull request, #1780:
URL: https://github.com/apache/phoenix/pull/1780

   * PHOENIX-628 - Support native JSON data type (#1667)
   
   * PHOENIX-7058 : Implement json_query function on the json object (#1696)
   
   * PHOENIX-7044 : Support Index on a generated column that extracts a scalar 
value from JSON column (#1708)
   
   * PHOENIX-7099 : Implement JSON_EXISTS function on json object (#1732)
   
   * PHOENIX-7099 : Implement JSON_EXISTS function on json object
   
   * PHOENIX-7073 : Parse JSON columns on the server side (#1712)
   
   * PHOENIX-7073 : Parse JSON columns on the server side
   
   * PHOENIX-7155 Validate Partial Index support with JSON (#1767)




> Support native JSON data type
> -
>
> Key: PHOENIX-628
> URL: https://issues.apache.org/jira/browse/PHOENIX-628
> Project: Phoenix
>  Issue Type: Task
>Affects Versions: 5.1.4
>Reporter: James R. Taylor
>Assignee: Ranganath Govardhanagiri
>  Labels: JSON, Java, SQL
> Fix For: 4.4.1, 5.2.0
>
> Attachments: JSON Support for Phoenix.docx, Screen Shot 2022-02-02 at 
> 12.23.24 PM.png, image-2023-12-07-11-26-56-198.png
>
>
> MongoDB and Postgres do some interesting things with JSON. We should look at 
> adding similar support. For a detailed description, see JSONB support in 
> Postgres: 
> [http://www.craigkerstiens.com/2014/03/24/Postgres-9.4-Looking-up]
> [http://www.depesz.com/2014/03/25/waiting-for-9-4-introduce-jsonb-a-structured-format-for-storing-json/]
> [http://michael.otacoo.com/postgresql-2/manipulating-jsonb-data-with-key-unique/]



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Commented] (PHOENIX-628) Support native JSON data type

2024-01-03 Thread ASF GitHub Bot (Jira)


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

ASF GitHub Bot commented on PHOENIX-628:


ranganathg closed pull request #1769: PHOENIX-628: Support native JSON data type
URL: https://github.com/apache/phoenix/pull/1769




> Support native JSON data type
> -
>
> Key: PHOENIX-628
> URL: https://issues.apache.org/jira/browse/PHOENIX-628
> Project: Phoenix
>  Issue Type: Task
>Affects Versions: 5.1.4
>Reporter: James R. Taylor
>Assignee: Ranganath Govardhanagiri
>  Labels: JSON, Java, SQL
> Fix For: 4.4.1, 5.2.0
>
> Attachments: JSON Support for Phoenix.docx, Screen Shot 2022-02-02 at 
> 12.23.24 PM.png, image-2023-12-07-11-26-56-198.png
>
>
> MongoDB and Postgres do some interesting things with JSON. We should look at 
> adding similar support. For a detailed description, see JSONB support in 
> Postgres: 
> [http://www.craigkerstiens.com/2014/03/24/Postgres-9.4-Looking-up]
> [http://www.depesz.com/2014/03/25/waiting-for-9-4-introduce-jsonb-a-structured-format-for-storing-json/]
> [http://michael.otacoo.com/postgresql-2/manipulating-jsonb-data-with-key-unique/]



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Commented] (PHOENIX-628) Support native JSON data type

2023-12-21 Thread ASF GitHub Bot (Jira)


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

ASF GitHub Bot commented on PHOENIX-628:


ranganathg opened a new pull request, #1769:
URL: https://github.com/apache/phoenix/pull/1769

   (no comment)




> Support native JSON data type
> -
>
> Key: PHOENIX-628
> URL: https://issues.apache.org/jira/browse/PHOENIX-628
> Project: Phoenix
>  Issue Type: Task
>Affects Versions: 5.1.4
>Reporter: James R. Taylor
>Assignee: Ranganath Govardhanagiri
>  Labels: JSON, Java, SQL
> Fix For: 4.4.1, 5.2.0
>
> Attachments: JSON Support for Phoenix.docx, Screen Shot 2022-02-02 at 
> 12.23.24 PM.png, image-2023-12-07-11-26-56-198.png
>
>
> MongoDB and Postgres do some interesting things with JSON. We should look at 
> adding similar support. For a detailed description, see JSONB support in 
> Postgres: 
> [http://www.craigkerstiens.com/2014/03/24/Postgres-9.4-Looking-up]
> [http://www.depesz.com/2014/03/25/waiting-for-9-4-introduce-jsonb-a-structured-format-for-storing-json/]
> [http://michael.otacoo.com/postgresql-2/manipulating-jsonb-data-with-key-unique/]



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Commented] (PHOENIX-628) Support native JSON data type

2023-12-06 Thread Istvan Toth (Jira)


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

Istvan Toth commented on PHOENIX-628:
-

Thanks [~ranganathg]. JIRA's ways are mysterious.

> Support native JSON data type
> -
>
> Key: PHOENIX-628
> URL: https://issues.apache.org/jira/browse/PHOENIX-628
> Project: Phoenix
>  Issue Type: Task
>Affects Versions: 5.1.4
>Reporter: James R. Taylor
>Assignee: Ranganath Govardhanagiri
>  Labels: JSON, Java, SQL
> Fix For: 4.4.1, 5.2.0
>
> Attachments: JSON Support for Phoenix.docx, Screen Shot 2022-02-02 at 
> 12.23.24 PM.png, image-2023-12-07-11-26-56-198.png
>
>
> MongoDB and Postgres do some interesting things with JSON. We should look at 
> adding similar support. For a detailed description, see JSONB support in 
> Postgres: 
> [http://www.craigkerstiens.com/2014/03/24/Postgres-9.4-Looking-up]
> [http://www.depesz.com/2014/03/25/waiting-for-9-4-introduce-jsonb-a-structured-format-for-storing-json/]
> [http://michael.otacoo.com/postgresql-2/manipulating-jsonb-data-with-key-unique/]



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Commented] (PHOENIX-628) Support native JSON data type

2023-12-06 Thread Ranganath Govardhanagiri (Jira)


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

Ranganath Govardhanagiri commented on PHOENIX-628:
--

[~stoty] - I tried updating some time back and wasn't able to remove it.

> Support native JSON data type
> -
>
> Key: PHOENIX-628
> URL: https://issues.apache.org/jira/browse/PHOENIX-628
> Project: Phoenix
>  Issue Type: Task
>Affects Versions: 5.1.4
>Reporter: James R. Taylor
>Assignee: Ranganath Govardhanagiri
>  Labels: JSON, Java, SQL
> Fix For: 4.4.1, 5.2.0
>
> Attachments: JSON Support for Phoenix.docx, Screen Shot 2022-02-02 at 
> 12.23.24 PM.png
>
>
> MongoDB and Postgres do some interesting things with JSON. We should look at 
> adding similar support. For a detailed description, see JSONB support in 
> Postgres: 
> [http://www.craigkerstiens.com/2014/03/24/Postgres-9.4-Looking-up]
> [http://www.depesz.com/2014/03/25/waiting-for-9-4-introduce-jsonb-a-structured-format-for-storing-json/]
> [http://michael.otacoo.com/postgresql-2/manipulating-jsonb-data-with-key-unique/]



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Commented] (PHOENIX-628) Support native JSON data type

2023-12-06 Thread Istvan Toth (Jira)


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

Istvan Toth commented on PHOENIX-628:
-

Can we remove 4.4.1 from the fix version field ?

> Support native JSON data type
> -
>
> Key: PHOENIX-628
> URL: https://issues.apache.org/jira/browse/PHOENIX-628
> Project: Phoenix
>  Issue Type: Task
>Affects Versions: 5.1.4
>Reporter: James R. Taylor
>Assignee: Ranganath Govardhanagiri
>  Labels: JSON, Java, SQL
> Fix For: 4.4.1, 5.2.0
>
> Attachments: JSON Support for Phoenix.docx, Screen Shot 2022-02-02 at 
> 12.23.24 PM.png
>
>
> MongoDB and Postgres do some interesting things with JSON. We should look at 
> adding similar support. For a detailed description, see JSONB support in 
> Postgres: 
> [http://www.craigkerstiens.com/2014/03/24/Postgres-9.4-Looking-up]
> [http://www.depesz.com/2014/03/25/waiting-for-9-4-introduce-jsonb-a-structured-format-for-storing-json/]
> [http://michael.otacoo.com/postgresql-2/manipulating-jsonb-data-with-key-unique/]



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Commented] (PHOENIX-628) Support native JSON data type

2023-09-28 Thread ASF GitHub Bot (Jira)


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

ASF GitHub Bot commented on PHOENIX-628:


tkhurana merged PR #1667:
URL: https://github.com/apache/phoenix/pull/1667




> Support native JSON data type
> -
>
> Key: PHOENIX-628
> URL: https://issues.apache.org/jira/browse/PHOENIX-628
> Project: Phoenix
>  Issue Type: Task
>Affects Versions: 4.4.0
>Reporter: James R. Taylor
>Assignee: Ranganath Govardhanagiri
>  Labels: JSON, Java, SQL
> Fix For: 4.4.1
>
> Attachments: JSON Support for Phoenix.docx, Screen Shot 2022-02-02 at 
> 12.23.24 PM.png
>
>
> MongoDB and PostGres do some interesting things with JSON. We should look at 
> adding similar support. For a detailed description, see JSONB support in 
> Postgres: 
> http://www.craigkerstiens.com/2014/03/24/Postgres-9.4-Looking-up
> http://www.depesz.com/2014/03/25/waiting-for-9-4-introduce-jsonb-a-structured-format-for-storing-json/
> http://michael.otacoo.com/postgresql-2/manipulating-jsonb-data-with-key-unique/



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Commented] (PHOENIX-628) Support native JSON data type

2023-09-22 Thread ASF GitHub Bot (Jira)


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

ASF GitHub Bot commented on PHOENIX-628:


tkhurana commented on code in PR #1667:
URL: https://github.com/apache/phoenix/pull/1667#discussion_r1334793041


##
phoenix-core/src/it/java/org/apache/phoenix/end2end/json/JsonValueIT.java:
##
@@ -0,0 +1,580 @@
+/*
+ * 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.phoenix.end2end.json;
+
+import org.apache.hadoop.hbase.TableName;
+import org.apache.phoenix.end2end.ParallelStatsDisabledIT;
+import org.apache.phoenix.util.PropertiesUtil;
+import org.apache.phoenix.util.TestUtil;
+import org.junit.Test;
+
+import java.sql.Connection;
+import java.sql.DriverManager;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.util.Properties;
+
+import static org.apache.phoenix.util.TestUtil.TEST_PROPERTIES;
+import static org.junit.Assert.*;
+
+public class JsonValueIT extends ParallelStatsDisabledIT {
+private String JsonDoc1 = "{  \n" +
+" \"info\":{\n" +
+"   \"type\":1,  \n" +
+"   \"address\":{\n" +
+" \"town\":\"Bristol\",  \n" +
+" \"county\":\"Avon\",  \n" +
+" \"country\":\"England\"  \n" +
+"   },  \n" +
+"   \"tags\":[\"Sport\", \"Water polo\"]  \n" +
+"},  \n" +
+"\"type\":\"Basic\",  \n" +
+"\"name\":\"AndersenFamily\"  \n" +
+" }";
+
+private String JsonDatatypes = "{\n" + "" +
+"   \"datatypes\": {\n" + "" +
+"   \"stringtype\": \"someString\",\n" +
+"\"inttype\": 1,\n" +
+"\"booltype\": true,\n" +
+"\"booltypef\": false,\n" +
+"\"doubletype\": 2.5, \n" +
+"\"longtype\": 1490020778457845, \n" +
+"\"intArray\": [1, 2, 3], \n" +
+"\"nullcheck\": null \n"+
+"}\n" +
+"}";
+
+private String JsonDoc2="{\n" +
+"   \"testCnt\": \"SomeCnt1\",\n" +
+"   \"test\": \"test1\",\n" +
+"   \"batchNo\": 1,\n" +
+"   \"infoTop\":[\n" +
+"   {\n" +
+"   \"_id\": \"618d982e407a8dbd65781450\",\n" +
+"   \"index\": 0,\n" +
+"   \"guid\": 
\"4f5a46f2-7271-492a-8347-a8223516715f\",\n" +
+"   \"isActive\": true,\n" +
+"   \"balance\": \"$3,746.11\",\n" +
+"   \"picture\": 
\"http://placehold.it/32x32\",\n; +
+"   \"age\": 20,\n" +
+"   \"eyeColor\": \"green\",\n" +
+"   \"name\": \"Castaneda Golden\",\n" +
+"   \"gender\": \"male\",\n" +
+"   \"company\": \"AUSTEX\",\n" +
+"   \"email\": 
\"castanedagol...@austex.com\",\n" +
+"   \"phone\": \"+1 (979) 486-3061\",\n" +
+"   \"info\": {\n" +
+"   \"address\": {\n" +
+"   \"street\": \"function\",\n" +
+"   \"town\": \"Urbana\",\n" +
+"   \"state\": \"Delaware\"\n" +
+"   }\n" +
+"   },\n" +
+"   \"address\": \"322 Hancock Street, Nicut, 
Georgia, 5007\",\n" +
+"   \"about\": \"Esse anim minim nostrud 
aliquip. Quis anim ex dolore magna exercitation deserunt minim ad do est non. 
Magna fugiat eiusmod incididunt cupidatat. Anim occaecat nulla cillum culpa 
sunt amet.\\r\\n\",\n" +
+"   

[jira] [Commented] (PHOENIX-628) Support native JSON data type

2023-09-22 Thread ASF GitHub Bot (Jira)


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

ASF GitHub Bot commented on PHOENIX-628:


tkhurana commented on code in PR #1667:
URL: https://github.com/apache/phoenix/pull/1667#discussion_r1334791547


##
phoenix-core/src/it/java/org/apache/phoenix/end2end/json/JsonValueIT.java:
##
@@ -0,0 +1,580 @@
+/*
+ * 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.phoenix.end2end.json;
+
+import org.apache.hadoop.hbase.TableName;
+import org.apache.phoenix.end2end.ParallelStatsDisabledIT;
+import org.apache.phoenix.util.PropertiesUtil;
+import org.apache.phoenix.util.TestUtil;
+import org.junit.Test;
+
+import java.sql.Connection;
+import java.sql.DriverManager;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.util.Properties;
+
+import static org.apache.phoenix.util.TestUtil.TEST_PROPERTIES;
+import static org.junit.Assert.*;
+
+public class JsonValueIT extends ParallelStatsDisabledIT {
+private String JsonDoc1 = "{  \n" +
+" \"info\":{\n" +
+"   \"type\":1,  \n" +
+"   \"address\":{\n" +
+" \"town\":\"Bristol\",  \n" +
+" \"county\":\"Avon\",  \n" +
+" \"country\":\"England\"  \n" +
+"   },  \n" +
+"   \"tags\":[\"Sport\", \"Water polo\"]  \n" +
+"},  \n" +
+"\"type\":\"Basic\",  \n" +
+"\"name\":\"AndersenFamily\"  \n" +
+" }";
+
+private String JsonDatatypes = "{\n" + "" +
+"   \"datatypes\": {\n" + "" +
+"   \"stringtype\": \"someString\",\n" +
+"\"inttype\": 1,\n" +
+"\"booltype\": true,\n" +
+"\"booltypef\": false,\n" +
+"\"doubletype\": 2.5, \n" +
+"\"longtype\": 1490020778457845, \n" +
+"\"intArray\": [1, 2, 3], \n" +
+"\"nullcheck\": null \n"+
+"}\n" +
+"}";
+
+private String JsonDoc2="{\n" +
+"   \"testCnt\": \"SomeCnt1\",\n" +
+"   \"test\": \"test1\",\n" +
+"   \"batchNo\": 1,\n" +
+"   \"infoTop\":[\n" +
+"   {\n" +
+"   \"_id\": \"618d982e407a8dbd65781450\",\n" +
+"   \"index\": 0,\n" +
+"   \"guid\": 
\"4f5a46f2-7271-492a-8347-a8223516715f\",\n" +
+"   \"isActive\": true,\n" +
+"   \"balance\": \"$3,746.11\",\n" +
+"   \"picture\": 
\"http://placehold.it/32x32\",\n; +
+"   \"age\": 20,\n" +
+"   \"eyeColor\": \"green\",\n" +
+"   \"name\": \"Castaneda Golden\",\n" +
+"   \"gender\": \"male\",\n" +
+"   \"company\": \"AUSTEX\",\n" +
+"   \"email\": 
\"castanedagol...@austex.com\",\n" +
+"   \"phone\": \"+1 (979) 486-3061\",\n" +
+"   \"info\": {\n" +
+"   \"address\": {\n" +
+"   \"street\": \"function\",\n" +
+"   \"town\": \"Urbana\",\n" +
+"   \"state\": \"Delaware\"\n" +
+"   }\n" +
+"   },\n" +
+"   \"address\": \"322 Hancock Street, Nicut, 
Georgia, 5007\",\n" +
+"   \"about\": \"Esse anim minim nostrud 
aliquip. Quis anim ex dolore magna exercitation deserunt minim ad do est non. 
Magna fugiat eiusmod incididunt cupidatat. Anim occaecat nulla cillum culpa 
sunt amet.\\r\\n\",\n" +
+"   

[jira] [Commented] (PHOENIX-628) Support native JSON data type

2023-09-12 Thread ASF GitHub Bot (Jira)


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

ASF GitHub Bot commented on PHOENIX-628:


tkhurana commented on code in PR #1667:
URL: https://github.com/apache/phoenix/pull/1667#discussion_r1323390365


##
phoenix-core/src/main/java/org/apache/phoenix/schema/types/PJson.java:
##
@@ -0,0 +1,132 @@
+/*
+ * 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.phoenix.schema.types;
+
+import org.apache.hadoop.hbase.util.Bytes;
+import org.apache.phoenix.schema.SortOrder;
+import org.apache.phoenix.util.ByteUtil;
+
+import java.sql.Types;
+
+import org.bson.RawBsonDocument;

Review Comment:
   So basically you create an interface and then Phoenix interacts with the 
interface and BSON is one implementation of the interface.





> Support native JSON data type
> -
>
> Key: PHOENIX-628
> URL: https://issues.apache.org/jira/browse/PHOENIX-628
> Project: Phoenix
>  Issue Type: Task
>Affects Versions: 4.4.0
>Reporter: James R. Taylor
>Assignee: Ranganath Govardhanagiri
>  Labels: JSON, Java, SQL
> Fix For: 4.4.1
>
> Attachments: JSON Support for Phoenix.docx, Screen Shot 2022-02-02 at 
> 12.23.24 PM.png
>
>
> MongoDB and PostGres do some interesting things with JSON. We should look at 
> adding similar support. For a detailed description, see JSONB support in 
> Postgres: 
> http://www.craigkerstiens.com/2014/03/24/Postgres-9.4-Looking-up
> http://www.depesz.com/2014/03/25/waiting-for-9-4-introduce-jsonb-a-structured-format-for-storing-json/
> http://michael.otacoo.com/postgresql-2/manipulating-jsonb-data-with-key-unique/



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Commented] (PHOENIX-628) Support native JSON data type

2023-09-12 Thread ASF GitHub Bot (Jira)


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

ASF GitHub Bot commented on PHOENIX-628:


tkhurana commented on code in PR #1667:
URL: https://github.com/apache/phoenix/pull/1667#discussion_r1323388922


##
phoenix-core/src/main/java/org/apache/phoenix/schema/types/PJson.java:
##
@@ -0,0 +1,132 @@
+/*
+ * 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.phoenix.schema.types;
+
+import org.apache.hadoop.hbase.util.Bytes;
+import org.apache.phoenix.schema.SortOrder;
+import org.apache.phoenix.util.ByteUtil;
+
+import java.sql.Types;
+
+import org.bson.RawBsonDocument;

Review Comment:
   @ranganathg I was thinking if we could abstract the underlying json format 
and make it pluggable with BSON as the default. So rather than directly using 
BSON classes we could abstract that away behind an interface.





> Support native JSON data type
> -
>
> Key: PHOENIX-628
> URL: https://issues.apache.org/jira/browse/PHOENIX-628
> Project: Phoenix
>  Issue Type: Task
>Affects Versions: 4.4.0
>Reporter: James R. Taylor
>Assignee: Ranganath Govardhanagiri
>  Labels: JSON, Java, SQL
> Fix For: 4.4.1
>
> Attachments: JSON Support for Phoenix.docx, Screen Shot 2022-02-02 at 
> 12.23.24 PM.png
>
>
> MongoDB and PostGres do some interesting things with JSON. We should look at 
> adding similar support. For a detailed description, see JSONB support in 
> Postgres: 
> http://www.craigkerstiens.com/2014/03/24/Postgres-9.4-Looking-up
> http://www.depesz.com/2014/03/25/waiting-for-9-4-introduce-jsonb-a-structured-format-for-storing-json/
> http://michael.otacoo.com/postgresql-2/manipulating-jsonb-data-with-key-unique/



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Commented] (PHOENIX-628) Support native JSON data type

2023-09-12 Thread ASF GitHub Bot (Jira)


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

ASF GitHub Bot commented on PHOENIX-628:


tkhurana commented on code in PR #1667:
URL: https://github.com/apache/phoenix/pull/1667#discussion_r1323385162


##
phoenix-core/pom.xml:
##
@@ -399,6 +399,37 @@
 zookeeper-jute
 
 
+
+  com.jayway.jsonpath
+  json-path
+  2.6.0
+
+
+
+  com.github.wnameless.json
+  json-flattener
+  0.12.1
+
+
+
+  com.github.wnameless.json
+  json-base
+  2.0.0
+
+
+
+  com.google.code.gson
+  gson
+  2.8.9
+

Review Comment:
   Do we need these dependencies ?





> Support native JSON data type
> -
>
> Key: PHOENIX-628
> URL: https://issues.apache.org/jira/browse/PHOENIX-628
> Project: Phoenix
>  Issue Type: Task
>Affects Versions: 4.4.0
>Reporter: James R. Taylor
>Assignee: Ranganath Govardhanagiri
>  Labels: JSON, Java, SQL
> Fix For: 4.4.1
>
> Attachments: JSON Support for Phoenix.docx, Screen Shot 2022-02-02 at 
> 12.23.24 PM.png
>
>
> MongoDB and PostGres do some interesting things with JSON. We should look at 
> adding similar support. For a detailed description, see JSONB support in 
> Postgres: 
> http://www.craigkerstiens.com/2014/03/24/Postgres-9.4-Looking-up
> http://www.depesz.com/2014/03/25/waiting-for-9-4-introduce-jsonb-a-structured-format-for-storing-json/
> http://michael.otacoo.com/postgresql-2/manipulating-jsonb-data-with-key-unique/



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Commented] (PHOENIX-628) Support native JSON data type

2023-09-03 Thread Viraj Jasani (Jira)


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

Viraj Jasani commented on PHOENIX-628:
--

Created feature branch: 
[https://github.com/apache/phoenix/tree/PHOENIX-628-feature]

cc [~ranganathg] 

> Support native JSON data type
> -
>
> Key: PHOENIX-628
> URL: https://issues.apache.org/jira/browse/PHOENIX-628
> Project: Phoenix
>  Issue Type: Task
>Affects Versions: 4.4.0
>Reporter: James R. Taylor
>Assignee: Ranganath Govardhanagiri
>  Labels: JSON, Java, SQL
> Fix For: 4.4.1
>
> Attachments: JSON Support for Phoenix.docx, Screen Shot 2022-02-02 at 
> 12.23.24 PM.png
>
>
> MongoDB and PostGres do some interesting things with JSON. We should look at 
> adding similar support. For a detailed description, see JSONB support in 
> Postgres: 
> http://www.craigkerstiens.com/2014/03/24/Postgres-9.4-Looking-up
> http://www.depesz.com/2014/03/25/waiting-for-9-4-introduce-jsonb-a-structured-format-for-storing-json/
> http://michael.otacoo.com/postgresql-2/manipulating-jsonb-data-with-key-unique/



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Commented] (PHOENIX-628) Support native JSON data type

2022-02-02 Thread Istvan Toth (Jira)


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

Istvan Toth commented on PHOENIX-628:
-

Sorry, [~giskender] , I missed that.

> Support native JSON data type
> -
>
> Key: PHOENIX-628
> URL: https://issues.apache.org/jira/browse/PHOENIX-628
> Project: Phoenix
>  Issue Type: Task
>Affects Versions: 4.4.0
>Reporter: James R. Taylor
>  Labels: JSON, Java, SQL
> Fix For: 4.4.1
>
> Attachments: JSON Support for Phoenix.docx, Screen Shot 2022-02-02 at 
> 12.23.24 PM.png
>
>
> MongoDB and PostGres do some interesting things with JSON. We should look at 
> adding similar support. For a detailed description, see JSONB support in 
> Postgres: 
> http://www.craigkerstiens.com/2014/03/24/Postgres-9.4-Looking-up
> http://www.depesz.com/2014/03/25/waiting-for-9-4-introduce-jsonb-a-structured-format-for-storing-json/
> http://michael.otacoo.com/postgresql-2/manipulating-jsonb-data-with-key-unique/



--
This message was sent by Atlassian Jira
(v8.20.1#820001)


[jira] [Commented] (PHOENIX-628) Support native JSON data type

2022-02-02 Thread Gokcen Iskender (Jira)


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

Gokcen Iskender commented on PHOENIX-628:
-

[~stoty] I am not able to share globally but it is already attached to the 
jira.  !Screen Shot 2022-02-02 at 12.23.24 PM.png!

> Support native JSON data type
> -
>
> Key: PHOENIX-628
> URL: https://issues.apache.org/jira/browse/PHOENIX-628
> Project: Phoenix
>  Issue Type: Task
>Affects Versions: 4.4.0
>Reporter: James R. Taylor
>  Labels: JSON, Java, SQL
> Fix For: 4.4.1
>
> Attachments: JSON Support for Phoenix.docx, Screen Shot 2022-02-02 at 
> 12.23.24 PM.png
>
>
> MongoDB and PostGres do some interesting things with JSON. We should look at 
> adding similar support. For a detailed description, see JSONB support in 
> Postgres: 
> http://www.craigkerstiens.com/2014/03/24/Postgres-9.4-Looking-up
> http://www.depesz.com/2014/03/25/waiting-for-9-4-introduce-jsonb-a-structured-format-for-storing-json/
> http://michael.otacoo.com/postgresql-2/manipulating-jsonb-data-with-key-unique/



--
This message was sent by Atlassian Jira
(v8.20.1#820001)


[jira] [Commented] (PHOENIX-628) Support native JSON data type

2022-02-01 Thread Istvan Toth (Jira)


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

Istvan Toth commented on PHOENIX-628:
-

Could you please share the design doc globally, [~giskender] (or attach it to 
the ticket) ?

> Support native JSON data type
> -
>
> Key: PHOENIX-628
> URL: https://issues.apache.org/jira/browse/PHOENIX-628
> Project: Phoenix
>  Issue Type: Task
>Affects Versions: 4.4.0
>Reporter: James R. Taylor
>  Labels: JSON, Java, SQL
> Fix For: 4.4.1
>
> Attachments: JSON Support for Phoenix.docx
>
>
> MongoDB and PostGres do some interesting things with JSON. We should look at 
> adding similar support. For a detailed description, see JSONB support in 
> Postgres: 
> http://www.craigkerstiens.com/2014/03/24/Postgres-9.4-Looking-up
> http://www.depesz.com/2014/03/25/waiting-for-9-4-introduce-jsonb-a-structured-format-for-storing-json/
> http://michael.otacoo.com/postgresql-2/manipulating-jsonb-data-with-key-unique/



--
This message was sent by Atlassian Jira
(v8.20.1#820001)


[jira] [Commented] (PHOENIX-628) Support native JSON data type

2022-01-31 Thread Gokcen Iskender (Jira)


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

Gokcen Iskender commented on PHOENIX-628:
-

Here is a design doc about native Json support for Phoenix. 

[https://docs.google.com/document/d/1bpnADsXmvB-hlen2UWBFdrrKnW98A_dW0kJ3QIosMxo/edit?usp=sharing]

I will attach a copy of this to the Jira as well.

We would like to use BSON since our tests shows that to perform better.

[~kozdemir] [~larsh] 

> Support native JSON data type
> -
>
> Key: PHOENIX-628
> URL: https://issues.apache.org/jira/browse/PHOENIX-628
> Project: Phoenix
>  Issue Type: Task
>Affects Versions: 4.4.0
>Reporter: James R. Taylor
>  Labels: JSON, Java, SQL
> Fix For: 4.4.1
>
>
> MongoDB and PostGres do some interesting things with JSON. We should look at 
> adding similar support. For a detailed description, see JSONB support in 
> Postgres: 
> http://www.craigkerstiens.com/2014/03/24/Postgres-9.4-Looking-up
> http://www.depesz.com/2014/03/25/waiting-for-9-4-introduce-jsonb-a-structured-format-for-storing-json/
> http://michael.otacoo.com/postgresql-2/manipulating-jsonb-data-with-key-unique/



--
This message was sent by Atlassian Jira
(v8.20.1#820001)