From issues-return-153051-archive-asf-public=cust-asf.ponee.io@flink.apache.org Thu Feb 15 13:10:10 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 3238818064A for ; Thu, 15 Feb 2018 13:10:10 +0100 (CET) Received: (qmail 98958 invoked by uid 500); 15 Feb 2018 12:10:09 -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 98948 invoked by uid 99); 15 Feb 2018 12:10:09 -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; Thu, 15 Feb 2018 12:10:09 +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 BEA61C2271 for ; Thu, 15 Feb 2018 12:10:08 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd1-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -110.311 X-Spam-Level: X-Spam-Status: No, score=-110.311 tagged_above=-999 required=6.31 tests=[ENV_AND_HDR_SPF_MATCH=-0.5, RCVD_IN_DNSWL_MED=-2.3, SPF_PASS=-0.001, T_RP_MATCHES_RCVD=-0.01, USER_IN_DEF_SPF_WL=-7.5, USER_IN_WHITELIST=-100] autolearn=disabled Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd1-us-west.apache.org [10.40.0.7]) (amavisd-new, port 10024) with ESMTP id 4LPYgTZe5rh5 for ; Thu, 15 Feb 2018 12:10:07 +0000 (UTC) Received: from mailrelay1-us-west.apache.org (mailrelay1-us-west.apache.org [209.188.14.139]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with ESMTP id 4AD835F36B for ; Thu, 15 Feb 2018 12:10:07 +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 2A9DEE0231 for ; Thu, 15 Feb 2018 12:10:06 +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 5262221E5C for ; Thu, 15 Feb 2018 12:10:03 +0000 (UTC) Date: Thu, 15 Feb 2018 12:10:03 +0000 (UTC) From: "ASF GitHub Bot (JIRA)" To: issues@flink.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (FLINK-8630) To support JSON schema to TypeInformation conversion 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-8630?page=3Dcom.atlassian= .jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=3D1636= 5445#comment-16365445 ]=20 ASF GitHub Bot commented on FLINK-8630: --------------------------------------- Github user xccui commented on a diff in the pull request: https://github.com/apache/flink/pull/5491#discussion_r168438157 =20 --- Diff: flink-formats/flink-json/src/main/java/org/apache/flink/forma= ts/json/JsonNodeDeserializationSchema.java --- @@ -0,0 +1,53 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed wi= th + * 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 wit= h + * 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 imp= lied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.flink.formats.json; + +import org.apache.flink.annotation.PublicEvolving; +import org.apache.flink.api.common.serialization.AbstractDeserializati= onSchema; + +import org.apache.flink.shaded.jackson2.com.fasterxml.jackson.databind= .ObjectMapper; +import org.apache.flink.shaded.jackson2.com.fasterxml.jackson.databind= .node.ObjectNode; + +import java.io.IOException; + +/** + * DeserializationSchema that deserializes a JSON String into an Objec= tNode. + * + *

Fields can be accessed by calling objectNode.get(<name>).as(&= lt;type>) + */ +@PublicEvolving +public class JsonNodeDeserializationSchema extends AbstractDeserializa= tionSchema { + +=09private static final long serialVersionUID =3D -1699854177598621044= L; + +=09private ObjectMapper mapper; + +=09@Override +=09public ObjectNode deserialize(byte[] message) throws IOException { --- End diff -- =20 IMO, this method should be thread-safe. > To support JSON schema to TypeInformation conversion=20 > ----------------------------------------------------- > > Key: FLINK-8630 > URL: https://issues.apache.org/jira/browse/FLINK-8630 > Project: Flink > Issue Type: Sub-task > Components: Streaming Connectors > Reporter: Xingcan Cui > Assignee: Timo Walther > Priority: Blocker > Fix For: 1.5.0 > > > To support (FLINK-8558), we need to=C2=A0generate a \{{TypeInformation}} = from a standard [JSON schema|http://json-schema.org/] (and maybe vice verse= ). There are some problems to be discussed, e.g., how to handle JSON {{Numb= er}} type. One option would be we always return a specific type, which can = be configured to be double or BigDecimal, for it. -- This message was sent by Atlassian JIRA (v7.6.3#76005)