flink-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tonycox <...@git.apache.org>
Subject [GitHub] flink pull request #2686: [FLINK-4743] The sqrt/power function not accept th...
Date Fri, 28 Oct 2016 11:36:50 GMT
Github user tonycox commented on a diff in the pull request:

    https://github.com/apache/flink/pull/2686#discussion_r85514611
  
    --- Diff: flink-libraries/flink-table/src/test/scala/org/apache/flink/api/table/expressions/PowerExpressionTest.scala
---
    @@ -0,0 +1,149 @@
    +/*
    + * 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.flink.api.table.expressions
    +
    +import java.lang.{Double => JDouble, Float => JFloat, Long => JLong, Integer
=> JInteger}
    +import java.math.{BigDecimal => JBigDecimal}
    +
    +import org.apache.flink.api.common.typeinfo.TypeInformation
    +import org.apache.flink.api.table.expressions.utils.ExpressionTestBase
    +import org.apache.flink.api.table.typeutils.RowTypeInfo
    +import org.apache.flink.api.table.{Row, Types}
    +import org.junit.Test
    +
    +class PowerExpressionTest extends ExpressionTestBase {
    +
    +  override def testData = {
    +    val testData = new Row(5)
    +    testData.setField(0, 100.0f: JFloat)
    +    testData.setField(1, 100.0: JDouble)
    +    testData.setField(2, 100L: JLong)
    +    testData.setField(3, 100: JInteger)
    +    testData.setField(4, new JBigDecimal(100): JBigDecimal)
    +    testData
    +  }
    +
    +  override def typeInfo = {
    +    new RowTypeInfo(Seq(
    +      Types.FLOAT,
    +      Types.DOUBLE,
    +      Types.LONG,
    +      Types.INT,
    +      Types.DECIMAL)
    +    ).asInstanceOf[TypeInformation[Any]]
    +  }
    +
    +  @Test
    +  def testSqrtFloat(): Unit = {
    +    testSqlApi(
    +      "SQRT(f0)",
    +      "10.0")
    +  }
    +
    +  @Test
    +  def testSqrtDouble(): Unit = {
    +    testSqlApi(
    --- End diff --
    
    Yes, but i found out another bug. with this api 'f1.sqrt() and f1 is bigDecimal so test
throws ValidationException. I wrote about it in dev mailing


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message