[
https://issues.apache.org/jira/browse/FLINK-5358?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15762945#comment-15762945
]
ASF GitHub Bot commented on FLINK-5358:
---------------------------------------
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 ?
> Support RowTypeInfo extraction in TypeExtractor by Row instance
> ---------------------------------------------------------------
>
> Key: FLINK-5358
> URL: https://issues.apache.org/jira/browse/FLINK-5358
> Project: Flink
> Issue Type: Improvement
> Reporter: Anton Solovev
> Assignee: Anton Solovev
>
> {code}
> Row[] data = new Row[]{};
> TypeInformation<X> typeInfo = TypeExtractor.getForObject(data[0]);
> {code}
> method {{getForObject}} wraps it into
> {code}
> GenericTypeInfo<org.apache.flink.types.Row>
> {code}
> the method should return {{RowTypeInfo}}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)