Project: Apache CarbonData (App Definition and Development / Database)
File: alluxio-guide.md

<!-- Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. --> This tutorial provides a brief introduction to using Alluxio. How to use Alluxio in CarbonData? - - Please refer to . Users need to install IDEA and scala plugin, and import CarbonData project. Please refer to Access the Alluxio web: Please refer to Please refer to . Please refer to Please refer to Running the command in spark path ```$command ./bin/spark-shell --jars ${CARBONDATAPATH}/assembly/target/scala-2.11/apache-carbondata-2.0.0-SNAPSHOT-bin-spark2.3.4-hadoop2.7.2.jar,${ALLUXIOPATH}/client/alluxio-1.8.1-client.jar ``` Testing use alluxio by CarbonSession ```$scala import org.apache.spark.sql.CarbonSession._ import org.apache.spark.sql.SparkSession val carbon = SparkSession.builder().master("local").appName("test").getOrCreateCarbonSession("alluxio://localhost:19998/carbondata"); carbon.sql("CREATE TABLE carbon_alluxio(id String,name String, city String,age Int) STORED as carbondata"); carbon.sql(s"LOAD DATA LOCAL INPATH '${CARBONDATAPATH}/integration/spark/src/test/resources/sample.csv' into table carbonalluxio"); carbon.sql("select * from carbon_alluxio").show ``` Result ```$scala scala> carbon.sql("select * from carbon_alluxio").show +++++ | id| name| city|age| +++++ | 1| david| shenzhen| 31| | 2| eason| shenzhen| 27| | 3| jarry| wuhan| 35| | 3| jarry|Bangalore| 35| | 4| kunal| Delhi| 26| | 4|vishal|Bangalore| 29| +++++ ``` Please refer to . Please refer to Please refer to ```$command ./bin/alluxio fs copyFromLocal ${CARBONDATA_PATH}/hadoop/src/test/resources/data.csv / ``` ```$command ./bin/spark-submit \ --master local \ --jars ${ALLUXIOPATH}/client/alluxio-1.8.1-client.jar,${CARBONDATAPATH}/examples/spark/target/carbondata-examples-2.0.0-SNAPSHOT.jar \ --class org.apache.carbondata.examples.AlluxioExample \ ${CARBONDATA_PATH}/assembly/target/scala-2.11/apache-carbondata-2.0.0-SNAPSHOT-bin-spark2.3.4-hadoop2.7.2.jar \ false ``` NOTE: Please set runShell as false, which can avoid dependency on alluxio shell module. ```$command +--+-+--+--++--++-+ |SegmentSequenceId| Status| Load Start Time| Load End Time|Merged To|File Format|Data Size|Index Size| +--+-+--+--++--++-+ | 1|Success|2019-01-09 15:10:...|2019-01-09 15:10:...| NA|COLUMNAR_V3| 23.92KB| 1.07KB| | 0|Success|2019-01-09 15:10:...|2019-01-09 15:10:...| NA|COLUMNAR_V3| 23.92KB| 1.07KB| +--+-+--+--++--++-+ +-++ |country|amount| +-++ | france| 202| | china| 1698| +-++ +--++--+--++--++-+ |SegmentSequenceId| Status| Load Start Time| Load End Time|Merged To|File Format|Data Size|Index Size| +--++--+--++--++-+ | 3|Compacted|2019-01-09 15:10:...|2019-01-09 15:10:...| 0.1|COLUMNAR_V3| 23.92KB| 1.03KB| | 2|Compacted|2019-01-09 15:10:...|2019-01-09 15:10:...| 0.1|COLUMNAR_V3| 23.92KB| 1.07KB| | 1|Compacted|2019-01-09 15:10:...|2019-01-09 15:10:...| 0.1|COLUMNAR_V3| 23.92KB| 1.07KB| | 0.1| Success|2019-01-09 15:10:...|2019-01-09 15:10:...| NA|COLUMNAR_V3| 37.65KB| 1.08KB| | 0|Compacted|2019-01-09 15:10:...|2019-01-09 15:10:...| 0.1|COLUMNAR_V3| 23.92KB| 1.07KB| +--++--+--++--++-+ ``` [1] https://www.alluxio.org/docs/1.8/en/Getting-Started.html [2] https://www.alluxio.org/docs/1.8/en/compute/Spark.html