Github user kevinjmh commented on a diff in the pull request: https://github.com/apache/carbondata/pull/3054#discussion_r245639998 --- Diff: examples/spark2/src/main/scala/org/apache/carbondata/examples/AlluxioExample.scala --- @@ -26,48 +30,88 @@ 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 - */ + * 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 + */ 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 mFsShell = new FileSystemShell() + val localFile = rootPath + "/hadoop/src/test/resources/data.csv" + val remotePath = "/carbon_alluxio.csv" + val remoteFile = "alluxio://localhost:19998/carbon_alluxio.csv" + mFsShell.run("rm", remotePath) --- End diff -- As an example, I think we should not do this operation
---