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

    https://github.com/apache/carbondata/pull/1774#discussion_r161442551
  
    --- Diff: 
integration/spark2/src/main/scala/org/apache/spark/sql/CarbonDataFrameWriter.scala
 ---
    @@ -167,13 +167,19 @@ class CarbonDataFrameWriter(sqlContext: SQLContext, 
val dataFrame: DataFrame) {
         val carbonSchema = schema.map { field =>
           s"${ field.name } ${ convertToCarbonType(field.dataType) }"
         }
    +  val isStreaming = if (options.isStreaming) Some("true") else None
    +
         val property = Map(
           "SORT_COLUMNS" -> options.sortColumns,
           "DICTIONARY_INCLUDE" -> options.dictionaryInclude,
           "DICTIONARY_EXCLUDE" -> options.dictionaryExclude,
    -      "TABLE_BLOCKSIZE" -> options.tableBlockSize
    -    ).filter(_._2.isDefined).map(p => s"'${p._1}' = 
'${p._2.get}'").mkString(",")
    +      "TABLE_BLOCKSIZE" -> options.tableBlockSize,
    +      "STREAMING" -> isStreaming
    --- End diff --
    
    @jackylk  i found the root cause ddl written in carbondataframe writer is 
wrong location should come above of tblproperties the same way it comes in hive 
so ddl in data framewriter should be
    
      s"""
           | CREATE TABLE IF NOT EXISTS $dbName.${options.tableName}
           | (${ carbonSchema.mkString(", ") })
           | STORED BY 'carbondata'
           | ${ if (options.tablePath.nonEmpty) s"LOCATION 
'${options.tablePath.get}'" else ""}
           |  ${ if (property.nonEmpty) "TBLPROPERTIES (" + property + ")" else 
"" }
           |
         """.stripMargin
    
    i corrected it now and every thing is running fine please review


---

Reply via email to