From issues-return-170564-archive-asf-public=cust-asf.ponee.io@flink.apache.org Tue Jun 5 20:07:04 2018 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx-eu-01.ponee.io (Postfix) with SMTP id 7D1D7180625 for ; Tue, 5 Jun 2018 20:07:03 +0200 (CEST) Received: (qmail 23920 invoked by uid 500); 5 Jun 2018 18:07:02 -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 23904 invoked by uid 99); 5 Jun 2018 18:07:02 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd1-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 05 Jun 2018 18:07:02 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd1-us-west.apache.org (ASF Mail Server at spamd1-us-west.apache.org) with ESMTP id 10B0DC7A40 for ; Tue, 5 Jun 2018 18:07:02 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd1-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -109.501 X-Spam-Level: X-Spam-Status: No, score=-109.501 tagged_above=-999 required=6.31 tests=[ENV_AND_HDR_SPF_MATCH=-0.5, KAM_ASCII_DIVIDERS=0.8, RCVD_IN_DNSWL_MED=-2.3, SPF_PASS=-0.001, USER_IN_DEF_SPF_WL=-7.5, USER_IN_WHITELIST=-100] autolearn=disabled Received: from mx1-lw-us.apache.org ([10.40.0.8]) by localhost (spamd1-us-west.apache.org [10.40.0.7]) (amavisd-new, port 10024) with ESMTP id 2nrwFhrResZc for ; Tue, 5 Jun 2018 18:07:01 +0000 (UTC) Received: from mailrelay1-us-west.apache.org (mailrelay1-us-west.apache.org [209.188.14.139]) by mx1-lw-us.apache.org (ASF Mail Server at mx1-lw-us.apache.org) with ESMTP id ED4C65F41A for ; Tue, 5 Jun 2018 18:07:00 +0000 (UTC) Received: from jira-lw-us.apache.org (unknown [207.244.88.139]) by mailrelay1-us-west.apache.org (ASF Mail Server at mailrelay1-us-west.apache.org) with ESMTP id 7A899E0354 for ; Tue, 5 Jun 2018 18:07:00 +0000 (UTC) Received: from jira-lw-us.apache.org (localhost [127.0.0.1]) by jira-lw-us.apache.org (ASF Mail Server at jira-lw-us.apache.org) with ESMTP id 3241F21098 for ; Tue, 5 Jun 2018 18:07:00 +0000 (UTC) Date: Tue, 5 Jun 2018 18:07:00 +0000 (UTC) From: "ASF GitHub Bot (JIRA)" To: issues@flink.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (FLINK-9444) KafkaAvroTableSource failed to work for map and array fields MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/FLINK-9444?page=3Dcom.atlassian= .jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=3D1650= 2220#comment-16502220 ]=20 ASF GitHub Bot commented on FLINK-9444: --------------------------------------- Github user tragicjun commented on a diff in the pull request: https://github.com/apache/flink/pull/6082#discussion_r193168591 =20 --- Diff: flink-formats/flink-avro/src/main/java/org/apache/flink/forma= ts/avro/typeutils/AvroRecordClassConverter.java --- @@ -73,9 +75,37 @@ private AvroRecordClassConverter() { =09=09=09final GenericTypeInfo genericTypeInfo =3D (GenericTypeInfo= ) extracted; =09=09=09if (genericTypeInfo.getTypeClass() =3D=3D Utf8.class) { =09=09=09=09return BasicTypeInfo.STRING_TYPE_INFO; +=09=09=09} else if (genericTypeInfo.getTypeClass() =3D=3D Map.class) { +=09=09=09=09// avro map key is always string +=09=09=09=09return Types.MAP(Types.STRING, +=09=09=09=09=09convertPrimitiveType(schema.getValueType().getType())); --- End diff -- =20 I've implemented a reflection version, which now supports record type w= ithin map/array. > KafkaAvroTableSource failed to work for map and array fields > ------------------------------------------------------------ > > Key: FLINK-9444 > URL: https://issues.apache.org/jira/browse/FLINK-9444 > Project: Flink > Issue Type: Bug > Components: Kafka Connector, Table API & SQL > Affects Versions: 1.6.0 > Reporter: Jun Zhang > Priority: Blocker > Labels: patch > Fix For: 1.6.0 > > Attachments: flink-9444.patch > > > When some Avro schema has map/array fields and the corresponding TableSch= ema declares=C2=A0*MapTypeInfo/ListTypeInfo*=C2=A0for these fields, an exce= ption will be thrown when registering the=C2=A0*KafkaAvroTableSource*, comp= laining like: > Exception in thread "main" org.apache.flink.table.api.ValidationException= : Type Map of table field 'event' does not match with type= GenericType of the field 'event' of the TableSource return = type. > at org.apache.flink.table.api.ValidationException$.apply(exceptions.scal= a:74) > at org.apache.flink.table.sources.TableSourceUtil$$anonfun$validateTable= Source$1.apply(TableSourceUtil.scala:92) > at org.apache.flink.table.sources.TableSourceUtil$$anonfun$validateTable= Source$1.apply(TableSourceUtil.scala:71) > at scala.collection.IndexedSeqOptimized$class.foreach(IndexedSeqOptimize= d.scala:33) > at scala.collection.mutable.ArrayOps$ofRef.foreach(ArrayOps.scala:186) > at org.apache.flink.table.sources.TableSourceUtil$.validateTableSource(T= ableSourceUtil.scala:71) > at org.apache.flink.table.plan.schema.StreamTableSourceTable.(Stre= amTableSourceTable.scala:33) > at org.apache.flink.table.api.StreamTableEnvironment.registerTableSource= Internal(StreamTableEnvironment.scala:124) > at org.apache.flink.table.api.TableEnvironment.registerTableSource(Table= Environment.scala:438) -- This message was sent by Atlassian JIRA (v7.6.3#76005)