Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 417BC200B17 for ; Tue, 21 Jun 2016 17:12:01 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 4038F160A60; Tue, 21 Jun 2016 15:12:01 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 6A466160A07 for ; Tue, 21 Jun 2016 17:12:00 +0200 (CEST) Received: (qmail 51764 invoked by uid 500); 21 Jun 2016 15:11:58 -0000 Mailing-List: contact user-help@flink.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@flink.apache.org Delivered-To: mailing list user@flink.apache.org Received: (qmail 51677 invoked by uid 99); 21 Jun 2016 15:11:58 -0000 Received: from mail-relay.apache.org (HELO mail-relay.apache.org) (140.211.11.15) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 21 Jun 2016 15:11:58 +0000 Received: from mail-lf0-f41.google.com (mail-lf0-f41.google.com [209.85.215.41]) by mail-relay.apache.org (ASF Mail Server at mail-relay.apache.org) with ESMTPSA id 0E9F41A0250 for ; Tue, 21 Jun 2016 15:11:57 +0000 (UTC) Received: by mail-lf0-f41.google.com with SMTP id f6so28219284lfg.0 for ; Tue, 21 Jun 2016 08:11:57 -0700 (PDT) X-Gm-Message-State: ALyK8tJr2eKjW1Ai4hQ3Of67cb9hQwKUz8OGsn6O09/u7hkvdOxrHJEnXJzz2Ait6hLfgOc7wrrVBj56yTCJWA== X-Received: by 10.28.197.140 with SMTP id v134mr3770882wmf.2.1466521916052; Tue, 21 Jun 2016 08:11:56 -0700 (PDT) MIME-Version: 1.0 Received: by 10.194.94.35 with HTTP; Tue, 21 Jun 2016 08:11:36 -0700 (PDT) In-Reply-To: References: From: Robert Metzger Date: Tue, 21 Jun 2016 17:11:36 +0200 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: NPE in JDBCInputFormat To: "user@flink.apache.org" Content-Type: multipart/alternative; boundary=94eb2c0d438edcc0900535cb3d02 archived-at: Tue, 21 Jun 2016 15:12:01 -0000 --94eb2c0d438edcc0900535cb3d02 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Hi, I also think this is a bug. Can you file a JIRA issue for it? Regards, Robert On Tue, Jun 21, 2016 at 12:15 PM, Flavio Pompermaier wrote: > I think the problem is somehow related to > val DB_ROWTYPE =3D new RowTypeInfo( > Seq(BasicTypeInfo.INT_TYPE_INFO), > Seq("id")) > > You have only one filed, I think Seq("id") should be removed. > > However this is a bug IMHO, this kind of error should be checked with and > handler with a proper error. > > On Tue, Jun 21, 2016 at 11:49 AM, Martin Scholl wrote: > >> Hello everyone, >> >> >> JDBCInputFormat of flink 1.1-SNAPSHOT fails with an NPE in >> Row.productArity: >> >> %% snip %% >> java.io.IOException: Couldn't access resultSet >> at >> org.apache.flink.api.java.io.jdbc.JDBCInputFormat.nextRecord(JDBCInputFo= rmat.java:288) >> at >> org.apache.flink.api.java.io.jdbc.JDBCInputFormat.nextRecord(JDBCInputFo= rmat.java:98) >> at >> org.apache.flink.runtime.operators.DataSourceTask.invoke(DataSourceTask.= java:162) >> at org.apache.flink.runtime.taskmanager.Task.run(Task.java:588) >> at java.lang.Thread.run(Thread.java:745) >> Caused by: java.lang.NullPointerException >> at org.apache.flink.api.table.Row.productArity(Row.scala:28) >> at >> org.apache.flink.api.java.io.jdbc.JDBCInputFormat.nextRecord(JDBCInputFo= rmat.java:279) >> ... 4 more >> %% snip %% >> >> Find the example code triggering this attached to this email. >> >> The reason, I believe, is the way through which Flink creates Row >> instances through Kryo. As Row expects the number of fields to allocate = as >> a parameter, which Kryo does not provide, the =E2=80=98fields=E2=80=99 m= ember of Row ends >> up being null. As I=E2=80=99m not a reflection, etc. expert, I rather le= ave a true >> analysis to more knowledgable programmers. >> >> Part of the attached example is a not very elegant workaround though a >> custom type and a cast (see jdbcNoIssue). >> >> Am I doing something wrong as to the example code, or shall I open a JIR= A >> ticket? >> >> >> Thank you in advance, >> Martin >> >> >> >> >> > > > --94eb2c0d438edcc0900535cb3d02 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
Hi,

I also think this is a bug. Can you= file a JIRA issue for it?

Regards,
Robe= rt


On Tue, Jun 21, 2016 at 12:15 PM, Flavio Pompermaier <pomp= ermaier@okkam.it> wrote:
I think the problem is somehow related to=C2=A0
=C2= =A0 val DB_ROWTYPE =3D new RowTypeInfo(
=C2=A0 =C2=A0 Seq(BasicTy= peInfo.INT_TYPE_INFO),
=C2=A0 =C2=A0 Seq("id"))

You have only one filed, I think Seq("id"= ) should be removed.

However this is a bug IMHO, t= his kind of error should be checked with and handler with a proper error.

On Tue, Jun 21, 2016 at 11:49 AM, Martin Scholl <ms@funkpopes.org= > wrote:
Hello everyone,

JDBCInputFormat of flink 1.1-SNAPSHOT fails with an NPE in Row.productArity= :

%% snip %%
java.io.IOException: Couldn't access resultSet
=C2=A0 =C2=A0 =C2=A0 =C2=A0 at org.apache.flink.api.java.io.jdbc.JDBCInputF= ormat.nextRecord(JDBCInputFormat.java:288)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 at org.apache.flink.api.java.io.jdbc.JDBCInputF= ormat.nextRecord(JDBCInputFormat.java:98)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 at org.apache.flink.runtime.operators.DataSourc= eTask.invoke(DataSourceTask.java:162)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 at org.apache.flink.runtime.taskmanager.Task.ru= n(Task.java:588)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.NullPointerException
=C2=A0 =C2=A0 =C2=A0 =C2=A0 at org.apache.flink.api.table.Row.productArity(= Row.scala:28)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 at org.apache.flink.api.java.io.jdbc.JDBCInputF= ormat.nextRecord(JDBCInputFormat.java:279)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 ... 4 more
%% snip %%

Find the example code triggering this attached to this email.

The reason, I believe, is the way through which Flink creates Row instances= through Kryo. As Row expects the number of fields to allocate as a paramet= er, which Kryo does not provide, the =E2=80=98fields=E2=80=99 member of Row= ends up being null. As I=E2=80=99m not a reflection, etc. expert, I rather= leave a true analysis to more knowledgable programmers.

Part of the attached example is a not very elegant workaround though a cust= om type and a cast (see jdbcNoIssue).

Am I doing something wrong as to the example code, or shall I open a JIRA t= icket?


Thank you in advance,
Martin








--94eb2c0d438edcc0900535cb3d02--