[ 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)