This topic describes how to write data to OSS in DLA.
Create an OSS schema in DLA.
CREATE SCHEMA oss_schema with DBPROPERTIES(
catalog='oss',
location = 'oss://mybucket/datasets/****/test/convert/'
);
Create a table named orders_txt in DLA.
CREATE EXTERNAL TABLE orders_txt (
O_ORDERKEY INT,
O_CUSTKEY INT,
O_ORDERSTATUS STRING,
O_TOTALPRICE DOUBLE,
O_ORDERDATE DATE,
O_ORDERPRIORITY STRING,
O_CLERK STRING,
O_SHIPPRIORITY INT,
O_COMMENT STRING
)
ROW FORMAT DELIMITED FIELDS TERMINATED BY '|'
STORED AS TEXTFILE LOCATION 'oss://mybucket/datasets/****/test/convert/orders.tbl';
Create a table named orders_orc in DLA.
REATE EXTERNAL TABLE orders_orc (
O_ORDERKEY INT,
O_CUSTKEY INT,
O_ORDERSTATUS STRING,
O_TOTALPRICE DOUBLE,
O_ORDERDATE DATE,
O_ORDERPRIORITY STRING,
O_CLERK STRING,
O_SHIPPRIORITY INT,
O_COMMENT STRING
)
STORED AS ORC LOCATION 'oss://mybucket/datasets/****/test/convert/orders_orc/';
Execute the INSERT… SELECT statement to insert data records that meet the specified filter criteria from orders_txt to orders_orc.
INSERT INTO orders_orc SELECT * FROM orders_txt;