This is an automated email from the ASF dual-hosted git repository.
twalthr pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/flink.git
The following commit(s) were added to refs/heads/master by this push:
new 083ecc1 [hotfix][table-api] Discourage the usage of the Literal case
class in API
083ecc1 is described below
commit 083ecc194df75e357bc01e41427dadf67b2c5c09
Author: Timo Walther <[email protected]>
AuthorDate: Thu Feb 28 16:09:41 2019 +0100
[hotfix][table-api] Discourage the usage of the Literal case class in API
---
docs/dev/table/tableApi.md | 2 ++
.../src/main/scala/org/apache/flink/table/api/scala/package.scala | 2 +-
.../test/scala/org/apache/flink/table/expressions/DecimalTypeTest.scala | 2 +-
3 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/docs/dev/table/tableApi.md b/docs/dev/table/tableApi.md
index 9fdbf47..08a5a8a 100644
--- a/docs/dev/table/tableApi.md
+++ b/docs/dev/table/tableApi.md
@@ -1806,4 +1806,6 @@ In order to work with temporal values the Table API
supports Java SQL's Date, Ti
Temporal intervals can be represented as number of months
(`Types.INTERVAL_MONTHS`) or number of milliseconds (`Types.INTERVAL_MILLIS`).
Intervals of same type can be added or subtracted (e.g. `1.hour + 10.minutes`).
Intervals of milliseconds can be added to time points (e.g.
`"2016-08-10".toDate + 5.days`).
+Scala expressions use implicit conversions. Therefore, make sure to add the
wildcard import `org.apache.flink.table.api.scala._` to your programs. In case
a literal is not treated as an expression, use `.toExpr` such as `3.toExpr` to
force a literal to be converted.
+
{% top %}
diff --git
a/flink-table/flink-table-planner/src/main/scala/org/apache/flink/table/api/scala/package.scala
b/flink-table/flink-table-planner/src/main/scala/org/apache/flink/table/api/scala/package.scala
index 8a6cb8b..67eef8c 100644
---
a/flink-table/flink-table-planner/src/main/scala/org/apache/flink/table/api/scala/package.scala
+++
b/flink-table/flink-table-planner/src/main/scala/org/apache/flink/table/api/scala/package.scala
@@ -43,7 +43,7 @@ import _root_.scala.language.implicitConversions
*
* When writing a query you can use Scala Symbols to refer to field names.
One would
* refer to field `a` by writing `'a`. Sometimes it is necessary to manually
convert a
- * Scala literal to an Expression literal, in those cases use `Literal`, as
in `Literal(3)`.
+ * Scala literal to an expression literal, in those cases use `.toExpr`, as
in `3.toExpr`.
*
* Example:
*
diff --git
a/flink-table/flink-table-planner/src/test/scala/org/apache/flink/table/expressions/DecimalTypeTest.scala
b/flink-table/flink-table-planner/src/test/scala/org/apache/flink/table/expressions/DecimalTypeTest.scala
index 5de6f2c..607744c 100644
---
a/flink-table/flink-table-planner/src/test/scala/org/apache/flink/table/expressions/DecimalTypeTest.scala
+++
b/flink-table/flink-table-planner/src/test/scala/org/apache/flink/table/expressions/DecimalTypeTest.scala
@@ -193,7 +193,7 @@ class DecimalTypeTest extends ExpressionTestBase {
// implicit cast to decimal
testAllApis(
- Literal(12.3) + 'f1,
+ 12.3.toExpr + 'f1,
"12.3 + f1",
"12.3 + f1",
"123456789123456789123456801.3")