You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by GitBox <gi...@apache.org> on 2021/08/13 06:56:35 UTC

[GitHub] [flink] Airblader opened a new pull request #16805: [FLINK-16501][table] Support IS JSON for Table API

Airblader opened a new pull request #16805:
URL: https://github.com/apache/flink/pull/16805


   ## What is the purpose of the change
   
   This PR introduces support for the `IS JSON` predicate for Table API. Instead of exposing eight methods for all combinations, we expose only two methods: one without any arguments (= `IS JSON`), and one method which takes a type constraint (= `IS JSON [VALUE | SCALAR | ARRAY | OBJECT]`). Negations (`IS NOT JSON …`) can be done through the `NOT` operator since `IS JSON` always returns non-nullable boolean. However, `NOT` was only exposed for the Scala Table API, so this PR also exposes it for Java.
   
   ## Verifying this change
   
   This change added tests and can be verified as follows:
   * `LogicalFunctionsITCase`
   
   ## Does this pull request potentially affect one of the following parts:
   
     - Dependencies (does it add or upgrade a dependency): no
     - The public API, i.e., is any changed class annotated with `@Public(Evolving)`: yes
     - The serializers: no
     - The runtime per-record code paths (performance sensitive): no
     - Anything that affects deployment or recovery: JobManager (and its components), Checkpointing, Kubernetes/Yarn, ZooKeeper: no
     - The S3 file system connector: no
   
   ## Documentation
   
     - Does this pull request introduce a new feature? yes
     - If yes, how is the feature documented? docs / JavaDocs
   


-- 
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: issues-unsubscribe@flink.apache.org

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



[GitHub] [flink] flinkbot edited a comment on pull request #16805: [FLINK-16501][table] Support IS JSON for Table API

Posted by GitBox <gi...@apache.org>.
flinkbot edited a comment on pull request #16805:
URL: https://github.com/apache/flink/pull/16805#issuecomment-898269056


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "4ba2c084610f7beb223d100b44a8ff4dd779ce47",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=22063",
       "triggerID" : "4ba2c084610f7beb223d100b44a8ff4dd779ce47",
       "triggerType" : "PUSH"
     }, {
       "hash" : "6287b2a27d1e6fd86c520055b834c4c99ca3fb23",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=22351",
       "triggerID" : "6287b2a27d1e6fd86c520055b834c4c99ca3fb23",
       "triggerType" : "PUSH"
     }, {
       "hash" : "d658becaf995317da863a3d9a922923e65265384",
       "status" : "UNKNOWN",
       "url" : "TBD",
       "triggerID" : "d658becaf995317da863a3d9a922923e65265384",
       "triggerType" : "PUSH"
     }, {
       "hash" : "2786ad4f78bf48620f402ffaef4142c21b5f5b87",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=22485",
       "triggerID" : "2786ad4f78bf48620f402ffaef4142c21b5f5b87",
       "triggerType" : "PUSH"
     }, {
       "hash" : "842badc4fcd5d74a4e7161feeeed0e286364edb4",
       "status" : "FAILURE",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=23302",
       "triggerID" : "842badc4fcd5d74a4e7161feeeed0e286364edb4",
       "triggerType" : "PUSH"
     }, {
       "hash" : "af0dd8c913a0044732d69a85ba37b136f70ca083",
       "status" : "UNKNOWN",
       "url" : "TBD",
       "triggerID" : "af0dd8c913a0044732d69a85ba37b136f70ca083",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * d658becaf995317da863a3d9a922923e65265384 UNKNOWN
   * 842badc4fcd5d74a4e7161feeeed0e286364edb4 Azure: [FAILURE](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=23302) 
   * af0dd8c913a0044732d69a85ba37b136f70ca083 UNKNOWN
   
   <details>
   <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot run travis` re-run the last Travis build
    - `@flinkbot run azure` re-run the last Azure build
   </details>


-- 
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: issues-unsubscribe@flink.apache.org

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



[GitHub] [flink] flinkbot edited a comment on pull request #16805: [FLINK-16501][table] Support IS JSON for Table API

Posted by GitBox <gi...@apache.org>.
flinkbot edited a comment on pull request #16805:
URL: https://github.com/apache/flink/pull/16805#issuecomment-898269056


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "4ba2c084610f7beb223d100b44a8ff4dd779ce47",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=22063",
       "triggerID" : "4ba2c084610f7beb223d100b44a8ff4dd779ce47",
       "triggerType" : "PUSH"
     }, {
       "hash" : "6287b2a27d1e6fd86c520055b834c4c99ca3fb23",
       "status" : "SUCCESS",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=22351",
       "triggerID" : "6287b2a27d1e6fd86c520055b834c4c99ca3fb23",
       "triggerType" : "PUSH"
     }, {
       "hash" : "d658becaf995317da863a3d9a922923e65265384",
       "status" : "UNKNOWN",
       "url" : "TBD",
       "triggerID" : "d658becaf995317da863a3d9a922923e65265384",
       "triggerType" : "PUSH"
     }, {
       "hash" : "2786ad4f78bf48620f402ffaef4142c21b5f5b87",
       "status" : "UNKNOWN",
       "url" : "TBD",
       "triggerID" : "2786ad4f78bf48620f402ffaef4142c21b5f5b87",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * 6287b2a27d1e6fd86c520055b834c4c99ca3fb23 Azure: [SUCCESS](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=22351) 
   * d658becaf995317da863a3d9a922923e65265384 UNKNOWN
   * 2786ad4f78bf48620f402ffaef4142c21b5f5b87 UNKNOWN
   
   <details>
   <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot run travis` re-run the last Travis build
    - `@flinkbot run azure` re-run the last Azure build
   </details>


-- 
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: issues-unsubscribe@flink.apache.org

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



[GitHub] [flink] Airblader commented on a change in pull request #16805: [FLINK-16501][table] Support IS JSON for Table API

Posted by GitBox <gi...@apache.org>.
Airblader commented on a change in pull request #16805:
URL: https://github.com/apache/flink/pull/16805#discussion_r699991061



##########
File path: docs/data/sql_functions.yml
##########
@@ -83,7 +83,7 @@ logical:
     table: BOOLEAN1 && BOOLEAN2
     description: Returns TRUE if BOOLEAN1 and BOOLEAN2 are both TRUE. Supports three-valued logic. E.g., true && Null(BOOLEAN) returns UNKNOWN.
   - sql: NOT boolean
-    table: '!BOOLEAN'
+    table: BOOLEAN.not() or '!BOOLEAN' (Scala only)

Review comment:
       I've added it as a fixup commit to the hotfix. Feel free to either squash it in or discard the commit.




-- 
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: issues-unsubscribe@flink.apache.org

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



[GitHub] [flink] flinkbot edited a comment on pull request #16805: [FLINK-16501][table] Support IS JSON for Table API

Posted by GitBox <gi...@apache.org>.
flinkbot edited a comment on pull request #16805:
URL: https://github.com/apache/flink/pull/16805#issuecomment-898269056


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "4ba2c084610f7beb223d100b44a8ff4dd779ce47",
       "status" : "SUCCESS",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=22063",
       "triggerID" : "4ba2c084610f7beb223d100b44a8ff4dd779ce47",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * 4ba2c084610f7beb223d100b44a8ff4dd779ce47 Azure: [SUCCESS](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=22063) 
   
   <details>
   <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot run travis` re-run the last Travis build
    - `@flinkbot run azure` re-run the last Azure build
   </details>


-- 
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: issues-unsubscribe@flink.apache.org

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



[GitHub] [flink] Airblader commented on a change in pull request #16805: [FLINK-16501][table] Support IS JSON for Table API

Posted by GitBox <gi...@apache.org>.
Airblader commented on a change in pull request #16805:
URL: https://github.com/apache/flink/pull/16805#discussion_r699866579



##########
File path: flink-table/flink-table-common/src/main/java/org/apache/flink/table/functions/BuiltInFunctionDefinitions.java
##########
@@ -1488,6 +1489,20 @@
     // JSON functions
     // --------------------------------------------------------------------------------------------
 
+    public static final BuiltInFunctionDefinition IS_JSON =
+            BuiltInFunctionDefinition.newBuilder()
+                    .name("IS_JSON")
+                    .kind(SCALAR)
+                    .inputTypeStrategy(
+                            or(
+                                    sequence(logical(LogicalTypeFamily.CHARACTER_STRING)),
+                                    sequence(
+                                            logical(LogicalTypeFamily.CHARACTER_STRING),
+                                            symbol(JsonType.class))))
+                    .outputTypeStrategy(explicit(DataTypes.BOOLEAN().notNull()))

Review comment:
       `IS JSON` is never nullable, it returns boolean even on null input.




-- 
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: issues-unsubscribe@flink.apache.org

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



[GitHub] [flink] Airblader commented on a change in pull request #16805: [FLINK-16501][table] Support IS JSON for Table API

Posted by GitBox <gi...@apache.org>.
Airblader commented on a change in pull request #16805:
URL: https://github.com/apache/flink/pull/16805#discussion_r699872274



##########
File path: flink-table/flink-table-common/src/main/java/org/apache/flink/table/functions/BuiltInFunctionDefinitions.java
##########
@@ -1488,6 +1489,20 @@
     // JSON functions
     // --------------------------------------------------------------------------------------------
 
+    public static final BuiltInFunctionDefinition IS_JSON =
+            BuiltInFunctionDefinition.newBuilder()
+                    .name("IS_JSON")
+                    .kind(SCALAR)
+                    .inputTypeStrategy(
+                            or(
+                                    sequence(logical(LogicalTypeFamily.CHARACTER_STRING)),
+                                    sequence(
+                                            logical(LogicalTypeFamily.CHARACTER_STRING),
+                                            symbol(JsonType.class))))
+                    .outputTypeStrategy(explicit(DataTypes.BOOLEAN().notNull()))

Review comment:
       `IS JSON` is supposed to never be nullable, and always return true or false. However, it does seem this is currently implemented incorrectly. :-/




-- 
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: issues-unsubscribe@flink.apache.org

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



[GitHub] [flink] Airblader commented on a change in pull request #16805: [FLINK-16501][table] Support IS JSON for Table API

Posted by GitBox <gi...@apache.org>.
Airblader commented on a change in pull request #16805:
URL: https://github.com/apache/flink/pull/16805#discussion_r699866579



##########
File path: flink-table/flink-table-common/src/main/java/org/apache/flink/table/functions/BuiltInFunctionDefinitions.java
##########
@@ -1488,6 +1489,20 @@
     // JSON functions
     // --------------------------------------------------------------------------------------------
 
+    public static final BuiltInFunctionDefinition IS_JSON =
+            BuiltInFunctionDefinition.newBuilder()
+                    .name("IS_JSON")
+                    .kind(SCALAR)
+                    .inputTypeStrategy(
+                            or(
+                                    sequence(logical(LogicalTypeFamily.CHARACTER_STRING)),
+                                    sequence(
+                                            logical(LogicalTypeFamily.CHARACTER_STRING),
+                                            symbol(JsonType.class))))
+                    .outputTypeStrategy(explicit(DataTypes.BOOLEAN().notNull()))

Review comment:
       `IS JSON` is never nullable, it returns boolean even on null input.




-- 
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: issues-unsubscribe@flink.apache.org

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



[GitHub] [flink] Airblader commented on a change in pull request #16805: [FLINK-16501][table] Support IS JSON for Table API

Posted by GitBox <gi...@apache.org>.
Airblader commented on a change in pull request #16805:
URL: https://github.com/apache/flink/pull/16805#discussion_r699863553



##########
File path: docs/data/sql_functions.yml
##########
@@ -83,7 +83,7 @@ logical:
     table: BOOLEAN1 && BOOLEAN2
     description: Returns TRUE if BOOLEAN1 and BOOLEAN2 are both TRUE. Supports three-valued logic. E.g., true && Null(BOOLEAN) returns UNKNOWN.
   - sql: NOT boolean
-    table: '!BOOLEAN'
+    table: BOOLEAN.not() or '!BOOLEAN' (Scala only)

Review comment:
       I originally pointed this out as well (just deleted the comment yesterday). The reason I thought this isn't necessary is because `and` and `or` as prefix functions take arbitrarily many arguments (opposed to the postfix ones which are unary). However, `not` is always unary, and a prefix version of it thus doesn't seem as useful. Happy to add it if you still feel otherwise, though.




-- 
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: issues-unsubscribe@flink.apache.org

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



[GitHub] [flink] flinkbot edited a comment on pull request #16805: [FLINK-16501][table] Support IS JSON for Table API

Posted by GitBox <gi...@apache.org>.
flinkbot edited a comment on pull request #16805:
URL: https://github.com/apache/flink/pull/16805#issuecomment-898269056


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "4ba2c084610f7beb223d100b44a8ff4dd779ce47",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=22063",
       "triggerID" : "4ba2c084610f7beb223d100b44a8ff4dd779ce47",
       "triggerType" : "PUSH"
     }, {
       "hash" : "6287b2a27d1e6fd86c520055b834c4c99ca3fb23",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=22351",
       "triggerID" : "6287b2a27d1e6fd86c520055b834c4c99ca3fb23",
       "triggerType" : "PUSH"
     }, {
       "hash" : "d658becaf995317da863a3d9a922923e65265384",
       "status" : "UNKNOWN",
       "url" : "TBD",
       "triggerID" : "d658becaf995317da863a3d9a922923e65265384",
       "triggerType" : "PUSH"
     }, {
       "hash" : "2786ad4f78bf48620f402ffaef4142c21b5f5b87",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=22485",
       "triggerID" : "2786ad4f78bf48620f402ffaef4142c21b5f5b87",
       "triggerType" : "PUSH"
     }, {
       "hash" : "842badc4fcd5d74a4e7161feeeed0e286364edb4",
       "status" : "FAILURE",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=23302",
       "triggerID" : "842badc4fcd5d74a4e7161feeeed0e286364edb4",
       "triggerType" : "PUSH"
     }, {
       "hash" : "af0dd8c913a0044732d69a85ba37b136f70ca083",
       "status" : "PENDING",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=23329",
       "triggerID" : "af0dd8c913a0044732d69a85ba37b136f70ca083",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * d658becaf995317da863a3d9a922923e65265384 UNKNOWN
   * 842badc4fcd5d74a4e7161feeeed0e286364edb4 Azure: [FAILURE](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=23302) 
   * af0dd8c913a0044732d69a85ba37b136f70ca083 Azure: [PENDING](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=23329) 
   
   <details>
   <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot run travis` re-run the last Travis build
    - `@flinkbot run azure` re-run the last Azure build
   </details>


-- 
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: issues-unsubscribe@flink.apache.org

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



[GitHub] [flink] Airblader commented on a change in pull request #16805: [FLINK-16501][table] Support IS JSON for Table API

Posted by GitBox <gi...@apache.org>.
Airblader commented on a change in pull request #16805:
URL: https://github.com/apache/flink/pull/16805#discussion_r699903409



##########
File path: flink-python/pyflink/table/tests/test_expression.py
##########
@@ -19,7 +19,7 @@
 
 from pyflink.table import DataTypes
 from pyflink.table.expression import TimeIntervalUnit, TimePointUnit, JsonExistsOnError, \
-    JsonValueOnEmptyOrError
+    JsonValueOnEmptyOrError, JsonType

Review comment:
       That's where all other enums are as well. Or am I misunderstanding the question?




-- 
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: issues-unsubscribe@flink.apache.org

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



[GitHub] [flink] flinkbot commented on pull request #16805: [FLINK-16501][table] Support IS JSON for Table API

Posted by GitBox <gi...@apache.org>.
flinkbot commented on pull request #16805:
URL: https://github.com/apache/flink/pull/16805#issuecomment-898269056


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "4ba2c084610f7beb223d100b44a8ff4dd779ce47",
       "status" : "UNKNOWN",
       "url" : "TBD",
       "triggerID" : "4ba2c084610f7beb223d100b44a8ff4dd779ce47",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * 4ba2c084610f7beb223d100b44a8ff4dd779ce47 UNKNOWN
   
   <details>
   <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot run travis` re-run the last Travis build
    - `@flinkbot run azure` re-run the last Azure build
   </details>


-- 
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: issues-unsubscribe@flink.apache.org

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



[GitHub] [flink] Airblader commented on a change in pull request #16805: [FLINK-16501][table] Support IS JSON for Table API

Posted by GitBox <gi...@apache.org>.
Airblader commented on a change in pull request #16805:
URL: https://github.com/apache/flink/pull/16805#discussion_r699979538



##########
File path: flink-table/flink-table-common/src/main/java/org/apache/flink/table/functions/BuiltInFunctionDefinitions.java
##########
@@ -1488,6 +1489,20 @@
     // JSON functions
     // --------------------------------------------------------------------------------------------
 
+    public static final BuiltInFunctionDefinition IS_JSON =
+            BuiltInFunctionDefinition.newBuilder()
+                    .name("IS_JSON")
+                    .kind(SCALAR)
+                    .inputTypeStrategy(
+                            or(

Review comment:
       We could, but I think the logic is pretty straight-forward here and that way programmatic calls still work, so I would leave it as is?




-- 
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: issues-unsubscribe@flink.apache.org

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



[GitHub] [flink] flinkbot edited a comment on pull request #16805: [FLINK-16501][table] Support IS JSON for Table API

Posted by GitBox <gi...@apache.org>.
flinkbot edited a comment on pull request #16805:
URL: https://github.com/apache/flink/pull/16805#issuecomment-898269056


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "4ba2c084610f7beb223d100b44a8ff4dd779ce47",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=22063",
       "triggerID" : "4ba2c084610f7beb223d100b44a8ff4dd779ce47",
       "triggerType" : "PUSH"
     }, {
       "hash" : "6287b2a27d1e6fd86c520055b834c4c99ca3fb23",
       "status" : "SUCCESS",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=22351",
       "triggerID" : "6287b2a27d1e6fd86c520055b834c4c99ca3fb23",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * 6287b2a27d1e6fd86c520055b834c4c99ca3fb23 Azure: [SUCCESS](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=22351) 
   
   <details>
   <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot run travis` re-run the last Travis build
    - `@flinkbot run azure` re-run the last Azure build
   </details>


-- 
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: issues-unsubscribe@flink.apache.org

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



[GitHub] [flink] flinkbot edited a comment on pull request #16805: [FLINK-16501][table] Support IS JSON for Table API

Posted by GitBox <gi...@apache.org>.
flinkbot edited a comment on pull request #16805:
URL: https://github.com/apache/flink/pull/16805#issuecomment-898269056


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "4ba2c084610f7beb223d100b44a8ff4dd779ce47",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=22063",
       "triggerID" : "4ba2c084610f7beb223d100b44a8ff4dd779ce47",
       "triggerType" : "PUSH"
     }, {
       "hash" : "6287b2a27d1e6fd86c520055b834c4c99ca3fb23",
       "status" : "SUCCESS",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=22351",
       "triggerID" : "6287b2a27d1e6fd86c520055b834c4c99ca3fb23",
       "triggerType" : "PUSH"
     }, {
       "hash" : "d658becaf995317da863a3d9a922923e65265384",
       "status" : "UNKNOWN",
       "url" : "TBD",
       "triggerID" : "d658becaf995317da863a3d9a922923e65265384",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * 6287b2a27d1e6fd86c520055b834c4c99ca3fb23 Azure: [SUCCESS](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=22351) 
   * d658becaf995317da863a3d9a922923e65265384 UNKNOWN
   
   <details>
   <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot run travis` re-run the last Travis build
    - `@flinkbot run azure` re-run the last Azure build
   </details>


-- 
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: issues-unsubscribe@flink.apache.org

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



[GitHub] [flink] twalthr closed pull request #16805: [FLINK-16501][table] Support IS JSON for Table API

Posted by GitBox <gi...@apache.org>.
twalthr closed pull request #16805:
URL: https://github.com/apache/flink/pull/16805


   


-- 
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: issues-unsubscribe@flink.apache.org

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



[GitHub] [flink] Airblader commented on a change in pull request #16805: [FLINK-16501][table] Support IS JSON for Table API

Posted by GitBox <gi...@apache.org>.
Airblader commented on a change in pull request #16805:
URL: https://github.com/apache/flink/pull/16805#discussion_r688336142



##########
File path: flink-table/flink-table-planner/src/test/java/org/apache/flink/table/planner/functions/IsJsonFunctionITCase.java
##########
@@ -0,0 +1,157 @@
+/*
+ * 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.flink.table.planner.functions;
+
+import org.apache.flink.table.api.DataTypes;
+import org.apache.flink.table.api.JsonType;
+import org.apache.flink.table.functions.BuiltInFunctionDefinitions;
+
+import org.junit.runners.Parameterized;
+
+import java.util.Arrays;
+import java.util.List;
+
+import static org.apache.flink.table.api.Expressions.$;
+
+/** Tests for {@link BuiltInFunctionDefinitions#IS_JSON}. */
+public class IsJsonFunctionITCase extends BuiltInFunctionTestBase {

Review comment:
       Needs to be merged into `JsonFunctionsITCase` once #16776 is merged.




-- 
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: issues-unsubscribe@flink.apache.org

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



[GitHub] [flink] Airblader commented on a change in pull request #16805: [FLINK-16501][table] Support IS JSON for Table API

Posted by GitBox <gi...@apache.org>.
Airblader commented on a change in pull request #16805:
URL: https://github.com/apache/flink/pull/16805#discussion_r699920848



##########
File path: flink-table/flink-table-common/src/main/java/org/apache/flink/table/functions/BuiltInFunctionDefinitions.java
##########
@@ -1488,6 +1489,20 @@
     // JSON functions
     // --------------------------------------------------------------------------------------------
 
+    public static final BuiltInFunctionDefinition IS_JSON =
+            BuiltInFunctionDefinition.newBuilder()
+                    .name("IS_JSON")
+                    .kind(SCALAR)
+                    .inputTypeStrategy(
+                            or(
+                                    sequence(logical(LogicalTypeFamily.CHARACTER_STRING)),
+                                    sequence(
+                                            logical(LogicalTypeFamily.CHARACTER_STRING),
+                                            symbol(JsonType.class))))
+                    .outputTypeStrategy(explicit(DataTypes.BOOLEAN().notNull()))

Review comment:
       I'll fix that as part of this PR.




-- 
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: issues-unsubscribe@flink.apache.org

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



[GitHub] [flink] flinkbot edited a comment on pull request #16805: [FLINK-16501][table] Support IS JSON for Table API

Posted by GitBox <gi...@apache.org>.
flinkbot edited a comment on pull request #16805:
URL: https://github.com/apache/flink/pull/16805#issuecomment-898269056


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "4ba2c084610f7beb223d100b44a8ff4dd779ce47",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=22063",
       "triggerID" : "4ba2c084610f7beb223d100b44a8ff4dd779ce47",
       "triggerType" : "PUSH"
     }, {
       "hash" : "6287b2a27d1e6fd86c520055b834c4c99ca3fb23",
       "status" : "SUCCESS",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=22351",
       "triggerID" : "6287b2a27d1e6fd86c520055b834c4c99ca3fb23",
       "triggerType" : "PUSH"
     }, {
       "hash" : "d658becaf995317da863a3d9a922923e65265384",
       "status" : "UNKNOWN",
       "url" : "TBD",
       "triggerID" : "d658becaf995317da863a3d9a922923e65265384",
       "triggerType" : "PUSH"
     }, {
       "hash" : "2786ad4f78bf48620f402ffaef4142c21b5f5b87",
       "status" : "PENDING",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=22485",
       "triggerID" : "2786ad4f78bf48620f402ffaef4142c21b5f5b87",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * 6287b2a27d1e6fd86c520055b834c4c99ca3fb23 Azure: [SUCCESS](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=22351) 
   * d658becaf995317da863a3d9a922923e65265384 UNKNOWN
   * 2786ad4f78bf48620f402ffaef4142c21b5f5b87 Azure: [PENDING](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=22485) 
   
   <details>
   <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot run travis` re-run the last Travis build
    - `@flinkbot run azure` re-run the last Azure build
   </details>


-- 
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: issues-unsubscribe@flink.apache.org

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



[GitHub] [flink] Airblader commented on a change in pull request #16805: [FLINK-16501][table] Support IS JSON for Table API

Posted by GitBox <gi...@apache.org>.
Airblader commented on a change in pull request #16805:
URL: https://github.com/apache/flink/pull/16805#discussion_r690042229



##########
File path: docs/data/sql_functions.yml
##########
@@ -580,18 +614,18 @@ json:
       If the error behavior is omitted, `FALSE ON ERROR` is assumed as the default.
 
       ```
-      // TRUE

Review comment:
       99fd8f313c2114128eb0a6ec7f0c4fb7a31a487f should probably still be merged for 1.14. Do you want to backport the commit when merging this PR or should I raise a separate PR for that hotfix?




-- 
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: issues-unsubscribe@flink.apache.org

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



[GitHub] [flink] flinkbot edited a comment on pull request #16805: [FLINK-16501][table] Support IS JSON for Table API

Posted by GitBox <gi...@apache.org>.
flinkbot edited a comment on pull request #16805:
URL: https://github.com/apache/flink/pull/16805#issuecomment-898269056


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "4ba2c084610f7beb223d100b44a8ff4dd779ce47",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=22063",
       "triggerID" : "4ba2c084610f7beb223d100b44a8ff4dd779ce47",
       "triggerType" : "PUSH"
     }, {
       "hash" : "6287b2a27d1e6fd86c520055b834c4c99ca3fb23",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=22351",
       "triggerID" : "6287b2a27d1e6fd86c520055b834c4c99ca3fb23",
       "triggerType" : "PUSH"
     }, {
       "hash" : "d658becaf995317da863a3d9a922923e65265384",
       "status" : "UNKNOWN",
       "url" : "TBD",
       "triggerID" : "d658becaf995317da863a3d9a922923e65265384",
       "triggerType" : "PUSH"
     }, {
       "hash" : "2786ad4f78bf48620f402ffaef4142c21b5f5b87",
       "status" : "SUCCESS",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=22485",
       "triggerID" : "2786ad4f78bf48620f402ffaef4142c21b5f5b87",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * d658becaf995317da863a3d9a922923e65265384 UNKNOWN
   * 2786ad4f78bf48620f402ffaef4142c21b5f5b87 Azure: [SUCCESS](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=22485) 
   
   <details>
   <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot run travis` re-run the last Travis build
    - `@flinkbot run azure` re-run the last Azure build
   </details>


-- 
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: issues-unsubscribe@flink.apache.org

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



[GitHub] [flink] flinkbot edited a comment on pull request #16805: [FLINK-16501][table] Support IS JSON for Table API

Posted by GitBox <gi...@apache.org>.
flinkbot edited a comment on pull request #16805:
URL: https://github.com/apache/flink/pull/16805#issuecomment-898269056


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "4ba2c084610f7beb223d100b44a8ff4dd779ce47",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=22063",
       "triggerID" : "4ba2c084610f7beb223d100b44a8ff4dd779ce47",
       "triggerType" : "PUSH"
     }, {
       "hash" : "6287b2a27d1e6fd86c520055b834c4c99ca3fb23",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=22351",
       "triggerID" : "6287b2a27d1e6fd86c520055b834c4c99ca3fb23",
       "triggerType" : "PUSH"
     }, {
       "hash" : "d658becaf995317da863a3d9a922923e65265384",
       "status" : "UNKNOWN",
       "url" : "TBD",
       "triggerID" : "d658becaf995317da863a3d9a922923e65265384",
       "triggerType" : "PUSH"
     }, {
       "hash" : "2786ad4f78bf48620f402ffaef4142c21b5f5b87",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=22485",
       "triggerID" : "2786ad4f78bf48620f402ffaef4142c21b5f5b87",
       "triggerType" : "PUSH"
     }, {
       "hash" : "842badc4fcd5d74a4e7161feeeed0e286364edb4",
       "status" : "FAILURE",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=23302",
       "triggerID" : "842badc4fcd5d74a4e7161feeeed0e286364edb4",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * d658becaf995317da863a3d9a922923e65265384 UNKNOWN
   * 842badc4fcd5d74a4e7161feeeed0e286364edb4 Azure: [FAILURE](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=23302) 
   
   <details>
   <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot run travis` re-run the last Travis build
    - `@flinkbot run azure` re-run the last Azure build
   </details>


-- 
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: issues-unsubscribe@flink.apache.org

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



[GitHub] [flink] flinkbot edited a comment on pull request #16805: [FLINK-16501][table] Support IS JSON for Table API

Posted by GitBox <gi...@apache.org>.
flinkbot edited a comment on pull request #16805:
URL: https://github.com/apache/flink/pull/16805#issuecomment-898269056


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "4ba2c084610f7beb223d100b44a8ff4dd779ce47",
       "status" : "PENDING",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=22063",
       "triggerID" : "4ba2c084610f7beb223d100b44a8ff4dd779ce47",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * 4ba2c084610f7beb223d100b44a8ff4dd779ce47 Azure: [PENDING](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=22063) 
   
   <details>
   <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot run travis` re-run the last Travis build
    - `@flinkbot run azure` re-run the last Azure build
   </details>


-- 
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: issues-unsubscribe@flink.apache.org

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



[GitHub] [flink] Airblader commented on a change in pull request #16805: [FLINK-16501][table] Support IS JSON for Table API

Posted by GitBox <gi...@apache.org>.
Airblader commented on a change in pull request #16805:
URL: https://github.com/apache/flink/pull/16805#discussion_r688288352



##########
File path: docs/data/sql_functions.yml
##########
@@ -83,7 +83,7 @@ logical:
     table: BOOLEAN1 && BOOLEAN2
     description: Returns TRUE if BOOLEAN1 and BOOLEAN2 are both TRUE. Supports three-valued logic. E.g., true && Null(BOOLEAN) returns UNKNOWN.
   - sql: NOT boolean
-    table: '!BOOLEAN'
+    table: BOOLEAN.not() or '!BOOLEAN' (Scala only)

Review comment:
       `and` and `or` are exposed both as infix and postfix. I went with postfix only for now here.




-- 
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: issues-unsubscribe@flink.apache.org

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



[GitHub] [flink] twalthr commented on a change in pull request #16805: [FLINK-16501][table] Support IS JSON for Table API

Posted by GitBox <gi...@apache.org>.
twalthr commented on a change in pull request #16805:
URL: https://github.com/apache/flink/pull/16805#discussion_r700189785



##########
File path: flink-python/pyflink/table/tests/test_expression.py
##########
@@ -19,7 +19,7 @@
 
 from pyflink.table import DataTypes
 from pyflink.table.expression import TimeIntervalUnit, TimePointUnit, JsonExistsOnError, \
-    JsonValueOnEmptyOrError
+    JsonValueOnEmptyOrError, JsonType

Review comment:
       isn't this a mistake actually? but let's leave it as it is for now.




-- 
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: issues-unsubscribe@flink.apache.org

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



[GitHub] [flink] Airblader commented on a change in pull request #16805: [FLINK-16501][table] Support IS JSON for Table API

Posted by GitBox <gi...@apache.org>.
Airblader commented on a change in pull request #16805:
URL: https://github.com/apache/flink/pull/16805#discussion_r688288352



##########
File path: docs/data/sql_functions.yml
##########
@@ -83,7 +83,7 @@ logical:
     table: BOOLEAN1 && BOOLEAN2
     description: Returns TRUE if BOOLEAN1 and BOOLEAN2 are both TRUE. Supports three-valued logic. E.g., true && Null(BOOLEAN) returns UNKNOWN.
   - sql: NOT boolean
-    table: '!BOOLEAN'
+    table: BOOLEAN.not() or '!BOOLEAN' (Scala only)

Review comment:
       `and` and `or` are exposed both as infix and postfix. I went with postfix only for now here.




-- 
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: issues-unsubscribe@flink.apache.org

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



[GitHub] [flink] flinkbot edited a comment on pull request #16805: [FLINK-16501][table] Support IS JSON for Table API

Posted by GitBox <gi...@apache.org>.
flinkbot edited a comment on pull request #16805:
URL: https://github.com/apache/flink/pull/16805#issuecomment-898269056






-- 
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: issues-unsubscribe@flink.apache.org

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



[GitHub] [flink] flinkbot edited a comment on pull request #16805: [FLINK-16501][table] Support IS JSON for Table API

Posted by GitBox <gi...@apache.org>.
flinkbot edited a comment on pull request #16805:
URL: https://github.com/apache/flink/pull/16805#issuecomment-898269056


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "4ba2c084610f7beb223d100b44a8ff4dd779ce47",
       "status" : "SUCCESS",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=22063",
       "triggerID" : "4ba2c084610f7beb223d100b44a8ff4dd779ce47",
       "triggerType" : "PUSH"
     }, {
       "hash" : "6287b2a27d1e6fd86c520055b834c4c99ca3fb23",
       "status" : "UNKNOWN",
       "url" : "TBD",
       "triggerID" : "6287b2a27d1e6fd86c520055b834c4c99ca3fb23",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * 4ba2c084610f7beb223d100b44a8ff4dd779ce47 Azure: [SUCCESS](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=22063) 
   * 6287b2a27d1e6fd86c520055b834c4c99ca3fb23 UNKNOWN
   
   <details>
   <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot run travis` re-run the last Travis build
    - `@flinkbot run azure` re-run the last Azure build
   </details>


-- 
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: issues-unsubscribe@flink.apache.org

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



[GitHub] [flink] flinkbot edited a comment on pull request #16805: [FLINK-16501][table] Support IS JSON for Table API

Posted by GitBox <gi...@apache.org>.
flinkbot edited a comment on pull request #16805:
URL: https://github.com/apache/flink/pull/16805#issuecomment-898269056


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "4ba2c084610f7beb223d100b44a8ff4dd779ce47",
       "status" : "SUCCESS",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=22063",
       "triggerID" : "4ba2c084610f7beb223d100b44a8ff4dd779ce47",
       "triggerType" : "PUSH"
     }, {
       "hash" : "6287b2a27d1e6fd86c520055b834c4c99ca3fb23",
       "status" : "PENDING",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=22351",
       "triggerID" : "6287b2a27d1e6fd86c520055b834c4c99ca3fb23",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * 4ba2c084610f7beb223d100b44a8ff4dd779ce47 Azure: [SUCCESS](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=22063) 
   * 6287b2a27d1e6fd86c520055b834c4c99ca3fb23 Azure: [PENDING](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=22351) 
   
   <details>
   <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot run travis` re-run the last Travis build
    - `@flinkbot run azure` re-run the last Azure build
   </details>


-- 
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: issues-unsubscribe@flink.apache.org

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



[GitHub] [flink] Airblader commented on a change in pull request #16805: [FLINK-16501][table] Support IS JSON for Table API

Posted by GitBox <gi...@apache.org>.
Airblader commented on a change in pull request #16805:
URL: https://github.com/apache/flink/pull/16805#discussion_r690041300



##########
File path: flink-table/flink-table-planner/src/test/java/org/apache/flink/table/planner/functions/JsonFunctionsITCase.java
##########
@@ -230,4 +233,76 @@ private static TestSpec jsonValue() throws Exception {
                         42,
                         DataTypes.INT());
     }
+
+    private static List<TestSpec> isJson() {

Review comment:
       I originally had more test cases, but removed some in a separate commit now since in the other PR that was one of the review feedback points.




-- 
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: issues-unsubscribe@flink.apache.org

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



[GitHub] [flink] Airblader commented on a change in pull request #16805: [FLINK-16501][table] Support IS JSON for Table API

Posted by GitBox <gi...@apache.org>.
Airblader commented on a change in pull request #16805:
URL: https://github.com/apache/flink/pull/16805#discussion_r688288352



##########
File path: docs/data/sql_functions.yml
##########
@@ -83,7 +83,7 @@ logical:
     table: BOOLEAN1 && BOOLEAN2
     description: Returns TRUE if BOOLEAN1 and BOOLEAN2 are both TRUE. Supports three-valued logic. E.g., true && Null(BOOLEAN) returns UNKNOWN.
   - sql: NOT boolean
-    table: '!BOOLEAN'
+    table: BOOLEAN.not() or '!BOOLEAN' (Scala only)

Review comment:
       `and` and `or` are exposed both as infix and postfix. I went with postfix only for now here.




-- 
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: issues-unsubscribe@flink.apache.org

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



[GitHub] [flink] flinkbot commented on pull request #16805: [FLINK-16501][table] Support IS JSON for Table API

Posted by GitBox <gi...@apache.org>.
flinkbot commented on pull request #16805:
URL: https://github.com/apache/flink/pull/16805#issuecomment-898240944


   Thanks a lot for your contribution to the Apache Flink project. I'm the @flinkbot. I help the community
   to review your pull request. We will use this comment to track the progress of the review.
   
   
   ## Automated Checks
   Last check on commit 4ba2c084610f7beb223d100b44a8ff4dd779ce47 (Fri Aug 13 07:10:14 UTC 2021)
   
   **Warnings:**
    * No documentation files were touched! Remember to keep the Flink docs up to date!
   
   
   <sub>Mention the bot in a comment to re-run the automated checks.</sub>
   ## Review Progress
   
   * ❓ 1. The [description] looks good.
   * ❓ 2. There is [consensus] that the contribution should go into to Flink.
   * ❓ 3. Needs [attention] from.
   * ❓ 4. The change fits into the overall [architecture].
   * ❓ 5. Overall code [quality] is good.
   
   Please see the [Pull Request Review Guide](https://flink.apache.org/contributing/reviewing-prs.html) for a full explanation of the review process.<details>
    The Bot is tracking the review progress through labels. Labels are applied according to the order of the review items. For consensus, approval by a Flink committer of PMC member is required <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot approve description` to approve one or more aspects (aspects: `description`, `consensus`, `architecture` and `quality`)
    - `@flinkbot approve all` to approve all aspects
    - `@flinkbot approve-until architecture` to approve everything until `architecture`
    - `@flinkbot attention @username1 [@username2 ..]` to require somebody's attention
    - `@flinkbot disapprove architecture` to remove an approval you gave earlier
   </details>


-- 
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: issues-unsubscribe@flink.apache.org

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



[GitHub] [flink] Airblader commented on a change in pull request #16805: [FLINK-16501][table] Support IS JSON for Table API

Posted by GitBox <gi...@apache.org>.
Airblader commented on a change in pull request #16805:
URL: https://github.com/apache/flink/pull/16805#discussion_r699863553



##########
File path: docs/data/sql_functions.yml
##########
@@ -83,7 +83,7 @@ logical:
     table: BOOLEAN1 && BOOLEAN2
     description: Returns TRUE if BOOLEAN1 and BOOLEAN2 are both TRUE. Supports three-valued logic. E.g., true && Null(BOOLEAN) returns UNKNOWN.
   - sql: NOT boolean
-    table: '!BOOLEAN'
+    table: BOOLEAN.not() or '!BOOLEAN' (Scala only)

Review comment:
       I originally pointed this out as well (just deleted the comment yesterday). The reason I thought this isn't necessary is because `and` and `or` as prefix functions take arbitrarily many arguments (opposed to the postfix ones which are unary). However, `not` is always unary, and a prefix version of it thus doesn't seem as useful. Happy to add it if you still feel otherwise, though.

##########
File path: flink-table/flink-table-planner/src/test/java/org/apache/flink/table/planner/functions/LogicalFunctionsITCase.java
##########
@@ -35,10 +35,104 @@
     @Parameterized.Parameters(name = "{index}: {0}")
     public static List<TestSpec> testData() {
         List<TestSpec> cases = new ArrayList<>();
+        cases.addAll(and());

Review comment:
       Yeah, I noticed there were none, which is why I had added these.

##########
File path: flink-table/flink-table-common/src/main/java/org/apache/flink/table/functions/BuiltInFunctionDefinitions.java
##########
@@ -1488,6 +1489,20 @@
     // JSON functions
     // --------------------------------------------------------------------------------------------
 
+    public static final BuiltInFunctionDefinition IS_JSON =
+            BuiltInFunctionDefinition.newBuilder()
+                    .name("IS_JSON")
+                    .kind(SCALAR)
+                    .inputTypeStrategy(
+                            or(
+                                    sequence(logical(LogicalTypeFamily.CHARACTER_STRING)),
+                                    sequence(
+                                            logical(LogicalTypeFamily.CHARACTER_STRING),
+                                            symbol(JsonType.class))))
+                    .outputTypeStrategy(explicit(DataTypes.BOOLEAN().notNull()))

Review comment:
       `IS JSON` is never nullable, it returns boolean even on null input.

##########
File path: flink-table/flink-table-common/src/main/java/org/apache/flink/table/functions/BuiltInFunctionDefinitions.java
##########
@@ -1488,6 +1489,20 @@
     // JSON functions
     // --------------------------------------------------------------------------------------------
 
+    public static final BuiltInFunctionDefinition IS_JSON =
+            BuiltInFunctionDefinition.newBuilder()
+                    .name("IS_JSON")
+                    .kind(SCALAR)
+                    .inputTypeStrategy(
+                            or(
+                                    sequence(logical(LogicalTypeFamily.CHARACTER_STRING)),
+                                    sequence(
+                                            logical(LogicalTypeFamily.CHARACTER_STRING),
+                                            symbol(JsonType.class))))
+                    .outputTypeStrategy(explicit(DataTypes.BOOLEAN().notNull()))

Review comment:
       `IS JSON` is never nullable, it returns boolean even on null input.

##########
File path: flink-table/flink-table-common/src/main/java/org/apache/flink/table/functions/BuiltInFunctionDefinitions.java
##########
@@ -1488,6 +1489,20 @@
     // JSON functions
     // --------------------------------------------------------------------------------------------
 
+    public static final BuiltInFunctionDefinition IS_JSON =
+            BuiltInFunctionDefinition.newBuilder()
+                    .name("IS_JSON")
+                    .kind(SCALAR)
+                    .inputTypeStrategy(
+                            or(
+                                    sequence(logical(LogicalTypeFamily.CHARACTER_STRING)),
+                                    sequence(
+                                            logical(LogicalTypeFamily.CHARACTER_STRING),
+                                            symbol(JsonType.class))))
+                    .outputTypeStrategy(explicit(DataTypes.BOOLEAN().notNull()))

Review comment:
       `IS JSON` is supposed to never be nullable, and always return true or false. However, it does seem this is currently implemented incorrectly. :-/

##########
File path: flink-python/pyflink/table/tests/test_expression.py
##########
@@ -19,7 +19,7 @@
 
 from pyflink.table import DataTypes
 from pyflink.table.expression import TimeIntervalUnit, TimePointUnit, JsonExistsOnError, \
-    JsonValueOnEmptyOrError
+    JsonValueOnEmptyOrError, JsonType

Review comment:
       That's where all other enums are as well. Or am I misunderstanding the question?

##########
File path: flink-table/flink-table-common/src/main/java/org/apache/flink/table/functions/BuiltInFunctionDefinitions.java
##########
@@ -1488,6 +1489,20 @@
     // JSON functions
     // --------------------------------------------------------------------------------------------
 
+    public static final BuiltInFunctionDefinition IS_JSON =
+            BuiltInFunctionDefinition.newBuilder()
+                    .name("IS_JSON")
+                    .kind(SCALAR)
+                    .inputTypeStrategy(
+                            or(
+                                    sequence(logical(LogicalTypeFamily.CHARACTER_STRING)),
+                                    sequence(
+                                            logical(LogicalTypeFamily.CHARACTER_STRING),
+                                            symbol(JsonType.class))))
+                    .outputTypeStrategy(explicit(DataTypes.BOOLEAN().notNull()))

Review comment:
       I'll fix that as part of this PR.

##########
File path: flink-table/flink-table-common/src/main/java/org/apache/flink/table/functions/BuiltInFunctionDefinitions.java
##########
@@ -1488,6 +1489,20 @@
     // JSON functions
     // --------------------------------------------------------------------------------------------
 
+    public static final BuiltInFunctionDefinition IS_JSON =
+            BuiltInFunctionDefinition.newBuilder()
+                    .name("IS_JSON")
+                    .kind(SCALAR)
+                    .inputTypeStrategy(
+                            or(

Review comment:
       We could, but I think the logic is pretty straight-forward here and that way programmatic calls still work, so I would leave it as is?

##########
File path: docs/data/sql_functions.yml
##########
@@ -83,7 +83,7 @@ logical:
     table: BOOLEAN1 && BOOLEAN2
     description: Returns TRUE if BOOLEAN1 and BOOLEAN2 are both TRUE. Supports three-valued logic. E.g., true && Null(BOOLEAN) returns UNKNOWN.
   - sql: NOT boolean
-    table: '!BOOLEAN'
+    table: BOOLEAN.not() or '!BOOLEAN' (Scala only)

Review comment:
       I've added it as a fixup commit to the hotfix. Feel free to either squash it in or discard the commit.




-- 
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: issues-unsubscribe@flink.apache.org

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



[GitHub] [flink] Airblader commented on a change in pull request #16805: [FLINK-16501][table] Support IS JSON for Table API

Posted by GitBox <gi...@apache.org>.
Airblader commented on a change in pull request #16805:
URL: https://github.com/apache/flink/pull/16805#discussion_r699863763



##########
File path: flink-table/flink-table-planner/src/test/java/org/apache/flink/table/planner/functions/LogicalFunctionsITCase.java
##########
@@ -35,10 +35,104 @@
     @Parameterized.Parameters(name = "{index}: {0}")
     public static List<TestSpec> testData() {
         List<TestSpec> cases = new ArrayList<>();
+        cases.addAll(and());

Review comment:
       Yeah, I noticed there were none, which is why I had added these.




-- 
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: issues-unsubscribe@flink.apache.org

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



[GitHub] [flink] flinkbot edited a comment on pull request #16805: [FLINK-16501][table] Support IS JSON for Table API

Posted by GitBox <gi...@apache.org>.
flinkbot edited a comment on pull request #16805:
URL: https://github.com/apache/flink/pull/16805#issuecomment-898269056


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "4ba2c084610f7beb223d100b44a8ff4dd779ce47",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=22063",
       "triggerID" : "4ba2c084610f7beb223d100b44a8ff4dd779ce47",
       "triggerType" : "PUSH"
     }, {
       "hash" : "6287b2a27d1e6fd86c520055b834c4c99ca3fb23",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=22351",
       "triggerID" : "6287b2a27d1e6fd86c520055b834c4c99ca3fb23",
       "triggerType" : "PUSH"
     }, {
       "hash" : "d658becaf995317da863a3d9a922923e65265384",
       "status" : "UNKNOWN",
       "url" : "TBD",
       "triggerID" : "d658becaf995317da863a3d9a922923e65265384",
       "triggerType" : "PUSH"
     }, {
       "hash" : "2786ad4f78bf48620f402ffaef4142c21b5f5b87",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=22485",
       "triggerID" : "2786ad4f78bf48620f402ffaef4142c21b5f5b87",
       "triggerType" : "PUSH"
     }, {
       "hash" : "842badc4fcd5d74a4e7161feeeed0e286364edb4",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=23302",
       "triggerID" : "842badc4fcd5d74a4e7161feeeed0e286364edb4",
       "triggerType" : "PUSH"
     }, {
       "hash" : "af0dd8c913a0044732d69a85ba37b136f70ca083",
       "status" : "SUCCESS",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=23329",
       "triggerID" : "af0dd8c913a0044732d69a85ba37b136f70ca083",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * d658becaf995317da863a3d9a922923e65265384 UNKNOWN
   * af0dd8c913a0044732d69a85ba37b136f70ca083 Azure: [SUCCESS](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=23329) 
   
   <details>
   <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot run travis` re-run the last Travis build
    - `@flinkbot run azure` re-run the last Azure build
   </details>


-- 
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: issues-unsubscribe@flink.apache.org

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



[GitHub] [flink] twalthr commented on a change in pull request #16805: [FLINK-16501][table] Support IS JSON for Table API

Posted by GitBox <gi...@apache.org>.
twalthr commented on a change in pull request #16805:
URL: https://github.com/apache/flink/pull/16805#discussion_r699410061



##########
File path: docs/data/sql_functions.yml
##########
@@ -83,7 +83,7 @@ logical:
     table: BOOLEAN1 && BOOLEAN2
     description: Returns TRUE if BOOLEAN1 and BOOLEAN2 are both TRUE. Supports three-valued logic. E.g., true && Null(BOOLEAN) returns UNKNOWN.
   - sql: NOT boolean
-    table: '!BOOLEAN'
+    table: BOOLEAN.not() or '!BOOLEAN' (Scala only)

Review comment:
       we should also introduce a prefix notation in `Expressions` similar to `and` and `or`

##########
File path: docs/data/sql_functions.yml
##########
@@ -580,18 +614,18 @@ json:
       If the error behavior is omitted, `FALSE ON ERROR` is assumed as the default.
 
       ```
-      // TRUE

Review comment:
       if there are no merge conflicts, I can simply backport it while merging

##########
File path: docs/data/sql_functions.yml
##########
@@ -572,6 +572,40 @@ collection:
     description: Returns the value specified by key value in map.
 
 json:
+  - sql: IS JSON [ { VALUE | SCALAR | ARRAY | OBJECT } ]
+    table: STRING.isJson([JsonType type])
+    description: |
+      Determine whether a given string is valid JSON.
+
+      Specifying the optional type argument puts a constraint on which type of JSON object is
+      allowed. If the string is valid JSON, but not that type, `false` is returned. The default is
+      `VALUE`.
+
+      ```
+      -- TRUE

Review comment:
       add an example for the `NULL IS JSON` or `NULL IS JSON SCALAR` behavior?

##########
File path: flink-table/flink-table-common/src/main/java/org/apache/flink/table/functions/BuiltInFunctionDefinitions.java
##########
@@ -1488,6 +1489,20 @@
     // JSON functions
     // --------------------------------------------------------------------------------------------
 
+    public static final BuiltInFunctionDefinition IS_JSON =
+            BuiltInFunctionDefinition.newBuilder()
+                    .name("IS_JSON")
+                    .kind(SCALAR)
+                    .inputTypeStrategy(
+                            or(

Review comment:
       we could also simplify the logic here and in the converter if we move the default value again to the API class, similar to what we did in the other function

##########
File path: flink-table/flink-table-common/src/main/java/org/apache/flink/table/functions/BuiltInFunctionDefinitions.java
##########
@@ -1488,6 +1489,20 @@
     // JSON functions
     // --------------------------------------------------------------------------------------------
 
+    public static final BuiltInFunctionDefinition IS_JSON =
+            BuiltInFunctionDefinition.newBuilder()
+                    .name("IS_JSON")
+                    .kind(SCALAR)
+                    .inputTypeStrategy(
+                            or(
+                                    sequence(logical(LogicalTypeFamily.CHARACTER_STRING)),
+                                    sequence(
+                                            logical(LogicalTypeFamily.CHARACTER_STRING),
+                                            symbol(JsonType.class))))
+                    .outputTypeStrategy(explicit(DataTypes.BOOLEAN().notNull()))

Review comment:
       shouldn't this be `nullifArgs`? Maybe the docs are not clear enough for me as mentioned above.

##########
File path: flink-table/flink-table-planner/src/test/java/org/apache/flink/table/planner/functions/LogicalFunctionsITCase.java
##########
@@ -35,10 +35,104 @@
     @Parameterized.Parameters(name = "{index}: {0}")
     public static List<TestSpec> testData() {
         List<TestSpec> cases = new ArrayList<>();
+        cases.addAll(and());

Review comment:
       side comment: I just wanted to ask for dropping tests that use the old test bases but I couldn't find any tests for it, weird

##########
File path: flink-python/pyflink/table/tests/test_expression.py
##########
@@ -19,7 +19,7 @@
 
 from pyflink.table import DataTypes
 from pyflink.table.expression import TimeIntervalUnit, TimePointUnit, JsonExistsOnError, \
-    JsonValueOnEmptyOrError
+    JsonValueOnEmptyOrError, JsonType

Review comment:
       is `JsonType` under `pyflink.table.expression` in Python correct?

##########
File path: flink-table/flink-table-planner/src/test/java/org/apache/flink/table/planner/functions/JsonFunctionsITCase.java
##########
@@ -230,4 +233,76 @@ private static TestSpec jsonValue() throws Exception {
                         42,
                         DataTypes.INT());
     }
+
+    private static List<TestSpec> isJson() {

Review comment:
       at some point we will need to improve the test base before people complain about our large expression testing times




-- 
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: issues-unsubscribe@flink.apache.org

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



[GitHub] [flink] flinkbot edited a comment on pull request #16805: [FLINK-16501][table] Support IS JSON for Table API

Posted by GitBox <gi...@apache.org>.
flinkbot edited a comment on pull request #16805:
URL: https://github.com/apache/flink/pull/16805#issuecomment-898269056


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "4ba2c084610f7beb223d100b44a8ff4dd779ce47",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=22063",
       "triggerID" : "4ba2c084610f7beb223d100b44a8ff4dd779ce47",
       "triggerType" : "PUSH"
     }, {
       "hash" : "6287b2a27d1e6fd86c520055b834c4c99ca3fb23",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=22351",
       "triggerID" : "6287b2a27d1e6fd86c520055b834c4c99ca3fb23",
       "triggerType" : "PUSH"
     }, {
       "hash" : "d658becaf995317da863a3d9a922923e65265384",
       "status" : "UNKNOWN",
       "url" : "TBD",
       "triggerID" : "d658becaf995317da863a3d9a922923e65265384",
       "triggerType" : "PUSH"
     }, {
       "hash" : "2786ad4f78bf48620f402ffaef4142c21b5f5b87",
       "status" : "SUCCESS",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=22485",
       "triggerID" : "2786ad4f78bf48620f402ffaef4142c21b5f5b87",
       "triggerType" : "PUSH"
     }, {
       "hash" : "842badc4fcd5d74a4e7161feeeed0e286364edb4",
       "status" : "UNKNOWN",
       "url" : "TBD",
       "triggerID" : "842badc4fcd5d74a4e7161feeeed0e286364edb4",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * d658becaf995317da863a3d9a922923e65265384 UNKNOWN
   * 2786ad4f78bf48620f402ffaef4142c21b5f5b87 Azure: [SUCCESS](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=22485) 
   * 842badc4fcd5d74a4e7161feeeed0e286364edb4 UNKNOWN
   
   <details>
   <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot run travis` re-run the last Travis build
    - `@flinkbot run azure` re-run the last Azure build
   </details>


-- 
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: issues-unsubscribe@flink.apache.org

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



[GitHub] [flink] twalthr commented on a change in pull request #16805: [FLINK-16501][table] Support IS JSON for Table API

Posted by GitBox <gi...@apache.org>.
twalthr commented on a change in pull request #16805:
URL: https://github.com/apache/flink/pull/16805#discussion_r699410061



##########
File path: docs/data/sql_functions.yml
##########
@@ -83,7 +83,7 @@ logical:
     table: BOOLEAN1 && BOOLEAN2
     description: Returns TRUE if BOOLEAN1 and BOOLEAN2 are both TRUE. Supports three-valued logic. E.g., true && Null(BOOLEAN) returns UNKNOWN.
   - sql: NOT boolean
-    table: '!BOOLEAN'
+    table: BOOLEAN.not() or '!BOOLEAN' (Scala only)

Review comment:
       we should also introduce a prefix notation in `Expressions` similar to `and` and `or`

##########
File path: docs/data/sql_functions.yml
##########
@@ -580,18 +614,18 @@ json:
       If the error behavior is omitted, `FALSE ON ERROR` is assumed as the default.
 
       ```
-      // TRUE

Review comment:
       if there are no merge conflicts, I can simply backport it while merging

##########
File path: docs/data/sql_functions.yml
##########
@@ -572,6 +572,40 @@ collection:
     description: Returns the value specified by key value in map.
 
 json:
+  - sql: IS JSON [ { VALUE | SCALAR | ARRAY | OBJECT } ]
+    table: STRING.isJson([JsonType type])
+    description: |
+      Determine whether a given string is valid JSON.
+
+      Specifying the optional type argument puts a constraint on which type of JSON object is
+      allowed. If the string is valid JSON, but not that type, `false` is returned. The default is
+      `VALUE`.
+
+      ```
+      -- TRUE

Review comment:
       add an example for the `NULL IS JSON` or `NULL IS JSON SCALAR` behavior?

##########
File path: flink-table/flink-table-common/src/main/java/org/apache/flink/table/functions/BuiltInFunctionDefinitions.java
##########
@@ -1488,6 +1489,20 @@
     // JSON functions
     // --------------------------------------------------------------------------------------------
 
+    public static final BuiltInFunctionDefinition IS_JSON =
+            BuiltInFunctionDefinition.newBuilder()
+                    .name("IS_JSON")
+                    .kind(SCALAR)
+                    .inputTypeStrategy(
+                            or(

Review comment:
       we could also simplify the logic here and in the converter if we move the default value again to the API class, similar to what we did in the other function

##########
File path: flink-table/flink-table-common/src/main/java/org/apache/flink/table/functions/BuiltInFunctionDefinitions.java
##########
@@ -1488,6 +1489,20 @@
     // JSON functions
     // --------------------------------------------------------------------------------------------
 
+    public static final BuiltInFunctionDefinition IS_JSON =
+            BuiltInFunctionDefinition.newBuilder()
+                    .name("IS_JSON")
+                    .kind(SCALAR)
+                    .inputTypeStrategy(
+                            or(
+                                    sequence(logical(LogicalTypeFamily.CHARACTER_STRING)),
+                                    sequence(
+                                            logical(LogicalTypeFamily.CHARACTER_STRING),
+                                            symbol(JsonType.class))))
+                    .outputTypeStrategy(explicit(DataTypes.BOOLEAN().notNull()))

Review comment:
       shouldn't this be `nullifArgs`? Maybe the docs are not clear enough for me as mentioned above.

##########
File path: flink-table/flink-table-planner/src/test/java/org/apache/flink/table/planner/functions/LogicalFunctionsITCase.java
##########
@@ -35,10 +35,104 @@
     @Parameterized.Parameters(name = "{index}: {0}")
     public static List<TestSpec> testData() {
         List<TestSpec> cases = new ArrayList<>();
+        cases.addAll(and());

Review comment:
       side comment: I just wanted to ask for dropping tests that use the old test bases but I couldn't find any tests for it, weird

##########
File path: flink-python/pyflink/table/tests/test_expression.py
##########
@@ -19,7 +19,7 @@
 
 from pyflink.table import DataTypes
 from pyflink.table.expression import TimeIntervalUnit, TimePointUnit, JsonExistsOnError, \
-    JsonValueOnEmptyOrError
+    JsonValueOnEmptyOrError, JsonType

Review comment:
       is `JsonType` under `pyflink.table.expression` in Python correct?

##########
File path: flink-table/flink-table-planner/src/test/java/org/apache/flink/table/planner/functions/JsonFunctionsITCase.java
##########
@@ -230,4 +233,76 @@ private static TestSpec jsonValue() throws Exception {
                         42,
                         DataTypes.INT());
     }
+
+    private static List<TestSpec> isJson() {

Review comment:
       at some point we will need to improve the test base before people complain about our large expression testing times




-- 
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: issues-unsubscribe@flink.apache.org

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