Trino version
477
Please describe the bug
Date partition projection using only year-month formats (e.g., yyyy-MM) stopped working in Trino 477.
I utilize partition_projection_format=yyyy-MM to query an external table with year-month partitioning. Although this configuration operated correctly in Trino 476, it became non-functional in version 477.
This is a regression introduced by commit d1ca4558e9d ("Refactor DateProjection to use DateTimeFormatter"), which replaced SimpleDateFormat with DateTimeFormatter but did not account for formats that don't include a day component.
Error message returned when executing a SELECT query on this table:
SQL Error [65536]: Query failed (#20260408_171023_00000_7eebf): Unable to obtain LocalDateTime from TemporalAccessor: {MonthOfYear=1, Year=2021},ISO of type java.time.format.Parsed
Configuration:
CREATE TABLE hive.test_schema.test_table (
test varchar COMMENT '',
date varchar COMMENT 'Date partition formatted as YYYY-MM' WITH (partition_projection_format = 'yyyy-MM', partition_projection_interval = 28, partition_projection_interval_unit = 'DAYS', partition_projection_range = ARRAY['1970-01','NOW'], partition_projection_type = 'DATE')
)
COMMENT ''
WITH (
external_location = '',
format = 'PARQUET',
partition_projection_enabled = true,
partitioned_by = ARRAY['date']
)
Steps to Reproduce:
Add this test in io.trino.plugin.hive.projection.TestDateProjectionFactory. The functionality was successful in version 476, but experienced a failure in version 477.
@Test
void testYearMonthFormat()
{
Projection projection = new DateProjection("date", VARCHAR, ImmutableMap.<String, Object>builder()
.put(COLUMN_PROJECTION_FORMAT, "yyyy-MM")
.put(COLUMN_PROJECTION_RANGE, ImmutableList.of("2020-01", "2020-03"))
.put(COLUMN_PROJECTION_INTERVAL, 1)
.put(COLUMN_PROJECTION_INTERVAL_UNIT, ChronoUnit.DAYS)
.buildOrThrow());
assertThat(projection.getProjectedValues(Optional.empty())).contains("2020-01", "2020-02", "2020-03");
}
Was the removal of this functionality intentional? Is it something the community wants to restore? If the community wants it and no one is working on it, I offer to implement it. I can draft a proposal or a PR for review.
Related Issues: #27233
Trino version
477
Please describe the bug
Date partition projection using only year-month formats (e.g., yyyy-MM) stopped working in Trino 477.
I utilize partition_projection_format=yyyy-MM to query an external table with year-month partitioning. Although this configuration operated correctly in Trino 476, it became non-functional in version 477.
This is a regression introduced by commit d1ca4558e9d ("Refactor DateProjection to use DateTimeFormatter"), which replaced SimpleDateFormat with DateTimeFormatter but did not account for formats that don't include a day component.
Error message returned when executing a SELECT query on this table:
Configuration:
Steps to Reproduce:
Add this test in io.trino.plugin.hive.projection.TestDateProjectionFactory. The functionality was successful in version 476, but experienced a failure in version 477.
Was the removal of this functionality intentional? Is it something the community wants to restore? If the community wants it and no one is working on it, I offer to implement it. I can draft a proposal or a PR for review.
Related Issues: #27233