You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by twalthr <gi...@git.apache.org> on 2016/04/13 12:41:14 UTC

[GitHub] flink pull request: [FLINK-3739] [table] Add a null literal to Tab...

GitHub user twalthr opened a pull request:

    https://github.com/apache/flink/pull/1880

    [FLINK-3739] [table] Add a null literal to Table API

    This PR adds the NULL literal to Java/Scala Table API as well as SQL API.

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

    $ git pull https://github.com/twalthr/flink TableApiNullLiteral

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

    https://github.com/apache/flink/pull/1880.patch

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

    This closes #1880
    
----
commit f0f34c8f338a405f5f3cfa4694258fe81c641ca8
Author: twalthr <tw...@apache.org>
Date:   2016-04-13T10:18:16Z

    [FLINK-3739] [table] Add a null literal to Table API

----


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] flink pull request: [FLINK-3739] [table] Add a null literal to Tab...

Posted by twalthr <gi...@git.apache.org>.
Github user twalthr commented on the pull request:

    https://github.com/apache/flink/pull/1880#issuecomment-209939139
  
    @fhueske yes we can also throw an expection if you like.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] flink pull request: [FLINK-3739] [table] Add a null literal to Tab...

Posted by fhueske <gi...@git.apache.org>.
Github user fhueske commented on the pull request:

    https://github.com/apache/flink/pull/1880#issuecomment-209941176
  
    OK, sounds good. The exception can be implemented as a separate issue. I'll open a JIRA for that.
    This PR looks good and can be merged, IMO.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] flink pull request: [FLINK-3739] [table] Add a null literal to Tab...

Posted by fhueske <gi...@git.apache.org>.
Github user fhueske commented on the pull request:

    https://github.com/apache/flink/pull/1880#issuecomment-210008964
  
    @twalthr, OK got it. The default is used in both cases. +1 to merge and fix FLINK-3759 soon.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] flink pull request: [FLINK-3739] [table] Add a null literal to Tab...

Posted by twalthr <gi...@git.apache.org>.
Github user twalthr commented on the pull request:

    https://github.com/apache/flink/pull/1880#issuecomment-209954564
  
    I have updated the documentation. I will update the EBNF grammar as part of FLINK-3086, because it seems to be out of sync anyway. I will assign FLINK-3086 to me, if thats ok?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] flink pull request: [FLINK-3739] [table] Add a null literal to Tab...

Posted by twalthr <gi...@git.apache.org>.
Github user twalthr commented on the pull request:

    https://github.com/apache/flink/pull/1880#issuecomment-209880906
  
    There are no silly questions ;-)
    SQL fully integrates NULL in all its operators. So we should also allow it in our APIs as our runtime allows it anyway. You need it for e.g. `CASE b WHEN 1 THEN 11 WHEN 2 THEN 4 ELSE NULL END`


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] flink pull request: [FLINK-3739] [table] Add a null literal to Tab...

Posted by twalthr <gi...@git.apache.org>.
Github user twalthr commented on the pull request:

    https://github.com/apache/flink/pull/1880#issuecomment-210357506
  
    Merging...


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] flink pull request: [FLINK-3739] [table] Add a null literal to Tab...

Posted by yjshen <gi...@git.apache.org>.
Github user yjshen commented on the pull request:

    https://github.com/apache/flink/pull/1880#issuecomment-209990696
  
    Are there other systems support `not nullCheck` mode?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] flink pull request: [FLINK-3739] [table] Add a null literal to Tab...

Posted by vasia <gi...@git.apache.org>.
Github user vasia commented on the pull request:

    https://github.com/apache/flink/pull/1880#issuecomment-209921610
  
    Hey @twalthr, thanks for the PR!
    One comment is that we need to update the docs about the null literal and how to configure the null check. Second, I don't really understand the behavior when the null check is not set. We return some default values, but how were these decided?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] flink pull request: [FLINK-3739] [table] Add a null literal to Tab...

Posted by asfgit <gi...@git.apache.org>.
Github user asfgit closed the pull request at:

    https://github.com/apache/flink/pull/1880


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] flink pull request: [FLINK-3739] [table] Add a null literal to Tab...

Posted by twalthr <gi...@git.apache.org>.
Github user twalthr commented on the pull request:

    https://github.com/apache/flink/pull/1880#issuecomment-209938182
  
    I will update the docs. The default values are defined in `CodeGenUtils`.
    ```
      def primitiveDefaultValue(tpe: TypeInformation[_]): String = tpe match {
        case INT_TYPE_INFO => "-1"
        case LONG_TYPE_INFO => "-1"
        case SHORT_TYPE_INFO => "-1"
        case BYTE_TYPE_INFO => "-1"
        case FLOAT_TYPE_INFO => "-1.0f"
        case DOUBLE_TYPE_INFO => "-1.0d"
        case BOOLEAN_TYPE_INFO => "false"
        case STRING_TYPE_INFO => "\"\""
        case CHAR_TYPE_INFO => "'\\0'"
        case _ => "null"
      }
    ```


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] flink pull request: [FLINK-3739] [table] Add a null literal to Tab...

Posted by fhueske <gi...@git.apache.org>.
Github user fhueske commented on the pull request:

    https://github.com/apache/flink/pull/1880#issuecomment-209943633
  
    Created FLINK-3759.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] flink pull request: [FLINK-3739] [table] Add a null literal to Tab...

Posted by fhueske <gi...@git.apache.org>.
Github user fhueske commented on the pull request:

    https://github.com/apache/flink/pull/1880#issuecomment-209938196
  
    Shouldn't the program fail if we encounter `null` values in the non-null mode? Replacing `null` with default values sounds wrong to me and can easily produce wrong results without anybody noticing it.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] flink pull request: [FLINK-3739] [table] Add a null literal to Tab...

Posted by fhueske <gi...@git.apache.org>.
Github user fhueske commented on the pull request:

    https://github.com/apache/flink/pull/1880#issuecomment-209958239
  
    Ah, thanks @yjshen for the explanation! :-)


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] flink pull request: [FLINK-3739] [table] Add a null literal to Tab...

Posted by yjshen <gi...@git.apache.org>.
Github user yjshen commented on the pull request:

    https://github.com/apache/flink/pull/1880#issuecomment-209836875
  
    Hi @twalthr, why we need a null literal? Please forgive me if this is a silly question...


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] flink pull request: [FLINK-3739] [table] Add a null literal to Tab...

Posted by twalthr <gi...@git.apache.org>.
Github user twalthr commented on the pull request:

    https://github.com/apache/flink/pull/1880#issuecomment-209976045
  
    @yjshen thanks for the explanation. You are right, the Table API has the same behavior.
    I would merge this later together with #1881, if no objections...


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] flink pull request: [FLINK-3739] [table] Add a null literal to Tab...

Posted by yjshen <gi...@git.apache.org>.
Github user yjshen commented on the pull request:

    https://github.com/apache/flink/pull/1880#issuecomment-209954946
  
    I happened to have context here for `primitiveDefaultValue`, I think this was originated from Apache Spark's counterpart for create default values for an expression. Let me summarize how it is used to calculate scalar expression's result in Spark:
    
    ```
    boolean ${result.isNull} = false;
    $javaType ${result.value} = ${ctx.defaultValue(type)};
    if (result is not null for some input) {
       ${result.value} = calculated result;
    } else {
       ${result.isNull} = true;
    }
    ```
    Therefore, after the evaluation of this expression, if the result is Null, the `isNull` field is set to `True` and no more touches on `value` field, if not null, the `result.value` point to the final result. The default value is never used.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] flink pull request: [FLINK-3739] [table] Add a null literal to Tab...

Posted by vasia <gi...@git.apache.org>.
Github user vasia commented on the pull request:

    https://github.com/apache/flink/pull/1880#issuecomment-209939834
  
    +1 to throwing an exception instead of returning a default value.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] flink pull request: [FLINK-3739] [table] Add a null literal to Tab...

Posted by twalthr <gi...@git.apache.org>.
Github user twalthr commented on the pull request:

    https://github.com/apache/flink/pull/1880#issuecomment-209985501
  
    Because @yjshen's code example only applies if the null check is enabled. If not, there is no additional `isNull` field. So every operation needs a valid return value that is used in the following operations otherwise default.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] flink pull request: [FLINK-3739] [table] Add a null literal to Tab...

Posted by fhueske <gi...@git.apache.org>.
Github user fhueske commented on the pull request:

    https://github.com/apache/flink/pull/1880#issuecomment-209980735
  
    If the Table API has the same behavior, why do the default values for nulls appear in the result of the tests?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---