Github user hvanhovell commented on a diff in the pull request:
https://github.com/apache/spark/pull/13651#discussion_r67223826
--- Diff:
sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/analysis/AnalysisSuite.scala
---
@@ -345,4 +345,42 @@ class AnalysisSuite extends AnalysisTest {
assertAnalysisSuccess(query)
}
+
+ test("SPARK-15776: test whether Divide expression's data type can be
deduced correctly by " +
+ "analyzer") {
+ val testRelation = LocalRelation(AttributeReference("a",
IntegerType)())
+ assertSameSchema(
--- End diff --
How about defining a tester function, and use that for the rest of the
testing? Something like:
```scala
def assertDivideReturnType(left: Expression, right: Expression, dt:
DataType): Unit = {
assertSameSchema(
Project(Seq(Alias(sum(Divide(left, right)), "a")()), OneRowRelation),
StructType(Seq(StructField("a", dt, true))))
}
```
---
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 [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]