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

[GitHub] flink pull request #3027: [FLINK-5358] add RowTypeInfo exctraction in TypeEx...

GitHub user tonycox opened a pull request:

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

    [FLINK-5358] add RowTypeInfo exctraction in TypeExtractor

    Thanks for contributing to Apache Flink. Before you open your pull request, please take the following check list into consideration.
    If your changes take all of the items into account, feel free to open your pull request. For more information and/or questions please refer to the [How To Contribute guide](http://flink.apache.org/how-to-contribute.html).
    In addition to going through the list, please provide a meaningful description of your changes.
    
    - [ ] General
      - The pull request references the related JIRA issue ("[FLINK-XXX] Jira title text")
      - The pull request addresses only one issue
      - Each commit in the PR has a meaningful commit message (including the JIRA id)
    
    - [ ] Documentation
      - Documentation has been added for new functionality
      - Old documentation affected by the pull request has been updated
      - JavaDoc for public methods has been added
    
    - [ ] Tests & Build
      - Functionality added by the pull request is covered by tests
      - `mvn clean verify` has been executed successfully locally or a Travis build has passed


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

    $ git pull https://github.com/tonycox/flink rowTypeExtractor

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

    https://github.com/apache/flink/pull/3027.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 #3027
    
----
commit 7aa9992e681761e255f3a24492f202354e77ab2e
Author: tonycox <an...@epam.com>
Date:   2016-12-16T16:55:40Z

    [FLINK-5358] add RowTypeInfo exctraction in TypeExtractor

----


---
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 #3027: [FLINK-5358] add RowTypeInfo exctraction in TypeEx...

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

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


---
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 #3027: [FLINK-5358] add RowTypeInfo exctraction in TypeExtractor

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

    https://github.com/apache/flink/pull/3027
  
    +1 to merge


---
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 #3027: [FLINK-5358] add RowTypeInfo exctraction in TypeEx...

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

    https://github.com/apache/flink/pull/3027#discussion_r93159119
  
    --- Diff: flink-core/src/test/java/org/apache/flink/api/java/typeutils/TypeExtractorTest.java ---
    @@ -345,8 +346,22 @@ public CustomType cross(CustomType first, Integer second) throws Exception {
     
     		Assert.assertFalse(TypeExtractor.getForClass(PojoWithNonPublicDefaultCtor.class) instanceof PojoTypeInfo);
     	}
    -	
     
    +	@Test
    +	public void testRow() {
    +		Row row = new Row(2);
    +		row.setField(0, "string");
    +		row.setField(1, 15);
    +		TypeInformation<Row> rowInfo = TypeExtractor.getForObject(row);
    +		Assert.assertEquals(rowInfo.getClass(), RowTypeInfo.class);
    +		Assert.assertEquals(2, rowInfo.getArity());
    --- End diff --
    
    Can we also test the nested type info?  such as:
    ```java
    assertEquals(
        new RowTypeInfo(
            BasicTypeInfo.STRING_TYPE_INFO, 
            BasicTypeInfo.INT_TYPE_INFO), 
        rowInfo);
    ```


---
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 #3027: [FLINK-5358] add RowTypeInfo exctraction in TypeExtractor

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

    https://github.com/apache/flink/pull/3027
  
    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 #3027: [FLINK-5358] add RowTypeInfo exctraction in TypeEx...

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

    https://github.com/apache/flink/pull/3027#discussion_r93159264
  
    --- Diff: flink-core/src/test/java/org/apache/flink/api/java/typeutils/TypeExtractorTest.java ---
    @@ -345,8 +346,22 @@ public CustomType cross(CustomType first, Integer second) throws Exception {
     
     		Assert.assertFalse(TypeExtractor.getForClass(PojoWithNonPublicDefaultCtor.class) instanceof PojoTypeInfo);
     	}
    -	
     
    +	@Test
    +	public void testRow() {
    +		Row row = new Row(2);
    +		row.setField(0, "string");
    +		row.setField(1, 15);
    +		TypeInformation<Row> rowInfo = TypeExtractor.getForObject(row);
    +		Assert.assertEquals(rowInfo.getClass(), RowTypeInfo.class);
    +		Assert.assertEquals(2, rowInfo.getArity());
    +
    +		Row nullRow = new Row(2);
    +		TypeInformation<Row> genericRowInfo = TypeExtractor.getForObject(nullRow);
    +		Assert.assertEquals(genericRowInfo, new GenericTypeInfo<>(Row.class));
    +		int arity = genericRowInfo.getArity();
    +		genericRowInfo.hashCode();
    --- End diff --
    
    Why do we call `getArity()` and `hashCode()` here ? 


---
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 #3027: [FLINK-5358] add RowTypeInfo exctraction in TypeEx...

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

    https://github.com/apache/flink/pull/3027#discussion_r93805887
  
    --- Diff: flink-core/src/test/java/org/apache/flink/api/java/typeutils/TypeExtractorTest.java ---
    @@ -345,8 +346,25 @@ public CustomType cross(CustomType first, Integer second) throws Exception {
     
     		Assert.assertFalse(TypeExtractor.getForClass(PojoWithNonPublicDefaultCtor.class) instanceof PojoTypeInfo);
     	}
    -	
     
    +	@Test
    +	public void testRow() {
    --- End diff --
    
    Please add a check for a `Row` with a `null` field.


---
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 #3027: [FLINK-5358] add RowTypeInfo exctraction in TypeEx...

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

    https://github.com/apache/flink/pull/3027#discussion_r93848593
  
    --- Diff: flink-core/src/test/java/org/apache/flink/api/java/typeutils/TypeExtractorTest.java ---
    @@ -345,8 +346,25 @@ public CustomType cross(CustomType first, Integer second) throws Exception {
     
     		Assert.assertFalse(TypeExtractor.getForClass(PojoWithNonPublicDefaultCtor.class) instanceof PojoTypeInfo);
     	}
    -	
     
    +	@Test
    +	public void testRow() {
    --- End diff --
    
    in different test method? 
    there is already Row with a null field check
    
    `Row nullRow = new Row(2);
    TypeInformation<Row> genericRowInfo = TypeExtractor.getForObject(nullRow);
    Assert.assertEquals(genericRowInfo, new GenericTypeInfo<>(Row.class));`


---
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 #3027: [FLINK-5358] add RowTypeInfo exctraction in TypeExtractor

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

    https://github.com/apache/flink/pull/3027
  
    Thanks @tonycox. The changes look good. I'd would add one more test case to cover the case of `Row` objects with `null` fields.


---
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 #3027: [FLINK-5358] add RowTypeInfo exctraction in TypeEx...

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

    https://github.com/apache/flink/pull/3027#discussion_r93937117
  
    --- Diff: flink-core/src/test/java/org/apache/flink/api/java/typeutils/TypeExtractorTest.java ---
    @@ -345,8 +346,25 @@ public CustomType cross(CustomType first, Integer second) throws Exception {
     
     		Assert.assertFalse(TypeExtractor.getForClass(PojoWithNonPublicDefaultCtor.class) instanceof PojoTypeInfo);
     	}
    -	
     
    +	@Test
    +	public void testRow() {
    --- End diff --
    
    Oh, I'm sorry. I overlooked that check.


---
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 #3027: [FLINK-5358] add RowTypeInfo exctraction in TypeExtractor

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

    https://github.com/apache/flink/pull/3027
  
    Hi @fhueske could you look at this PR?


---
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 #3027: [FLINK-5358] add RowTypeInfo exctraction in TypeExtractor

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

    https://github.com/apache/flink/pull/3027
  
    Thanks @tonycox. PR is good to merge.


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