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

    https://github.com/apache/carbondata/pull/1841#discussion_r164364870
  
    --- Diff: 
integration/spark-common/src/main/scala/org/apache/carbondata/spark/util/CommonUtil.scala
 ---
    @@ -941,4 +943,40 @@ object CommonUtil {
         }
       }
     
    +  def setTempStoreLocation(
    +      index: Int,
    +      carbonLoadModel: CarbonLoadModel,
    +      isCompactionFlow: Boolean,
    +      isAltPartitionFlow: Boolean) : Unit = {
    +    var storeLocation: String = null
    +
    +    // this property is used to determine whether temp location for carbon 
is inside
    +    // container temp dir or is yarn application directory.
    +    val carbonUseLocalDir = CarbonProperties.getInstance()
    +      .getProperty("carbon.use.local.dir", "false")
    +
    +    if (carbonUseLocalDir.equalsIgnoreCase("true")) {
    +
    +      val storeLocations = Util.getConfiguredLocalDirs(SparkEnv.get.conf)
    +      if (null != storeLocations && storeLocations.nonEmpty) {
    +        storeLocation = 
storeLocations(Random.nextInt(storeLocations.length))
    +      }
    +      if (storeLocation == null) {
    +        storeLocation = System.getProperty("java.io.tmpdir")
    +      }
    +    } else {
    +      storeLocation = System.getProperty("java.io.tmpdir")
    +    }
    +    storeLocation = storeLocation + CarbonCommonConstants.FILE_SEPARATOR + 
"carbon" +
    +      System.nanoTime() + CarbonCommonConstants.UNDERSCORE + index
    +
    +    val tempLocationKey = CarbonDataProcessorUtil
    +      .getTempStoreLocationKey(carbonLoadModel.getDatabaseName,
    +        carbonLoadModel.getTableName,
    +        carbonLoadModel.getSegmentId,
    +        carbonLoadModel.getTaskNo,
    +        isCompactionFlow,
    +        isAltPartitionFlow)
    +    CarbonProperties.getInstance().addProperty(tempLocationKey, 
storeLocation)
    --- End diff --
    
    Do not use CarbonProperty to pass parameter across functions, add this 
parameter to LoadModel


---

Reply via email to