[GitHub] [carbondata] Indhumathi27 commented on a change in pull request #3488: [CARBONDATA-3599] Support auto ingest data written by Flink

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[GitHub] [carbondata] Indhumathi27 commented on a change in pull request #3488: [CARBONDATA-3599] Support auto ingest data written by Flink

GitBox
Indhumathi27 commented on a change in pull request #3488: [CARBONDATA-3599] Support auto ingest data written by Flink
URL: https://github.com/apache/carbondata/pull/3488#discussion_r355239177
 
 

 ##########
 File path: integration/spark-common/src/main/scala/org/apache/carbondata/spark/load/DataLoadProcessBuilderOnSpark.scala
 ##########
 @@ -369,6 +378,72 @@ object DataLoadProcessBuilderOnSpark {
     carbonTaskInfo.setTaskId(CarbonUtil.generateUUID())
     ThreadLocalTaskInfo.setCarbonTaskInfo(carbonTaskInfo)
   }
+
+  /**
+   * create CarbonLoadModel for global_sort
+   */
+  def createLoadModelForGlobalSort(
+      sparkSession: SparkSession,
+      carbonTable: CarbonTable
+  ): CarbonLoadModel = {
+    val conf = SparkSQLUtil.sessionState(sparkSession).newHadoopConf()
+    CarbonTableOutputFormat.setDatabaseName(conf, carbonTable.getDatabaseName)
+    CarbonTableOutputFormat.setTableName(conf, carbonTable.getTableName)
+    CarbonTableOutputFormat.setCarbonTable(conf, carbonTable)
+    val fieldList = carbonTable.getCreateOrderColumn
+      .asScala
+      .map { column =>
+        new StructField(column.getColName, column.getDataType)
+      }
+    CarbonTableOutputFormat.setInputSchema(conf, new StructType(fieldList.asJava))
+    val loadModel = CarbonTableOutputFormat.getLoadModel(conf)
+    loadModel.setSerializationNullFormat(
+      TableOptionConstant.SERIALIZATION_NULL_FORMAT.getName + ",\\N")
+    loadModel.setBadRecordsLoggerEnable(
+      TableOptionConstant.BAD_RECORDS_LOGGER_ENABLE.getName + ",false")
 
 Review comment:
   Please set it to default `CarbonLoadOptionConstants .CARBON_OPTIONS_BAD_RECORDS_LOGGER_ENABLE_DEFAULT `

----------------------------------------------------------------
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:
[hidden email]


With regards,
Apache Git Services