From issues-return-88939-archive-asf-public=cust-asf.ponee.io@ignite.apache.org Wed Jan 23 15:29:05 2019 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 91242180771 for ; Wed, 23 Jan 2019 15:29:04 +0100 (CET) Received: (qmail 51899 invoked by uid 500); 23 Jan 2019 14:29:03 -0000 Mailing-List: contact issues-help@ignite.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@ignite.apache.org Delivered-To: mailing list issues@ignite.apache.org Received: (qmail 51888 invoked by uid 99); 23 Jan 2019 14:29:03 -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; Wed, 23 Jan 2019 14:29:03 +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 4E6FDC1173 for ; Wed, 23 Jan 2019 14:29:03 +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 70qYfVEB03H1 for ; Wed, 23 Jan 2019 14:29: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 81DEA5F2AD for ; Wed, 23 Jan 2019 14:29:01 +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 04804E26A5 for ; Wed, 23 Jan 2019 14:29:01 +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 41E5F242A0 for ; Wed, 23 Jan 2019 14:29:00 +0000 (UTC) Date: Wed, 23 Jan 2019 14:29:00 +0000 (UTC) From: "Pavel Kuznetsov (JIRA)" To: issues@ignite.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Comment Edited] (IGNITE-10874) JDBC thin driver metadata misses caches with queryEntities and names containing underscores 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/IGNITE-10874?page=3Dcom.atlassi= an.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=3D16= 750046#comment-16750046 ]=20 Pavel Kuznetsov edited comment on IGNITE-10874 at 1/23/19 2:28 PM: ------------------------------------------------------------------- I've splitted [~isapego] preprocessing logic which currently based on regex= . Another approach is to add manual escaping:=20 {code:java} public static String fromSqlToJavaPattern(String sqlPtrn) { StringBuilder buff =3D new StringBuilder(); boolean escape =3D false; for (int i =3D 0; i < sqlPtrn.length(); i++) { char ch =3D sqlPtrn.charAt(i); if (escape) { buff.append(ch); escape =3D false; } else { switch (ch) { case '\\': escape =3D true; break; case '_': buff.append('.'); break; case '%': buff.append(".*"); break; default: buff.append(ch); } } } return buff.toString(); } {code} [~vozerov] was (Author: pkouznet): I've splitted [~isapego] preprocessing logic which currently based on regex= . Another approach is to add manual escaping:=20 ``` public static String fromSqlToJavaPattern(String sqlPtrn) { StringBuilder buff =3D new StringBuilder(); boolean escape =3D false; for (int i =3D 0; i < sqlPtrn.length(); i++) { char ch =3D sqlPtrn.charAt(i); if (escape) { buff.append(ch); escape =3D false; } else { switch (ch) { case '\\': escape =3D true; break; case '_': buff.append('.'); break; case '%': buff.append(".*"); break; default: buff.append(ch); } } } return buff.toString(); }``` [~vozerov] > JDBC thin driver metadata misses caches with queryEntities and names cont= aining underscores > -------------------------------------------------------------------------= ------------------ > > Key: IGNITE-10874 > URL: https://issues.apache.org/jira/browse/IGNITE-10874 > Project: Ignite > Issue Type: Improvement > Components: jdbc > Affects Versions: 2.7 > Reporter: Alexey Kukushkin > Assignee: Pavel Kuznetsov > Priority: Major > > +*Steps to reproduce*+ > 1) Build and run this app:=C2=A0 > {code:java} > public class App { > public static void main(String[] ags) { > try (Ignite ignite =3D Ignition.start( > new IgniteConfiguration() > .setDiscoverySpi( > new TcpDiscoverySpi() > .setIpFinder( > new TcpDiscoveryVmIpFinder().setAddresses(Col= lections.singleton("127.0.0.1:47500")) > ) > ) > )) { > final String NAME =3D "V_MODELS_SHORT"; > ignite.getOrCreateCache( > new CacheConfiguration<>() > .setName(NAME) > .setCacheMode(CacheMode.PARTITIONED) > .setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL) > .setQueryEntities(Collections.singleton( > new QueryEntity() > .setKeyType(Integer.class.getTypeName()) > .setValueType(NAME) > .setKeyFieldName("VMS_ID") > .setFields( > Stream.of( > new AbstractMap.SimpleEntry<>("VMS_ID= ", Integer.class.getTypeName()), > new AbstractMap.SimpleEntry<>("VMS_HA= SVERSION", Boolean.class.getTypeName()) > ).collect(Collectors.toMap( > AbstractMap.SimpleEntry::getKey, > AbstractMap.SimpleEntry::getValue, > (u, v) -> { > throw new IllegalStateException(S= tring.format("Duplicate key %s", u)); > }, > LinkedHashMap::new > )) > ) > )) > ); > System.in.read(); > } > } > } > {code} > 2) While the app is running use a JDBC database management tool like DBea= ver to open a JDBC thin driver connection to Ignite. > 3) Check table "V_MODELS_SHORT" under schema "V_MODELS_SHORT" > +*Expected*+ > 3) Table "V_MODELS_SHORT" is visible under=C2=A0=C2=A0schema "V_MODELS_SH= ORT" > +*Actual*+ > =C2=A03) There is no table "V_MODELS_SHORT" under=C2=A0=C2=A0schema "V_MO= DELS_SHORT" > +*Notes*+ > You still can run queries=C2=A0on table=C2=A0V_MODELS_SHORT in DBeaver. F= or example, these queries work fine: > {code:java} > INSERT INTO=C2=A0V_MODELS_SHORT.V_MODELS_SHORT VALUES (1, 'false'); > SELECT=C2=A0* FROM V_MODELS_SHORT.V_MODELS_SHORT; > {code} > =C2=A0 -- This message was sent by Atlassian JIRA (v7.6.3#76005)