Repository navigation
feat(lance): support TIME type - #478
Merged
Merged
Conversation
lxy-9602
reviewed
Oct 28, 2026
SteNicholas
force-pushed
the
PAIMON-477
branch
from
October 28, 2026 06:33
b482b93 to
9877479
Compare
Paimon Java accepts TIME columns in Lance data files and writes them as time32[ms], but Paimon C++ rejected TIME in Lance schema validation, both at top level and nested in ARRAY or ROW. Accept TIME there, and create empty integer statistics for a TIME column in LanceStatsExtractor so that finalizing a Lance data file with one does not fail. Document TIME in the data types guide, which still listed it as not supported. Describe its time32[ms] mapping, how the declared precision is kept and which file formats read or write it, and state that only append-only tables support it and that it cannot be a partition or bucket key or be referenced by predicates.
SteNicholas
force-pushed
the
PAIMON-477
branch
from
October 28, 2026 06:39
9877479 to
123f0f8
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Purpose
Linked issue: close #477
Paimon Java accepts
TIMEcolumns in Lance data files(
LanceFileFormat.LanceRowTypeVisitor.visit(TimeType)) and writes them as ArrowTIMEMILLI(
time32[ms]) throughArrowFieldTypeConversion. Paimon C++ has representedTIMEastime32[ms]since #378, but rejected it for Lance:SchemaValidation::ValidateLanceDataField()had noTIME32case, so a TIME column, at toplevel or nested in ARRAY or ROW, failed with
Lance file format does not support type time32[ms].LanceStatsExtractor::CreateEmptyStats()had noTIME32case either, so lifting only thevalidation would still fail to finalize an append data file with a TIME column, with
cannot create empty Lance statistics for type time32[ms].This change:
TIME32inValidateLanceDataField(). The existing recursion covers TIME nested inARRAY and ROW, and
TableSchema::Create()still rejects non-millisecond units.TIME32inLanceStatsExtractor::CreateEmptyStats(),as
VortexStatsExtractordoes.paimon.time.precisionfieldmetadata of the table schema, and
LanceFileBatchReaderaligns each batch to the read type.Tests
SchemaValidationTest.TestLanceDataTypes: millisecond TIME at top level and inROW<ARRAY<TIME>>moves from the rejected to the accepted fields; second-unit TIME, top leveland nested, is still rejected.
LanceFileFormatTest.WriteThenReadSupportedTypes: adds a top-level TIME column andARRAY<TIME>,ROW<TIME>andROW<ARRAY<TIME>>columns declared with precisions 0, 3, 6 and9. The data covers 0 and 86399999, null and empty arrays, null elements and null ROW children,
and is read with batch sizes 1, 2 and 4. A batch imported directly from the reader checks that
the returned Arrow type keeps the read schema's field metadata, including
paimon.time.precision.LanceFileFormatTest.ExtractStatistics: a TIME column yields an empty statistics entry.TimeColumnWriteInteTest.TestAppendTimeColumnFinalize, generalized fromVortexTimeColumnWriteInteTest: append write, finalize and read of a TIME column for bothLance and Vortex.
ScanAndReadInteTest.TestLanceJavaCompatibilityandTestLancePythonCompatibility: thelance/append_java_compatandlance/append_python_compatfixtures are regenerated withPaimon Java and Paimon Python at the same commit as before (
63ffd40), addingf_time_0 TIME(0)andf_time_3 TIME(3)columns with 00:00:00, 23:59:59.999, 12:34:56.789and NULL values. All other columns, values, options and commits are unchanged. Both writers
store TIME in Lance as
time32[ms]without precision metadata, so C++ reads the declaredprecision from the table schema. The fixture READMEs list the new columns and tie every
writer-specific statement to the writer commit in their header.
API and Format
No API changes. No storage format changes: TIME is written to Lance as
time32[ms], as inPaimon Java.
Documentation
Yes.
docs/source/user_guide/data_types.rstno longer lists TIME as not supported. It describesthe
time32[ms]mapping, how the declared precision is kept inpaimon.time.precisionwhilevalues keep millisecond precision, and which file formats read or write TIME. A note states its
limitations: only append-only tables support TIME, primary-key tables support it neither as a
primary key nor as a value column, a TIME column cannot be a partition or bucket key, and
predicates cannot reference TIME columns.
Generative AI tooling
Generated-by: Claude Code 2.1.311 (Claude Opus 5.5)
🤖 Generated with Claude Code