[GitHub] flink pull request #4152: [FLINK-6960][table] Add E supported in SQL.

2017-06-25 Thread asfgit
Github user asfgit closed the pull request at:

https://github.com/apache/flink/pull/4152


---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] flink pull request #4152: [FLINK-6960][table] Add E supported in SQL.

2017-06-21 Thread fhueske
Github user fhueske commented on a diff in the pull request:

https://github.com/apache/flink/pull/4152#discussion_r12335
  
--- Diff: 
flink-libraries/flink-table/src/main/scala/org/apache/flink/table/functions/scalarSqlFunctions/MathSqlFunctions.scala
 ---
@@ -0,0 +1,35 @@
+/*
+ * 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.table.functions.scalarSqlFunctions
+
+import org.apache.calcite.sql.{SqlFunction, SqlFunctionCategory, SqlKind}
+import org.apache.calcite.sql.`type`._
+
+class MathSqlFunctions {
--- End diff --

I think you can also have a stand-alone singleton object in Scala. No need 
to define a class if it is not used.


---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] flink pull request #4152: [FLINK-6960][table] Add E supported in SQL.

2017-06-21 Thread sunjincheng121
Github user sunjincheng121 commented on a diff in the pull request:

https://github.com/apache/flink/pull/4152#discussion_r123261877
  
--- Diff: 
flink-libraries/flink-table/src/main/scala/org/apache/flink/table/functions/scalarSqlFunctions/MathSqlFunctions.scala
 ---
@@ -0,0 +1,35 @@
+/*
+ * 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.table.functions.scalarSqlFunctions
+
+import org.apache.calcite.sql.{SqlFunction, SqlFunctionCategory, SqlKind}
+import org.apache.calcite.sql.`type`._
+
+class MathSqlFunctions {
+
+}
+
+object MathSqlFunctions {
+  val E = new SqlFunction(
--- End diff --

I notice this class, I have not using this because:
1. The constructor of `SqlBaseContextVariable` is protected.
2. I think called the scalar function with "()" is make sense. 

About the folder, at the point of my view,  Build-in scalar function in 
flink will need two part:
1. `SqlFuncitons` which are define the interface of scalar function for 
`FunctionGenerator` and `FunctionCatalog`.
2. `Runtime implementation` which are the real logic of scalar function. 
using in `BuiltInMethods`.

So, I want create two packages: 
`org.apache.flink.table.functions.scalarSqlFunctions` and 
`org.apache.flink.table.runtime.scalarfunctions`(in this PR not need the 
runtime package). 
Please let me know What do you think?


---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] flink pull request #4152: [FLINK-6960][table] Add E supported in SQL.

2017-06-21 Thread sunjincheng121
Github user sunjincheng121 commented on a diff in the pull request:

https://github.com/apache/flink/pull/4152#discussion_r123258425
  
--- Diff: 
flink-libraries/flink-table/src/test/scala/org/apache/flink/table/expressions/ScalarFunctionsTest.scala
 ---
@@ -1116,6 +1116,13 @@ class ScalarFunctionsTest extends ExpressionTestBase 
{
   math.Pi.toString)
   }
 
+  @Test
+  def testE(): Unit = {
+testSqlApi(
+  "E()",
--- End diff --

Yes, It's works well.


---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] flink pull request #4152: [FLINK-6960][table] Add E supported in SQL.

2017-06-21 Thread wuchong
Github user wuchong commented on a diff in the pull request:

https://github.com/apache/flink/pull/4152#discussion_r123188958
  
--- Diff: 
flink-libraries/flink-table/src/main/scala/org/apache/flink/table/functions/scalarSqlFunctions/MathSqlFunctions.scala
 ---
@@ -0,0 +1,35 @@
+/*
+ * 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.table.functions.scalarSqlFunctions
+
+import org.apache.calcite.sql.{SqlFunction, SqlFunctionCategory, SqlKind}
+import org.apache.calcite.sql.`type`._
+
+class MathSqlFunctions {
+
+}
+
+object MathSqlFunctions {
+  val E = new SqlFunction(
--- End diff --

I would like this:

```scala
new SqlBaseContextVariable("E", ReturnTypes.DOUBLE,
SqlFunctionCategory.NUMERIC);
```

In addition, what do you think to move this file to 
`org/apache/flink/table/functions/utils` ?


---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] flink pull request #4152: [FLINK-6960][table] Add E supported in SQL.

2017-06-21 Thread wuchong
Github user wuchong commented on a diff in the pull request:

https://github.com/apache/flink/pull/4152#discussion_r123189112
  
--- Diff: 
flink-libraries/flink-table/src/test/scala/org/apache/flink/table/expressions/ScalarFunctionsTest.scala
 ---
@@ -1116,6 +1116,13 @@ class ScalarFunctionsTest extends ExpressionTestBase 
{
   math.Pi.toString)
   }
 
+  @Test
+  def testE(): Unit = {
+testSqlApi(
+  "E()",
--- End diff --

Does "e()" also work? 


---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] flink pull request #4152: [FLINK-6960][table] Add E supported in SQL.

2017-06-21 Thread sunjincheng121
GitHub user sunjincheng121 opened a pull request:

https://github.com/apache/flink/pull/4152

[FLINK-6960][table] Add E supported in SQL.

In this PR. I have add Math.E supported in SQL.

- [x] General
  - The pull request references the related JIRA issue 
("[FLINK-6960][table] Add E supported in SQL.")
  - The pull request addresses only one issue
  - Each commit in the PR has a meaningful commit message (including the 
JIRA id)

- [ ] Documentation
  - Documentation has been added for new functionality
  - Old documentation affected by the pull request has been updated
  - JavaDoc for public methods has been added

- [x] Tests & Build
  - Functionality added by the pull request is covered by tests
  - `mvn clean verify` has been executed successfully locally or a Travis 
build has passed


You can merge this pull request into a Git repository by running:

$ git pull https://github.com/sunjincheng121/flink FLINK-6960-PR

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/flink/pull/4152.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #4152


commit cadba6ef47dc0d1781c1fbf239e7675d00bb954c
Author: sunjincheng121 
Date:   2017-06-21T08:29:15Z

[FLINK-6960][table] Add E supported in SQL.




---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---