Summary of the Question
I also checked the below link to repair my issue, but it doesn't helped me.
How to query on AWS Athena partitioned table
There are 4 types of partitions, in my log table.
- aws_account_id
string
- log_type
string
- aws_region
string
- date
string
I tried a simple SELECT
query on partitioned table. But got the below error message.
ERROR Message
GENERIC_INTERNAL_ERROR: No value present
This query ran against the "default" database, unless qualified by the query.
SELECT Query that I Tried
SELECT * FROM "logs" LIMIT 10;
AND
SELECT * FROM "default"."logs" LIMIT 10;
Since error message about No value present
, I checked the partitions results.
SHOW PARTITIONS logs;
Result format
aws_account_id=${aws_account_id}/log_type=${log_type}/aws_region=${aws_region}/date=${date}
I would greatly appreciate your help.
Further Info
CREATE TABLE
command that I used
Create Table
CREATE EXTERNAL TABLE `logs`(
`account_id` string,
`interface_id` string,
`srcaddr` string,
`dstaddr` string,
`srcport` int,
`dstport` int,
`traffic_protocol` bigint,
`packets` bigint,
`bytes` bigint,
`start_time` bigint,
`end_time` bigint,
`traffic_action` string,
`log_status` string,
`vpc_id` string,
`subnet_id` string,
`instance_id` string,
`tcp_flags` int,
`flow_direction` string)
PARTITIONED BY (
`aws_account_id` string,
`log_type` string,
`aws_region` string,
`date` string)
ROW FORMAT DELIMITED
FIELDS TERMINATED BY ' '
WITH SERDEPROPERTIES (
'EXTERNAL'='true',
'skip.header.line.count'='1')
STORED AS INPUTFORMAT
'org.apache.hadoop.mapred.TextInputFormat'
OUTPUTFORMAT
'org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat'
LOCATION
's3://default/path/'
TBLPROPERTIES (
'last_modified_by'='hadoop',
'last_modified_time'='1646821386',
'projection.aws_account_id.type'='injected',
'projection.aws_region.type'='injected',
'projection.date.format'='yyyy/MM/dd',
'projection.date.interval'='1',
'projection.date.interval.unit'='DAYS',
'projection.date.range'='2019/11/27, NOW-1DAYS',
'projection.date.type'='date',
'projection.enabled'='true',
'projection.log_type.type'='string',
'projection.log_type.values'='logs',
'storage.location.template'='s3://default/logs/${aws_account_id}/${log_type}/${aws_region}/${date}',
'transient_lastDdlTime'='1646821386')