Accept human-readable dates as TPCH column stats
Formatted dates were added in
but the reading code was dropped as "unused" during review process.
@@ -59,6 +59,7 @@ import io.airlift.tpch.TpchColumnType;
import io.airlift.tpch.TpchEntity;
import io.airlift.tpch.TpchTable;
+import java.time.LocalDate;
import java.util.List;
import java.util.Map;
import java.util.Optional;
@@ -387,6 +388,9 @@ public class TpchMetadata
if (columnType instanceof VarcharType) {
return Slices.utf8Slice((String) tpchValue);
}
+ if (tpchValue instanceof String && columnType.equals(DATE)) {
+ return LocalDate.parse((CharSequence) tpchValue).toEpochDay();
+ }
if (columnType.equals(BIGINT) || columnType.equals(INTEGER) || columnType.equals(DATE)) {
return ((Number) tpchValue).longValue();
}
