Return-Path: X-Original-To: apmail-flink-issues-archive@minotaur.apache.org Delivered-To: apmail-flink-issues-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id D1CF9172EE for ; Wed, 2 Sep 2015 13:13:45 +0000 (UTC) Received: (qmail 70413 invoked by uid 500); 2 Sep 2015 13:13:45 -0000 Delivered-To: apmail-flink-issues-archive@flink.apache.org Received: (qmail 70358 invoked by uid 500); 2 Sep 2015 13:13:45 -0000 Mailing-List: contact issues-help@flink.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@flink.apache.org Delivered-To: mailing list issues@flink.apache.org Received: (qmail 70348 invoked by uid 99); 2 Sep 2015 13:13:45 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 02 Sep 2015 13:13:45 +0000 Date: Wed, 2 Sep 2015 13:13:45 +0000 (UTC) From: "ASF GitHub Bot (JIRA)" To: issues@flink.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (FLINK-2410) PojoTypeInfo is not completely serializable MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/FLINK-2410?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14727311#comment-14727311 ] ASF GitHub Bot commented on FLINK-2410: --------------------------------------- Github user twalthr commented on a diff in the pull request: https://github.com/apache/flink/pull/943#discussion_r38529490 --- Diff: flink-staging/flink-table/src/test/java/org/apache/flink/api/java/table/test/PojoGroupingITCase.java --- @@ -0,0 +1,109 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.flink.api.java.table.test; + +import java.io.Serializable; +import org.apache.flink.api.common.operators.Order; +import org.apache.flink.api.java.DataSet; +import org.apache.flink.api.java.ExecutionEnvironment; +import org.apache.flink.api.java.table.TableEnvironment; +import org.apache.flink.api.java.tuple.Tuple3; +import org.apache.flink.api.table.Table; +import org.apache.flink.core.fs.FileSystem; +import org.apache.flink.test.util.MultipleProgramsTestBase; +import org.junit.After; +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.TemporaryFolder; +import org.junit.runner.RunWith; +import org.junit.runners.Parameterized; + +@RunWith(Parameterized.class) +public class PojoGroupingITCase extends MultipleProgramsTestBase { + + public PojoGroupingITCase(TestExecutionMode mode) { + super(mode); + } + + private String resultPath; + private String expected = ""; + + @Rule + public TemporaryFolder tempFolder = new TemporaryFolder(); + + @Before + public void before() throws Exception { + resultPath = tempFolder.newFile().toURI().toString(); + } + + @After + public void after() throws Exception { + compareResultsByLinesInMemory(expected, resultPath); + } + + @Test + public void testPojoGrouping() throws Exception { + ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment(); + + DataSet> data = env.fromElements( + new Tuple3("A", 23.0, "Z"), + new Tuple3("A", 24.0, "Y"), + new Tuple3("B", 1.0, "Z")); + + TableEnvironment tableEnv = new TableEnvironment(); + + Table table = tableEnv + .fromDataSet(data, "groupMe, value, name") + .select("groupMe, value, name") + .where("groupMe != 'B'"); + + DataSet myPojos = tableEnv.toDataSet(table, MyPojo.class); + + DataSet result = myPojos.groupBy("groupMe") + .sortGroup("value", Order.DESCENDING) + .first(1); + result.writeAsText(resultPath, FileSystem.WriteMode.OVERWRITE); --- End diff -- Thanks for the hint, I'm now using `collect`. > PojoTypeInfo is not completely serializable > ------------------------------------------- > > Key: FLINK-2410 > URL: https://issues.apache.org/jira/browse/FLINK-2410 > Project: Flink > Issue Type: Bug > Components: Java API > Reporter: Timo Walther > Assignee: Timo Walther > > Table API requires PojoTypeInfo to be serializable. The following code fails: > {code} > Table finishedEtlTable = maxMeasurements > .join(stationTable).where("s_station_id = m_station_id") > .select("year, month, day, value, country, name"); > DataSet maxTemp = tableEnv.toDataSet(finishedEtlTable, MaxTemperature.class); > maxTemp > .groupBy("year") > .sortGroup("value", Order.DESCENDING) > .first(1) > .print(); > {code} -- This message was sent by Atlassian JIRA (v6.3.4#6332)