Github user xubo245 commented on a diff in the pull request: https://github.com/apache/carbondata/pull/3054#discussion_r246249496 --- Diff: examples/spark2/src/main/scala/org/apache/carbondata/examples/AlluxioExample.scala --- @@ -28,46 +33,86 @@ import org.apache.carbondata.examples.util.ExampleUtils /** * configure alluxio: * 1.start alluxio - * 2.upload the jar :"/alluxio_path/core/client/target/ - * alluxio-core-client-YOUR-VERSION-jar-with-dependencies.jar" - * 3.Get more detail at:http://www.alluxio.org/docs/master/en/Running-Spark-on-Alluxio.html + * 2.Get more detail at: https://www.alluxio.org/docs/1.8/en/compute/Spark.html */ - object AlluxioExample { - def main(args: Array[String]) { - val spark = ExampleUtils.createCarbonSession("AlluxioExample") - exampleBody(spark) - spark.close() + def main (args: Array[String]) { + val carbon = ExampleUtils.createCarbonSession("AlluxioExample", + storePath = "alluxio://localhost:19998/carbondata") + exampleBody(carbon) + carbon.close() } - def exampleBody(spark : SparkSession): Unit = { + def exampleBody (spark: SparkSession): Unit = { + val rootPath = new File(this.getClass.getResource("/").getPath + + "../../../..").getCanonicalPath spark.sparkContext.hadoopConfiguration.set("fs.alluxio.impl", "alluxio.hadoop.FileSystem") FileFactory.getConfiguration.set("fs.alluxio.impl", "alluxio.hadoop.FileSystem") // Specify date format based on raw data CarbonProperties.getInstance() .addProperty(CarbonCommonConstants.CARBON_DATE_FORMAT, "yyyy/MM/dd") - spark.sql("DROP TABLE IF EXISTS alluxio_table") + val time = new SimpleDateFormat("yyyyMMddHHmmssSSS").format(new Date()) + + val mFsShell = new FileSystemShell() + val localFile = rootPath + "/hadoop/src/test/resources/data.csv" + val remotePath = "/carbon_alluxio" + time + ".csv" + val remoteFile = "alluxio://localhost:19998/carbon_alluxio" + time + ".csv" --- End diff -- ok
---