Skip to content

Instantly share code, notes, and snippets.

@ogiogi93
Last active March 13, 2019 15:34
Show Gist options
  • Save ogiogi93/f4896d4c0f1078c4a441a5f1d4edc22c to your computer and use it in GitHub Desktop.
Save ogiogi93/f4896d4c0f1078c4a441a5f1d4edc22c to your computer and use it in GitHub Desktop.
CREATE EXTERNAL TABLE IF NOT EXISTS sample_aijcif01.apache_logs (
host STRING,
identity STRING,
user STRING,
time STRING,
request STRING,
status STRING,
size STRING,
referer STRING,
agent STRING
) PARTITIONED BY (
year int,
month int,
day int,
hour int
)
ROW FORMAT SERDE 'org.apache.hadoop.hive.serde2.RegexSerDe'
WITH SERDEPROPERTIES (
"input.regex" = "([^ ]*) ([^ ]*) ([^ ]*) (-|\\[[^\\]]*\\]) ([^ \"]*|\"[^\"]*\") (-|[0-9]*) (-|[0-9]*)(?: ([^ \"]*|\"[^\"]*\") ([^ \"]*|\"[^\"]*\"))?",
"output.format.string" = "%1$s %2$s %3$s %4$s %5$s %6$s %7$s %8$s %9$s"
) LOCATION 's3://<bucket名>'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment