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 2E85F200BAE for ; Fri, 28 Oct 2016 17:17:13 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 2D1AA160AE3; Fri, 28 Oct 2016 15:17:13 +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 732A2160ADD for ; Fri, 28 Oct 2016 17:17:12 +0200 (CEST) Received: (qmail 34225 invoked by uid 500); 28 Oct 2016 15:17:11 -0000 Mailing-List: contact dev-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 dev@flink.apache.org Received: (qmail 34213 invoked by uid 99); 28 Oct 2016 15:17:11 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd4-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 28 Oct 2016 15:17:11 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd4-us-west.apache.org (ASF Mail Server at spamd4-us-west.apache.org) with ESMTP id AD85DC13A4 for ; Fri, 28 Oct 2016 15:17:10 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd4-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 1.679 X-Spam-Level: * X-Spam-Status: No, score=1.679 tagged_above=-999 required=6.31 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HTML_MESSAGE=2, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, RCVD_IN_SORBS_SPAM=0.5, SPF_PASS=-0.001] autolearn=disabled Authentication-Results: spamd4-us-west.apache.org (amavisd-new); dkim=pass (2048-bit key) header.d=gmail.com Received: from mx1-lw-us.apache.org ([10.40.0.8]) by localhost (spamd4-us-west.apache.org [10.40.0.11]) (amavisd-new, port 10024) with ESMTP id PhzhAjBvOcha for ; Fri, 28 Oct 2016 15:17:08 +0000 (UTC) Received: from mail-lf0-f48.google.com (mail-lf0-f48.google.com [209.85.215.48]) by mx1-lw-us.apache.org (ASF Mail Server at mx1-lw-us.apache.org) with ESMTPS id 557315F4EB for ; Fri, 28 Oct 2016 15:17:03 +0000 (UTC) Received: by mail-lf0-f48.google.com with SMTP id x79so59376361lff.0 for ; Fri, 28 Oct 2016 08:17:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to; bh=O9+XyilfBr5kBNaRV2fvt9yLzAYcjY/gTZ5U96GEcDQ=; b=C25HL14+QUlpXqp689ZlefFUkbsUkJ/QRl/EwKHREDYxm1sn66kizxbCIe6/wY3fwj up/9+NKUkeQZMTltXxgg6tvJstt4fqdMXdlnrL9LHttIJhIZXc9JA8sVvFr4HDH1RMVT L5gMkJ1x196dcnNUyaQOsEZ2aK+mF/LWl6DzfD/zBro+I/ysYdurCNK6mcnLhBfVCaUE MU2ayo60TN3Sd2DMnPdcKPeJ7SG/rHSa2QPwPa73Xib/ZNyWOjB7d+mxGLExGAGuBdr0 XhzaJOFDnXmAmAYHdPJFoPvoHE3jMpHyVpjMfvDrDk94x0qrSpl7Q+7CeC3EH8WLewas P3rg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to; bh=O9+XyilfBr5kBNaRV2fvt9yLzAYcjY/gTZ5U96GEcDQ=; b=Uz+Ap0QUqYoA2ouiV7grXuyczIGdD3GNMXxy/hkFtn/Jf9d7UWlozWLvJfK/UWwNRc Sb5EB0ntvbTzR6DIQ92jLQzeuevhyvtc85gtSAG3EmjJ38oRs5n9lPX74FSIK2uBXFpc A7tn7/XEf8w1V24iLpiO7HuG5paA5YNqoU9TAStOGK7D5AEFSqxCnZMu50unKvsaDds4 a5z/eHsimMWBgzUfHFoBD06JMCsiFfW5f26A1OLUGHyd79OAMa5t8ywbXvUJ9gkTVPxY eRCJmh8qACUPjJpnxVCNB2E3yz/8vSGXnd65t6rAIA/83WmJPPsYiUbcOUMrn2pY7iYf ilsw== X-Gm-Message-State: ABUngve5k3OPDPKmU5veZG/nERbwaAkBUrj2YKl5mzeilIdBjlrXIr5rXeObBjh6r6M+UK08li+yhf7OAcY2+w== X-Received: by 10.25.127.216 with SMTP id a207mr10081864lfd.62.1477667821841; Fri, 28 Oct 2016 08:17:01 -0700 (PDT) MIME-Version: 1.0 Received: by 10.25.133.7 with HTTP; Fri, 28 Oct 2016 08:16:31 -0700 (PDT) In-Reply-To: References: From: Fabian Hueske Date: Fri, 28 Oct 2016 17:16:31 +0200 Message-ID: Subject: Re: trouble with type casting To: "dev@flink.apache.org" Content-Type: multipart/alternative; boundary=001a113ec4da9dfe11053fee59c6 archived-at: Fri, 28 Oct 2016 15:17:13 -0000 --001a113ec4da9dfe11053fee59c6 Content-Type: text/plain; charset=UTF-8 Hi Anton, it seems that the Table API validation is more strict than Calcite's SQL validator (maybe because it is not aware of the actual implementation). In principle, it is correct to prevent the auto-casting from BigDecimal to double. I think it is fine to request an explicit cast from users (and also add this cast in the test). In addition we should make sure that the error message helps the user to add the necessary cast. What do you think? Best, Fabian 2016-10-28 11:42 GMT+02:00 Anton Solovev : > > I'm working on flink-4743 issue > I tried write tests as Fabian suggested me https://github.com/apache/ > flink/pull/2686#discussion_r85218584 > and figure out that there is no implicit conversion of bigDecimal to > double in table api. > "power" function accept only double as operands. > > all is okay when run the function with sql api - "power(bigDecimal, > double)" - a CallGenerator creates casting to double > when running the function with table api - 'bigDecimal.power('double) > it throws ValidationException (fails on input type checking), because of > TypeCoercion#canSafelyCast() cannot allow to cast bigDecimal to double > > what options I have? > 1) let it cast with lose of information > 2) don't use bigDecimal in functions, or cast it manually > 3) create somewhere a new functions that accept bigDecimal as operand > 4) any ideas? > > Best, > Anton > > > --001a113ec4da9dfe11053fee59c6--