Skip to content

Instantly share code, notes, and snippets.

@Gatsby-Lee
Last active August 20, 2022 23:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Gatsby-Lee/5c0d95fabb1cdbe06082ec9df8d2f2b8 to your computer and use it in GitHub Desktop.
Save Gatsby-Lee/5c0d95fabb1cdbe06082ec9df8d2f2b8 to your computer and use it in GitHub Desktop.
-- default and supported compression
-- ref: https://docs.aws.amazon.com/athena/latest/ug/compression-formats.html
-- ---------------------
-- Set ORC's compression
-- ---------------------
CREATE TABLE my_db.orc_snappy (
clsuter_id string
)
STORED AS ORC
LOCATION 's3://aws-athena/my_db/orc_snappy'
TBLPROPERTIES ("orc.compress"="SNAPPY");
-- disable compression
CREATE TABLE my_db.orc_uncompressed (
clsuter_id string
)
STORED AS ORC
LOCATION 's3://aws-athena/my_db/orc_uncompressed'
TBLPROPERTIES ("orc.compress"="NONE");
-- -------------------------
-- Set Parquet's compression
-- -------------------------
CREATE TABLE my_db.parquet_snappy (
clsuter_id string
)
STORED AS PARQUET
LOCATION 's3://aws-athena/my_db/parquet_snappy'
TBLPROPERTIES ("parquet.compression"="SNAPPY");
-- disable compression
CREATE TABLE my_db.parquet_uncompressed (
clsuter_id string
)
STORED AS PARQUET
LOCATION 's3://aws-athena/my_db/parquet_uncompressed'
TBLPROPERTIES ("parquet.compression"="UNCOMPRESSED");
-- -------------------------
-- Set TEXTFILE's compression
-- -------------------------
CREATE TABLE my_db.textfile_gzip (
clsuter_id string
)
STORED AS TEXTFILE
LOCATION 's3://aws-athena/my_db/textfile_gzip'
TBLPROPERTIES ("parquet.compression"="GZIP");
-- disable compression
CREATE TABLE my_db.textfile_uncompressed (
clsuter_id string
)
STORED AS TEXTFILE
LOCATION 's3://aws-athena/my_db/textfile_uncompressed'
TBLPROPERTIES ("write.compression"="NONE");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment