carbondata-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jackylk <...@git.apache.org>
Subject [GitHub] incubator-carbondata pull request #630: [CARBONDATA-730] added decimal type ...
Date Tue, 14 Mar 2017 17:05:47 GMT
Github user jackylk commented on a diff in the pull request:

    https://github.com/apache/incubator-carbondata/pull/630#discussion_r105968680
  
    --- Diff: integration/spark2/src/main/scala/org/apache/spark/sql/CarbonDataFrameWriter.scala
---
    @@ -34,12 +34,37 @@ class CarbonDataFrameWriter(sqlContext: SQLContext, val dataFrame:
DataFrame) {
       def saveAsCarbonFile(parameters: Map[String, String] = Map()): Unit = {
         // create a new table using dataframe's schema and write its content into the table
         sqlContext.sparkSession.sql(makeCreateTableString(dataFrame.schema,
    -    new CarbonOption(parameters)))
    +      new CarbonOption(parameters)))
         writeToCarbonFile(parameters)
       }
     
    -  def appendToCarbonFile(parameters: Map[String, String] = Map()): Unit = {
    -    writeToCarbonFile(parameters)
    +  private def makeCreateTableString(schema: StructType, options: CarbonOption): String
= {
    +    val carbonSchema = schema.map { field =>
    +      s"${ field.name } ${ convertToCarbonType(field.dataType) }"
    +    }
    +    s"""
    +          CREATE TABLE IF NOT EXISTS ${ options.dbName }.${ options.tableName }
    +          (${ carbonSchema.mkString(", ") })
    +          using org.apache.spark.sql.CarbonSource
    +          OPTIONS('dbName'='${ options.dbName }', 'tableName'='${ options.tableName }')
    +      """
    +  }
    +
    +  private def convertToCarbonType(sparkType: DataType): String = {
    --- End diff --
    
    It seems this function is moved from line 144 to here? It is better not to move it so
that it is easier to review


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

Mime
View raw message