- Newest
- Most votes
- Most comments
What have you configured for storage.location.template in your TBLPROPERTIES?
When using partition projection it generates all possible values for the partitioning column. In this case it generates values 01, 02, 03,..10,11,12. Input integer 1 doesn't match with '01' hence the error.
To have leading zeros in the value it has to be defined as string in table definition - this is irrespective of whether you are using partition projection or not.
Here if you are looking for two digits for 'month' partitioning column values, then define it as string -
CREATE EXTERNAL TABLE test (
a string)
PARTITIONED BY (
month string
)
STORED AS PARQUET
LOCATION
's3://my_bucket/data_lake/test'
TBLPROPERTIES (
'projection.enabled'='true',
'projection.month.type'='integer',
'projection.month.digits'='2',
'projection.month.range'='01,12'
)
INSERT INTO test VALUES ('some data','01')
This will create s3 partition like - month=01
Though it is defined as string in the table, it will not take values other than these - [01,02,03,04....10,11,12] and throw an error if any other integer or a string value is passed.
Moreover partition projections are mainly used when querying data that is highly partitioned[1].
[1] https://docs.aws.amazon.com/athena/latest/ug/partition-projection.html#partition-projection-using
answered 2 years ago
Relevant content
asked 2 years ago
- AWS OFFICIALUpdated 2 years ago

I didn't set any. Because it is stated in the documentation
and my case does supposed to follow typical.
Anyway this does not changes anything.