niuge01 commented on a change in pull request #3628: [CARBONDATA-3714] Support
specify order type when list stage files
URL: https://github.com/apache/carbondata/pull/3628#discussion_r386848984
##########
File path:
integration/spark2/src/main/scala/org/apache/spark/sql/execution/command/management/CarbonInsertFromStageCommand.scala
##########
@@ -117,15 +113,29 @@ case class CarbonInsertFromStageCommand(
// 1) read all existing stage files
val batchSize = try {
- Integer.valueOf(options.getOrElse("batch_file_count",
Integer.MAX_VALUE.toString))
+ Integer.valueOf(
+ options.getOrElse(CarbonInsertFromStageCommand.BATCH_FILE_COUNT_KEY,
+ CarbonInsertFromStageCommand.BATCH_FILE_COUNT_DEFAULT))
} catch {
case _: NumberFormatException =>
- throw new MalformedCarbonCommandException("Option [batch_file_count]
is not a number.")
+ throw new MalformedCarbonCommandException("Option [" +
+ CarbonInsertFromStageCommand.BATCH_FILE_COUNT_KEY + "] is not a
number.")
}
if (batchSize < 1) {
- throw new MalformedCarbonCommandException("Option [batch_file_count]
is less than 1.")
+ throw new MalformedCarbonCommandException("Option [" +
+ CarbonInsertFromStageCommand.BATCH_FILE_COUNT_KEY + "] is less
than 1.")
}
- val stageFiles = listStageFiles(stagePath, hadoopConf, batchSize)
+ val orderType =
options.getOrElse(CarbonInsertFromStageCommand.BATCH_FILE_ORDER_KEY,
+ CarbonInsertFromStageCommand.BATCH_FILE_ORDER_DEFAULT)
+ if
(!orderType.equalsIgnoreCase(CarbonInsertFromStageCommand.BATCH_FILE_ORDER_ASC)
&&
+
!orderType.equalsIgnoreCase(CarbonInsertFromStageCommand.BATCH_FILE_ORDER_DESC))
{
+ throw new MalformedCarbonCommandException("Option [" +
+ CarbonInsertFromStageCommand.BATCH_FILE_ORDER_KEY + "] is invalid,
should be " +
+ CarbonInsertFromStageCommand.BATCH_FILE_ORDER_ASC + " or " +
+ CarbonInsertFromStageCommand.BATCH_FILE_ORDER_DESC + ".")
+ }
+ val stageFiles = listStageFiles(stagePath, hadoopConf, batchSize,
+
orderType.equalsIgnoreCase(CarbonInsertFromStageCommand.BATCH_FILE_ORDER_ASC))
Review comment:
Yes, add a log will be better, done.
----------------------------------------------------------------
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:
[email protected]
With regards,
Apache Git Services