flink-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Anton Mushin (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (FLINK-4832) Count/Sum 0 elements
Date Fri, 18 Nov 2016 10:42:58 GMT

    [ https://issues.apache.org/jira/browse/FLINK-4832?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15676435#comment-15676435
] 

Anton Mushin commented on FLINK-4832:
-------------------------------------

Hi [~twalthr],
I have trouble with next code
{code:java}
@Test
	public void testValuesWithCast() throws Exception {
		ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
		BatchTableEnvironment tableEnv = TableEnvironment.getTableEnvironment(env, config());

		String sqlQuery = "VALUES (1, cast(1 as BIGINT) )," +
			"(2, cast(2 as BIGINT))," +
			"(3, cast(3 as BIGINT))";
		Table result = tableEnv.sql(sqlQuery);
		DataSet<Row> resultSet = tableEnv.toDataSet(result, Row.class);
		resultSet.print();
		List<Row> results = resultSet.collect();
		String expected = "1,1\n2,2\n3,3";
		compareResultAsText(results, expected);
	}
{code}
I'm getting next output:
{noformat}
1,1
2,2

java.lang.AssertionError: Wrong number of elements result 
Expected :3
Actual   :2
{noformat}
I should not use {{cast}} operator in {{VALUES}} or is it bug? 

> Count/Sum 0 elements
> --------------------
>
>                 Key: FLINK-4832
>                 URL: https://issues.apache.org/jira/browse/FLINK-4832
>             Project: Flink
>          Issue Type: Improvement
>          Components: Table API & SQL
>            Reporter: Timo Walther
>            Assignee: Anton Mushin
>
> Currently, the Table API is unable to count or sum up 0 elements. We should improve DataSet
aggregations for this. Maybe by union the original DataSet with a dummy record or by using
a MapPartition function. Coming up with a good design for this is also part of this issue.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message