Github user dongjoon-hyun commented on a diff in the pull request:
https://github.com/apache/spark/pull/22395#discussion_r217177287
--- Diff:
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/arithmetic.scala
---
@@ -314,6 +314,27 @@ case class Divide(left: Expression, right: Expression)
extends DivModLike {
override def evalOperation(left: Any, right: Any): Any = div(left, right)
}
+@ExpressionDescription(
+ usage = "a _FUNC_ b - Divides a by b.",
+ examples = """
+ Examples:
+ > SELECT 3 _FUNC_ 2;
+ 1
+ """,
+ since = "3.0.0")
+case class IntegralDivide(left: Expression, right: Expression) extends
DivModLike {
--- End diff --
Ur, sorry, but why not? As @viirya suggested, without that, the description
added here is not meaningless.
```scala
spark-sql> describe function 'div';
Function: div not found.
Time taken: 0.016 seconds, Fetched 1 row(s)
```
Also, Hive accepts that like the following.
```scala
0: jdbc:hive2://ctr-e138-1518143905142-429335> describe function div;
+----------------------------------------------------+
| tab_name |
+----------------------------------------------------+
| a div b - Divide a by b rounded to the long integer |
+----------------------------------------------------+
0: jdbc:hive2://ctr-e138-1518143905142-429335> select 3 / 2, 3 div 2,
`/`(3,2), `div`(3,2);
+------+------+------+------+
| _c0 | _c1 | _c2 | _c3 |
+------+------+------+------+
| 1.5 | 1 | 1.5 | 1 |
+------+------+------+------+
1 row selected (0.288 seconds)
```
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]