Using DLI to Convert Data Format from CSV to Parquet
Application Scenarios
Parquet is a columnar storage substrate created for simpler data analysis. This format can speed up queries by allowing only the required columns to be read and calculated. In addition, Parquet is built to support very efficient compression schemes, which maximizes the storage efficiency on disks. Using DLI, you can easily convert data format form CSV to Parquet.
Operation Process
- Create a CSV file. See test.csv in Figure 1.
- In the OBS management console, create a bucket named obs-csv-parquet and upload the test.csv file to OBS. See Figure 2.
- In the SQL editing box of the DLI management console, create an OBS table named test_csv_hw and import data in the test.csv file to test_csv_hw.
create table test_csv_hw(id1 int, id2 int, id3 int, id4 int, id5 int) using csv options(path 'obs://obs-csv-parquet/test.csv')
- In the SQL editing box of the DLI management console, query data in the test_csv_hw table. Figure 3 Querying data in the test_csv_hw table
- Create a bucket named obs-parquet-data on OBS to store Parquet data.
- In the SQL job editing window of the DLI management console, create an OBS table named test_parquet_hw.
CREATE TABLE `test_parquet_hw` (`id1` INT, `id2` INT, `id3` INT, `id4` INT, `id5` INT) USING parquet OPTIONS ( path 'obs://obs-parquet-data/' )
You do not need to specify a file because no Parquet file exists before the data is converted from the CSV format to the Parquet format.
- In the SQL job editing window of the DLI management console, convert CSV data into Parquet data and store the data in OBS.
insert into test_parquet_hw select * from test_csv_hw
- Check the result. As shown in Figure 4, the system automatically creates a file for saving the result.
Last Article: Consulting Service Data Analysis in Financial Industry
Next Article: Using DLI to Analyze E-commerce BI Reports



Did this article solve your problem?
Thank you for your score!Your feedback would help us improve the website.