Return-Path: X-Original-To: apmail-phoenix-dev-archive@minotaur.apache.org Delivered-To: apmail-phoenix-dev-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id A5B6817C78 for ; Tue, 14 Apr 2015 22:30:20 +0000 (UTC) Received: (qmail 96121 invoked by uid 500); 14 Apr 2015 22:30:20 -0000 Delivered-To: apmail-phoenix-dev-archive@phoenix.apache.org Received: (qmail 96068 invoked by uid 500); 14 Apr 2015 22:30:20 -0000 Mailing-List: contact dev-help@phoenix.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@phoenix.apache.org Delivered-To: mailing list dev@phoenix.apache.org Received: (qmail 96057 invoked by uid 99); 14 Apr 2015 22:30:20 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 14 Apr 2015 22:30:20 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED,T_RP_MATCHES_RCVD X-Spam-Check-By: apache.org Received: from [140.211.11.3] (HELO mail.apache.org) (140.211.11.3) by apache.org (qpsmtpd/0.29) with SMTP; Tue, 14 Apr 2015 22:30:18 +0000 Received: (qmail 95801 invoked by uid 99); 14 Apr 2015 22:29:58 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 14 Apr 2015 22:29:58 +0000 Date: Tue, 14 Apr 2015 22:29:58 +0000 (UTC) From: "ASF GitHub Bot (JIRA)" To: dev@phoenix.incubator.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (PHOENIX-1814) Handle e notation for defining float/double MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/PHOENIX-1814?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14495033#comment-14495033 ] ASF GitHub Bot commented on PHOENIX-1814: ----------------------------------------- Github user JamesRTaylor commented on a diff in the pull request: https://github.com/apache/phoenix/pull/67#discussion_r28377560 --- Diff: phoenix-core/src/it/java/org/apache/phoenix/end2end/ArithmeticQueryIT.java --- @@ -985,4 +985,50 @@ public void testFloatingPointMultiplicationUpsert() throws Exception { assertTrue(rs.next()); assertEquals(-1.0f, rs.getFloat(1), 0.001); } + + @Test + public void testFloatingPointWithExponentialNotation() throws Exception { + Float[] expected = {1.5E7f, 1.5E-7f, -1.5E-7f, 12E-5f, -.12E+34f}; + String[] values = {"1.5e7", "1.5e-7", "-1.5e-7", "12E-5", "-.12E+34"}; + ResultSet rs = createTableWithValues(values, "FLOAT"); + for (int i = 0; i < expected.length; i++) { + assertEquals(expected[i], rs.getFloat(i+1), 0.001); + } + } + + @Test + public void testDoubleWithExponentialNotation() throws Exception { + Double[] expected = {1.5E7d, 1.5E-7d, -1.5E-7d, 12E-5d, -.654E-321d, .1234E+56d}; + String[] values = {"1.5e7", "1.5e-7", "-1.5e-7", "12E-5", "-.654E-321", ".1234E+56"}; + ResultSet rs = createTableWithValues(values, "DOUBLE"); + for (int i = 0; i < expected.length; i++) { + assertEquals(expected[i], rs.getDouble(i+1), 0.001); + } + } + --- End diff -- What does the SQL statement look like that you're running? It's a bit hard to tell from the test itself. I'd stick to something simple like this: SELECT .1 e 100, .01 e + 100, 1. e -100, 1.23 e 200 FROM SYSTEM.CATALOG LIMIT 1; And then do the rs.getObject(1), rs.getObject(2), etc. > Handle e notation for defining float/double > ------------------------------------------- > > Key: PHOENIX-1814 > URL: https://issues.apache.org/jira/browse/PHOENIX-1814 > Project: Phoenix > Issue Type: Bug > Reporter: James Taylor > Assignee: Brian Esserlieu > Labels: Newbie > > We should allow a numeric literal to be defined with e notation for a float/double like this: > {code} > +1.5e-7 > 12E-5 > -.12345e+6789 > {code} -- This message was sent by Atlassian JIRA (v6.3.4#6332)