From issues-return-5064-archive-asf-public=cust-asf.ponee.io@phoenix.apache.org Wed Mar 13 00:38:54 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 71B4F180600 for ; Wed, 13 Mar 2019 01:38:53 +0100 (CET) Received: (qmail 69731 invoked by uid 500); 13 Mar 2019 00:38:52 -0000 Mailing-List: contact issues-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 issues@phoenix.apache.org Received: (qmail 69713 invoked by uid 99); 13 Mar 2019 00:38:52 -0000 Received: from ec2-52-202-80-70.compute-1.amazonaws.com (HELO gitbox.apache.org) (52.202.80.70) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 13 Mar 2019 00:38:52 +0000 From: GitBox To: issues@phoenix.apache.org Subject: [GitHub] [phoenix] karanmehta93 commented on a change in pull request #461: PHOENIX-5185 support Math PI function Message-ID: <155243753203.20365.18365867199815631737.gitbox@gitbox.apache.org> Date: Wed, 13 Mar 2019 00:38:52 -0000 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit karanmehta93 commented on a change in pull request #461: PHOENIX-5185 support Math PI function URL: https://github.com/apache/phoenix/pull/461#discussion_r264937805 ########## File path: phoenix-core/src/it/java/org/apache/phoenix/end2end/MathPIFunctionEnd2EndIT.java ########## @@ -0,0 +1,70 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with 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 + * with 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 implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.phoenix.end2end; + +import static org.junit.Assert.*; + +import java.sql.*; + +import org.apache.phoenix.exception.SQLExceptionCode; +import org.apache.phoenix.expression.function.MathPIFunction; +import org.junit.Test; + +/** + * End to end tests for {@link MathPIFunction} + */ +public class MathPIFunctionEnd2EndIT extends ParallelStatsDisabledIT { + private static final double ZERO = 1e-9; + + private static boolean twoDoubleEquals(double a, double b) { + if (Double.isNaN(a) ^ Double.isNaN(b)) return false; + if (Double.isNaN(a)) return true; + if (Double.isInfinite(a) ^ Double.isInfinite(b)) return false; + if (Double.isInfinite(a)) { + if ((a > 0) ^ (b > 0)) return false; + else return true; + } + if (Math.abs(a - b) <= ZERO) { + return true; + } else { + return false; + } + } + + @Test + public void testMathPIFunction() throws Exception { Review comment: nit: please break this up in 3 tests ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: users@infra.apache.org With regards, Apache Git Services