Skip to content

Commit

Permalink
[hotfix][table-api] Discourage the usage of the Literal case class in…
Browse files Browse the repository at this point in the history
… API
  • Loading branch information
twalthr committed Feb 28, 2019
1 parent f74ad0c commit 083ecc1
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
2 changes: 2 additions & 0 deletions docs/dev/table/tableApi.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 %}
Original file line number Diff line number Diff line change
Expand Up @@ -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:
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down

0 comments on commit 083ecc1

Please sign in to comment.