Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions paimon-python/pypaimon/common/options/core_options.py
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,14 @@ class CoreOptions:
"Options: none, input, full-compaction, lookup.")
)

CHANGELOG_FILE_FORMAT: ConfigOption[str] = (
ConfigOptions.key("changelog-file.format")
.string_type()
.no_default_value()
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is set as defined in the docs

.with_description("Specify the file format of changelog files. "
"Currently parquet, avro and orc are supported.")
)

MERGE_ENGINE: ConfigOption[MergeEngine] = (
ConfigOptions.key("merge-engine")
.enum_type(MergeEngine)
Expand Down Expand Up @@ -579,6 +587,9 @@ def deletion_vectors_enabled(self, default=None):
def changelog_producer(self, default=None):
return self.options.get(CoreOptions.CHANGELOG_PRODUCER, default)

def changelog_file_format(self, default=None):
return self.options.get(CoreOptions.CHANGELOG_FILE_FORMAT, default)

def merge_engine(self, default=None):
return self.options.get(CoreOptions.MERGE_ENGINE, default)

Expand Down
7 changes: 7 additions & 0 deletions paimon-python/pypaimon/schema/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,4 +92,11 @@ def from_pyarrow_schema(pa_schema: pa.Schema, partition_keys: Optional[List[str]
if primary_keys is not None:
raise ValueError("Blob type is not supported with primary key.")

changelog_producer = (options or {}).get(CoreOptions.CHANGELOG_PRODUCER.key(), 'none')
if changelog_producer != 'none' and not primary_keys:
raise ValueError(
f"Cannot set 'changelog-producer' to '{changelog_producer}' on a table without primary keys. "
f"Changelog producer requires primary keys to be defined."
)

return Schema(fields, partition_keys, primary_keys, options, comment)
1 change: 1 addition & 0 deletions paimon-python/pypaimon/tests/file_store_commit_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -437,6 +437,7 @@ def test_append_commit_inherits_index_manifest(
retry_result=None,
commit_kind="APPEND",
commit_entries=[commit_entry],
changelog_entries=[],
commit_identifier=11,
latest_snapshot=latest_snapshot
)
Expand Down
1 change: 1 addition & 0 deletions paimon-python/pypaimon/tests/reader_append_only_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -496,6 +496,7 @@ def test_commit_retry_filter(self):
RetryResult(None),
"APPEND",
commit_entries,
[],
BATCH_COMMIT_IDENTIFIER,
latest_snapshot)
self.assertTrue(success.is_success())
Expand Down
Loading
Loading