Github user gatorsmile commented on a diff in the pull request:

    https://github.com/apache/spark/pull/16209#discussion_r107086057
  
    --- Diff: 
sql/core/src/test/scala/org/apache/spark/sql/jdbc/JDBCWriteSuite.scala ---
    @@ -362,4 +363,80 @@ class JDBCWriteSuite extends SharedSQLContext with 
BeforeAndAfter {
           assert(sql("select * from people_view").count() == 2)
         }
       }
    +
    +  test("SPARK-10849: create table using user specified column type.") {
    +    val data = Seq[Row](
    +      Row(1, "dave", "Boston", "electric cars"),
    +      Row(2, "mary", "Seattle", "building planes")
    +    )
    +    val schema = StructType(
    +      StructField("id", IntegerType) ::
    +        StructField("first#name", StringType) ::
    +        StructField("city", StringType) ::
    +        StructField("descr", StringType) ::
    +        Nil)
    +    val df = spark.createDataFrame(sparkContext.parallelize(data), schema)
    +    // Use database specific CHAR/VARCHAR types instead of String data 
type.
    +    val createTableColTypes = "`first#name` VARCHAR(123), city CHAR(20)"
    +    assert(JdbcUtils.schemaString(df.schema, url1, 
Option(createTableColTypes)) ==
    +      s""""id" INTEGER , "first#name" VARCHAR(123) , "city" CHAR(20) , 
"descr" TEXT """)
    --- End diff --
    
    This is the case that users specify all the columns. In this case, we 
should mix the order of the columns. 
    
    In addition, we also need a case that users only specify one/two columns.


---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

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

Reply via email to