You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pinot.apache.org by "INNOCENT-BOY (via GitHub)" <gi...@apache.org> on 2023/11/29 09:55:07 UTC

[I] Lack of JSON_EXISTS_PATH [pinot]

INNOCENT-BOY opened a new issue, #12064:
URL: https://github.com/apache/pinot/issues/12064

   > Json Index have a limitation: 
   > The key (left-hand side) of the filter expression must be the leaf level of the JSON object, for example, "$.addresses[*]"='main st' won't work.
   
   In some scenarios, we need to justify some non-leaf path is not null. Like below example:
   We have one json column named: person
   {
     "name": "adam",
     "age": 20,
     "addresses": [
       {
         "country": "us",
         "street": "main st",
         "number": 1
       },
       {
         "country": "ca",
         "street": "second st",
         "number": 2
       }
     ],
     "skills": [
       "english",
       "programming"
     ]
   }
   We want to execute JSON_MATCH(person, '"$.addresses" IS NOT NULL') to conduct data exploration. 
   Meanwhile we found there is an function named JSON_EXISTS_PATH in Doris: https://doris.apache.org/docs/sql-manual/sql-functions/json-functions/json-exists-path which satisfied our demand. We would like to know if the community have plan to do this. 
   cc @Jackie-Jiang 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org


Re: [I] Lack of JSON_EXISTS_PATH [pinot]

Posted by "INNOCENT-BOY (via GitHub)" <gi...@apache.org>.
INNOCENT-BOY commented on issue #12064:
URL: https://github.com/apache/pinot/issues/12064#issuecomment-1839875799

   Good advice, I will use jsonPathExists as the function name.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org


Re: [I] Lack of JSON_EXISTS_PATH [pinot]

Posted by "Jackie-Jiang (via GitHub)" <gi...@apache.org>.
Jackie-Jiang commented on issue #12064:
URL: https://github.com/apache/pinot/issues/12064#issuecomment-1839846355

   Seems `jsonPathExists` is a more commonly used function name for this purpose


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org


Re: [I] Lack of JSON_EXISTS_PATH [pinot]

Posted by "INNOCENT-BOY (via GitHub)" <gi...@apache.org>.
INNOCENT-BOY commented on issue #12064:
URL: https://github.com/apache/pinot/issues/12064#issuecomment-1835380149

   > One work around is to use `jsonPathString`: https://github.com/apache/pinot/blob/master/pinot-common/src/main/java/org/apache/pinot/common/function/scalar/JsonFunctions.java#L133 E.g.
   > 
   > ```
   > jsonPathString(person, '"$.addresses") != 'null'
   > ```
   > 
   > For `JSON_EXISTS_PATH` you can simply add a scalar function in `JsonFunctions.java` to achieve it. Do you wanna make a contribution for this?
   Hi @xiangfu0, jsonPathString is not work. jsonPathString is only to extract scalar value not nested json data. 
   Sure. I will try to write this function if community needs. 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org


Re: [I] Lack of JSON_EXISTS_PATH [pinot]

Posted by "xiangfu0 (via GitHub)" <gi...@apache.org>.
xiangfu0 commented on issue #12064:
URL: https://github.com/apache/pinot/issues/12064#issuecomment-1834453764

   One work around is to use `jsonPathString`:  https://github.com/apache/pinot/blob/master/pinot-common/src/main/java/org/apache/pinot/common/function/scalar/JsonFunctions.java#L133
   E.g. 
   ```
   jsonPathString(person, '"$.addresses") != 'null'
   ```
   
   For `JSON_EXISTS_PATH` you can simply add a scalar function in `JsonFunctions.java` to achieve it. Do you wanna make a contribution for this?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org


Re: [I] Lack of JSON_EXISTS_PATH [pinot]

Posted by "INNOCENT-BOY (via GitHub)" <gi...@apache.org>.
INNOCENT-BOY commented on issue #12064:
URL: https://github.com/apache/pinot/issues/12064#issuecomment-1835381927

   Hi @xiangfu0 , jsonPathString is not work. jsonPathString is only to extract scalar value not nested json data. 
   Sure. I will try to write this function if pinot community need this.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org