From dev-return-30350-archive-asf-public=cust-asf.ponee.io@avro.apache.org Thu Mar 11 10:16:04 2021 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mxout1-he-de.apache.org (mxout1-he-de.apache.org [95.216.194.37]) by mx-eu-01.ponee.io (Postfix) with ESMTPS id 5D7C118062C for ; Thu, 11 Mar 2021 11:16:04 +0100 (CET) Received: from mail.apache.org (mailroute1-lw-us.apache.org [207.244.88.153]) by mxout1-he-de.apache.org (ASF Mail Server at mxout1-he-de.apache.org) with SMTP id 7A43A647E7 for ; Thu, 11 Mar 2021 10:16:02 +0000 (UTC) Received: (qmail 8299 invoked by uid 500); 11 Mar 2021 10:16:01 -0000 Mailing-List: contact dev-help@avro.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@avro.apache.org Delivered-To: mailing list dev@avro.apache.org Received: (qmail 8265 invoked by uid 99); 11 Mar 2021 10:16:00 -0000 Received: from mailrelay1-he-de.apache.org (HELO mailrelay1-he-de.apache.org) (116.203.21.61) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 11 Mar 2021 10:16:00 +0000 Received: from jira2-he-de.apache.org (unknown [IPv6:2a01:4f8:242:1f49::2]) by mailrelay1-he-de.apache.org (ASF Mail Server at mailrelay1-he-de.apache.org) with ESMTPS id 318983E8B3 for ; Thu, 11 Mar 2021 10:16:00 +0000 (UTC) Received: from jira2-he-de.apache.org (localhost.localdomain [127.0.0.1]) by jira2-he-de.apache.org (ASF Mail Server at jira2-he-de.apache.org) with ESMTP id 159E5C80346 for ; Thu, 11 Mar 2021 10:16:00 +0000 (UTC) Date: Thu, 11 Mar 2021 10:16:00 +0000 (UTC) From: "Emilio Jose Mena Cebrian (Jira)" To: dev@avro.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Created] (AVRO-3077) Ability of select string deserializing by configuration MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 Emilio Jose Mena Cebrian created AVRO-3077: ---------------------------------------------- Summary: Ability of select string deserializing by configurati= on Key: AVRO-3077 URL: https://issues.apache.org/jira/browse/AVRO-3077 Project: Apache Avro Issue Type: Improvement Components: java Affects Versions: 1.10.1 Reporter: Emilio Jose Mena Cebrian Current Java generator modifies the source schema to add a property to desc= ribe the way a reader decodes a string. (see AVRO-2918) I think this is a design problem. The way a reader deserializes a string sh= ouldn't modify the schema (the schema describes the structure of avro messa= ge, not the way a reader converts to a usable form). On the other hand, a reader might require the strings as a CharSequence bec= ause it knows how to handle them and other as a String. The only way to do this now is modifying the schema itself in each reader. = If you use Avro with other technologies like Kafka (or confluent) It migth = be non-viable. =C2=A0 I think that the way a reader decodes messages should be specified by the r= eader and It'll be desirable to specify this using a configuration. =C2=A0 Maybe if a System property (like useCustomCoders feature) or something simi= lar could be added to modify the default value for String decoding. Form GenericDatumReader =C2=A0 {code:java} protected Class findStringClass(Schema schema) { String name =3D schema.getProp(GenericData.STRING_PROP); if (name =3D=3D null) return CharSequence.class; switch (GenericData.StringType.valueOf(name)) { case String: return String.class; default: return CharSequence.class; } } {code} Maybe adding a "forced" configuration may help: if reader configures string= representation, use it, if not do it the current way. =C2=A0 And do something similar in SpecificDatumReader =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 -- This message was sent by Atlassian Jira (v8.3.4#803005)