You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2019/10/29 01:26:26 UTC

[GitHub] [spark] maropu commented on a change in pull request #26287: [SPARK-28158][SQL][FOLLOWUP] HiveUserDefinedTypeSuite: don't use RandomDataGenerator to create row for UDT backed by ArrayType

maropu commented on a change in pull request #26287: [SPARK-28158][SQL][FOLLOWUP] HiveUserDefinedTypeSuite: don't use RandomDataGenerator to create row for UDT backed by ArrayType
URL: https://github.com/apache/spark/pull/26287#discussion_r339859916
 
 

 ##########
 File path: sql/hive/src/test/scala/org/apache/spark/sql/hive/HiveUserDefinedTypeSuite.scala
 ##########
 @@ -18,26 +18,28 @@
 package org.apache.spark.sql.hive
 
 import scala.collection.JavaConverters._
+import scala.util.Random
 
 import org.apache.hadoop.hive.ql.udf.generic.GenericUDF
 import org.apache.hadoop.hive.serde2.objectinspector.{ObjectInspector, StandardListObjectInspector}
 import org.apache.hadoop.hive.serde2.objectinspector.primitive.PrimitiveObjectInspectorFactory
 
-import org.apache.spark.sql.{QueryTest, RandomDataGenerator, Row}
+import org.apache.spark.sql.{QueryTest, Row}
 import org.apache.spark.sql.catalyst.FunctionIdentifier
 import org.apache.spark.sql.hive.test.TestHiveSingleton
 import org.apache.spark.sql.test.{ExamplePoint, ExamplePointUDT}
 import org.apache.spark.sql.types.StructType
 
+
 class HiveUserDefinedTypeSuite extends QueryTest with TestHiveSingleton {
   private val functionClass = classOf[org.apache.spark.sql.hive.TestUDF].getCanonicalName
 
   test("Support UDT in Hive UDF") {
+    val rand = new Random
     val functionName = "get_point_x"
     try {
-      val schema = new StructType().add("point", new ExamplePointUDT)
-      val inputGenerator = RandomDataGenerator.forType(schema, nullable = false).get
-      val input = inputGenerator.apply().asInstanceOf[Row]
+      val schema = new StructType().add("point", new ExamplePointUDT, nullable = false)
+      val input = Row.fromSeq(Seq(new ExamplePoint(rand.nextDouble(), rand.nextDouble())))
 
 Review comment:
   Yea, better to remove the randomness...

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org