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 2017/02/15 10:08:28 UTC

[GitHub] flink pull request #3318: [FLINK-5070] [types] Unable to use Scala's BeanPro...

GitHub user twalthr opened a pull request:

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

    [FLINK-5070] [types] Unable to use Scala's BeanProperty with classes

    This PR fixes issues with `@BeanProperty` annotation. The problem is that `var` generates Scala-style getters/setters and the annotation generates Java-style getters/setters. Right now Flink only supports one style in a POJO. I don't know why we have this restriction. I removed them.

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

    $ git pull https://github.com/twalthr/flink FLINK-5070

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

    https://github.com/apache/flink/pull/3318.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 #3318
    
----
commit 552e708a713df6ed9fe65f508771e56b0dbcd50b
Author: twalthr <tw...@apache.org>
Date:   2017-02-15T10:05:38Z

    [FLINK-5070] [types] Unable to use Scala's BeanProperty with classes

----


---
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 #3318: [FLINK-5070] [types] Unable to use Scala's BeanPro...

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

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


---
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 #3318: [FLINK-5070] [types] Unable to use Scala's BeanPro...

Posted by StephanEwen <gi...@git.apache.org>.
Github user StephanEwen commented on a diff in the pull request:

    https://github.com/apache/flink/pull/3318#discussion_r101282565
  
    --- Diff: flink-core/src/main/java/org/apache/flink/api/java/typeutils/TypeExtractor.java ---
    @@ -1723,20 +1720,17 @@ private boolean isValidPojoField(Field f, Class<?> clazz, ArrayList<Type> typeHi
     					// return type is void.
     					m.getReturnType().equals(Void.TYPE)
     				) {
    -					if(hasSetter) {
    -						throw new IllegalStateException("Detected more than one setter");
    -					}
     					hasSetter = true;
     				}
     			}
     			if(hasGetter && hasSetter) {
     				return true;
     			} else {
     				if(!hasGetter) {
    -					LOG.debug(clazz+" does not contain a getter for field "+f.getName() );
    +					LOG.info(clazz+" does not contain a getter for field "+f.getName() );
    --- End diff --
    
    Does it make sense to log this on `info`? That can be a lot of log output for programs with many types...


---
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 issue #3318: [FLINK-5070] [types] Unable to use Scala's BeanProperty w...

Posted by StephanEwen <gi...@git.apache.org>.
Github user StephanEwen commented on the issue:

    https://github.com/apache/flink/pull/3318
  
    I cannot recall a reason why we allow only one getter/setter.
    
    I have a comment on the logging, though...


---
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 #3318: [FLINK-5070] [types] Unable to use Scala's BeanPro...

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

    https://github.com/apache/flink/pull/3318#discussion_r101299257
  
    --- Diff: flink-core/src/main/java/org/apache/flink/api/java/typeutils/TypeExtractor.java ---
    @@ -1723,20 +1720,17 @@ private boolean isValidPojoField(Field f, Class<?> clazz, ArrayList<Type> typeHi
     					// return type is void.
     					m.getReturnType().equals(Void.TYPE)
     				) {
    -					if(hasSetter) {
    -						throw new IllegalStateException("Detected more than one setter");
    -					}
     					hasSetter = true;
     				}
     			}
     			if(hasGetter && hasSetter) {
     				return true;
     			} else {
     				if(!hasGetter) {
    -					LOG.debug(clazz+" does not contain a getter for field "+f.getName() );
    +					LOG.info(clazz+" does not contain a getter for field "+f.getName() );
    --- End diff --
    
    I would say yes. It is very hard for users to figure out why a object is not a POJO. Information about the problematic field is helpful. This message will occur as often as `clazz is not a valid POJO.`, so one output per non-POJO.


---
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.
---