deltacat 2.0__py3-none-any.whl → 2.0.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- deltacat/__init__.py +117 -18
- deltacat/api.py +536 -126
- deltacat/aws/constants.py +0 -23
- deltacat/aws/s3u.py +4 -631
- deltacat/benchmarking/benchmark_engine.py +4 -2
- deltacat/benchmarking/conftest.py +1 -19
- deltacat/benchmarking/test_benchmark_pipeline.py +6 -4
- deltacat/catalog/__init__.py +64 -5
- deltacat/catalog/delegate.py +445 -63
- deltacat/catalog/interface.py +188 -62
- deltacat/catalog/main/impl.py +2444 -282
- deltacat/catalog/model/catalog.py +208 -113
- deltacat/catalog/model/properties.py +63 -24
- deltacat/compute/__init__.py +14 -0
- deltacat/compute/compactor/compaction_session.py +97 -75
- deltacat/compute/compactor/model/compact_partition_params.py +75 -30
- deltacat/compute/compactor/model/compaction_session_audit_info.py +17 -0
- deltacat/compute/compactor/model/round_completion_info.py +16 -6
- deltacat/compute/compactor/repartition_session.py +8 -21
- deltacat/compute/compactor/steps/hash_bucket.py +5 -5
- deltacat/compute/compactor/steps/materialize.py +9 -7
- deltacat/compute/compactor/steps/repartition.py +12 -11
- deltacat/compute/compactor/utils/io.py +6 -5
- deltacat/compute/compactor/utils/round_completion_reader.py +117 -0
- deltacat/compute/compactor/utils/system_columns.py +3 -1
- deltacat/compute/compactor_v2/compaction_session.py +17 -14
- deltacat/compute/compactor_v2/constants.py +30 -1
- deltacat/compute/compactor_v2/model/evaluate_compaction_result.py +0 -1
- deltacat/compute/compactor_v2/model/hash_bucket_input.py +9 -3
- deltacat/compute/compactor_v2/model/merge_file_group.py +5 -2
- deltacat/compute/compactor_v2/model/merge_input.py +33 -8
- deltacat/compute/compactor_v2/private/compaction_utils.py +167 -68
- deltacat/compute/compactor_v2/steps/hash_bucket.py +5 -2
- deltacat/compute/compactor_v2/steps/merge.py +267 -55
- deltacat/compute/compactor_v2/utils/content_type_params.py +34 -6
- deltacat/compute/compactor_v2/utils/dedupe.py +1 -1
- deltacat/compute/compactor_v2/utils/delta.py +5 -3
- deltacat/compute/compactor_v2/utils/io.py +11 -4
- deltacat/compute/compactor_v2/utils/merge.py +15 -2
- deltacat/compute/compactor_v2/utils/primary_key_index.py +28 -4
- deltacat/compute/compactor_v2/utils/task_options.py +45 -33
- deltacat/compute/converter/constants.py +5 -0
- deltacat/compute/converter/converter_session.py +207 -52
- deltacat/compute/converter/model/convert_input.py +43 -16
- deltacat/compute/converter/model/convert_input_files.py +33 -16
- deltacat/compute/converter/model/convert_result.py +80 -0
- deltacat/compute/converter/model/converter_session_params.py +64 -19
- deltacat/compute/converter/pyiceberg/catalog.py +21 -18
- deltacat/compute/converter/pyiceberg/overrides.py +193 -65
- deltacat/compute/converter/pyiceberg/update_snapshot_overrides.py +148 -100
- deltacat/compute/converter/steps/convert.py +230 -75
- deltacat/compute/converter/steps/dedupe.py +46 -12
- deltacat/compute/converter/utils/convert_task_options.py +66 -22
- deltacat/compute/converter/utils/converter_session_utils.py +126 -60
- deltacat/compute/converter/utils/iceberg_columns.py +13 -8
- deltacat/compute/converter/utils/io.py +173 -13
- deltacat/compute/converter/utils/s3u.py +42 -27
- deltacat/compute/janitor.py +205 -0
- deltacat/compute/jobs/client.py +417 -0
- deltacat/compute/resource_estimation/delta.py +38 -6
- deltacat/compute/resource_estimation/model.py +8 -0
- deltacat/constants.py +49 -6
- deltacat/docs/autogen/schema/inference/generate_type_mappings.py +687 -0
- deltacat/docs/autogen/schema/inference/parse_json_type_mappings.py +673 -0
- deltacat/env.py +10 -0
- deltacat/examples/basic_logging.py +6 -6
- deltacat/examples/compactor/aws/__init__.py +1 -0
- deltacat/examples/compactor/bootstrap.py +863 -0
- deltacat/examples/compactor/compactor.py +373 -0
- deltacat/examples/compactor/explorer.py +473 -0
- deltacat/examples/compactor/gcp/__init__.py +1 -0
- deltacat/examples/compactor/job_runner.py +439 -0
- deltacat/examples/compactor/utils/__init__.py +1 -0
- deltacat/examples/compactor/utils/common.py +261 -0
- deltacat/examples/experimental/iceberg/converter/beam/app.py +226 -0
- deltacat/examples/experimental/iceberg/converter/beam/main.py +133 -0
- deltacat/examples/experimental/iceberg/converter/beam/test_workflow.py +113 -0
- deltacat/examples/experimental/iceberg/converter/beam/utils/__init__.py +3 -0
- deltacat/examples/experimental/iceberg/converter/beam/utils/common.py +174 -0
- deltacat/examples/experimental/iceberg/converter/beam/utils/spark.py +263 -0
- deltacat/examples/{iceberg → experimental/iceberg}/iceberg_bucket_writer.py +66 -21
- deltacat/examples/{iceberg → experimental/iceberg}/iceberg_reader.py +2 -4
- deltacat/examples/hello_world.py +4 -2
- deltacat/examples/indexer/indexer.py +163 -0
- deltacat/examples/indexer/job_runner.py +198 -0
- deltacat/exceptions.py +66 -4
- deltacat/experimental/catalog/iceberg/__init__.py +6 -0
- deltacat/{catalog → experimental/catalog}/iceberg/iceberg_catalog_config.py +1 -1
- deltacat/{catalog → experimental/catalog}/iceberg/impl.py +43 -12
- deltacat/{catalog → experimental/catalog}/iceberg/overrides.py +12 -14
- deltacat/experimental/compatibility/backfill_locator_to_id_mappings.py +201 -0
- deltacat/experimental/converter_agent/__init__.py +0 -0
- deltacat/experimental/converter_agent/beam/__init__.py +0 -0
- deltacat/experimental/converter_agent/beam/managed.py +173 -0
- deltacat/experimental/converter_agent/table_monitor.py +479 -0
- deltacat/experimental/daft/__init__.py +4 -0
- deltacat/experimental/daft/daft_catalog.py +229 -0
- deltacat/experimental/storage/__init__.py +0 -0
- deltacat/experimental/storage/iceberg/__init__.py +0 -0
- deltacat/experimental/storage/iceberg/iceberg_scan_planner.py +129 -0
- deltacat/{storage → experimental/storage}/iceberg/impl.py +6 -4
- deltacat/{storage → experimental/storage}/iceberg/model.py +7 -3
- deltacat/experimental/storage/iceberg/visitor.py +119 -0
- deltacat/experimental/storage/rivulet/__init__.py +11 -0
- deltacat/experimental/storage/rivulet/arrow/__init__.py +0 -0
- deltacat/{storage → experimental/storage}/rivulet/arrow/serializer.py +7 -4
- deltacat/{storage → experimental/storage}/rivulet/dataset.py +13 -12
- deltacat/{storage → experimental/storage}/rivulet/dataset_executor.py +12 -20
- deltacat/experimental/storage/rivulet/feather/__init__.py +7 -0
- deltacat/{storage → experimental/storage}/rivulet/feather/file_reader.py +7 -5
- deltacat/{storage → experimental/storage}/rivulet/feather/serializer.py +4 -4
- deltacat/experimental/storage/rivulet/fs/__init__.py +0 -0
- deltacat/{storage → experimental/storage}/rivulet/fs/file_provider.py +3 -3
- deltacat/{storage → experimental/storage}/rivulet/fs/file_store.py +2 -2
- deltacat/{storage → experimental/storage}/rivulet/fs/output_file.py +1 -1
- deltacat/{storage → experimental/storage}/rivulet/logical_plan.py +4 -4
- deltacat/experimental/storage/rivulet/metastore/__init__.py +0 -0
- deltacat/{storage → experimental/storage}/rivulet/metastore/delta.py +1 -3
- deltacat/{storage → experimental/storage}/rivulet/metastore/json_sst.py +3 -3
- deltacat/{storage → experimental/storage}/rivulet/metastore/sst.py +2 -2
- deltacat/{storage → experimental/storage}/rivulet/metastore/sst_interval_tree.py +3 -3
- deltacat/experimental/storage/rivulet/parquet/__init__.py +7 -0
- deltacat/experimental/storage/rivulet/parquet/data_reader.py +0 -0
- deltacat/{storage → experimental/storage}/rivulet/parquet/file_reader.py +7 -5
- deltacat/{storage → experimental/storage}/rivulet/parquet/serializer.py +4 -4
- deltacat/experimental/storage/rivulet/reader/__init__.py +0 -0
- deltacat/{storage → experimental/storage}/rivulet/reader/block_scanner.py +20 -9
- deltacat/{storage → experimental/storage}/rivulet/reader/data_reader.py +3 -3
- deltacat/{storage → experimental/storage}/rivulet/reader/data_scan.py +5 -3
- deltacat/{storage → experimental/storage}/rivulet/reader/dataset_metastore.py +7 -6
- deltacat/{storage → experimental/storage}/rivulet/reader/dataset_reader.py +8 -6
- deltacat/{storage → experimental/storage}/rivulet/reader/pyarrow_data_reader.py +4 -1
- deltacat/{storage → experimental/storage}/rivulet/reader/reader_type_registrar.py +4 -4
- deltacat/experimental/storage/rivulet/schema/__init__.py +0 -0
- deltacat/{storage → experimental/storage}/rivulet/schema/schema.py +1 -1
- deltacat/{storage → experimental/storage}/rivulet/serializer.py +1 -1
- deltacat/{storage → experimental/storage}/rivulet/serializer_factory.py +9 -5
- deltacat/experimental/storage/rivulet/shard/__init__.py +0 -0
- deltacat/experimental/storage/rivulet/shard/range_shard.py +129 -0
- deltacat/experimental/storage/rivulet/writer/__init__.py +0 -0
- deltacat/{storage → experimental/storage}/rivulet/writer/memtable_dataset_writer.py +20 -9
- deltacat/io/__init__.py +13 -0
- deltacat/io/dataset/__init__.py +0 -0
- deltacat/io/dataset/deltacat_dataset.py +91 -0
- deltacat/io/datasink/__init__.py +0 -0
- deltacat/io/datasink/deltacat_datasink.py +207 -0
- deltacat/io/datasource/__init__.py +0 -0
- deltacat/io/datasource/deltacat_datasource.py +579 -0
- deltacat/io/reader/__init__.py +0 -0
- deltacat/io/reader/deltacat_read_api.py +172 -0
- deltacat/storage/__init__.py +22 -2
- deltacat/storage/interface.py +54 -32
- deltacat/storage/main/impl.py +1494 -541
- deltacat/storage/model/delta.py +27 -3
- deltacat/storage/model/expression/__init__.py +47 -0
- deltacat/storage/model/expression/expression.py +656 -0
- deltacat/storage/model/expression/visitor.py +248 -0
- deltacat/storage/model/locator.py +6 -12
- deltacat/storage/model/manifest.py +231 -6
- deltacat/storage/model/metafile.py +224 -119
- deltacat/storage/model/namespace.py +8 -1
- deltacat/storage/model/partition.py +117 -42
- deltacat/storage/model/scan/push_down.py +32 -5
- deltacat/storage/model/schema.py +2427 -159
- deltacat/storage/model/shard.py +6 -2
- deltacat/storage/model/sort_key.py +40 -0
- deltacat/storage/model/stream.py +9 -2
- deltacat/storage/model/table.py +12 -1
- deltacat/storage/model/table_version.py +11 -0
- deltacat/storage/model/transaction.py +1184 -208
- deltacat/storage/model/transform.py +81 -2
- deltacat/storage/model/types.py +53 -29
- deltacat/storage/util/__init__.py +0 -0
- deltacat/storage/util/scan_planner.py +26 -0
- deltacat/tests/_io/reader/__init__.py +0 -0
- deltacat/tests/_io/reader/test_deltacat_read_api.py +0 -0
- deltacat/tests/_io/test_cloudpickle_bug_fix.py +8 -4
- deltacat/tests/aws/test_s3u.py +2 -31
- deltacat/tests/catalog/data/__init__.py +0 -0
- deltacat/tests/catalog/main/__init__.py +0 -0
- deltacat/tests/catalog/main/test_catalog_impl_namespace_operations.py +130 -0
- deltacat/tests/catalog/main/test_catalog_impl_table_operations.py +1972 -0
- deltacat/tests/catalog/model/__init__.py +0 -0
- deltacat/tests/catalog/model/test_table_definition.py +16 -0
- deltacat/tests/catalog/test_catalogs.py +103 -106
- deltacat/tests/catalog/test_default_catalog_impl.py +12152 -72
- deltacat/tests/compute/compact_partition_test_cases.py +35 -8
- deltacat/tests/compute/compactor/steps/test_repartition.py +12 -12
- deltacat/tests/compute/compactor/utils/test_io.py +124 -120
- deltacat/tests/compute/compactor/utils/test_round_completion_reader.py +254 -0
- deltacat/tests/compute/compactor_v2/test_compaction_session.py +423 -312
- deltacat/tests/compute/compactor_v2/utils/test_content_type_params.py +266 -0
- deltacat/tests/compute/compactor_v2/utils/test_primary_key_index.py +45 -0
- deltacat/tests/compute/compactor_v2/utils/test_task_options.py +270 -1
- deltacat/tests/compute/conftest.py +8 -44
- deltacat/tests/compute/converter/test_convert_session.py +697 -349
- deltacat/tests/compute/converter/utils.py +15 -6
- deltacat/tests/compute/resource_estimation/test_delta.py +145 -79
- deltacat/tests/compute/test_compact_partition_incremental.py +103 -70
- deltacat/tests/compute/test_compact_partition_multiple_rounds.py +89 -66
- deltacat/tests/compute/test_compact_partition_params.py +13 -8
- deltacat/tests/compute/test_compact_partition_rebase.py +77 -62
- deltacat/tests/compute/test_compact_partition_rebase_then_incremental.py +263 -193
- deltacat/tests/compute/test_janitor.py +236 -0
- deltacat/tests/compute/test_util_common.py +716 -43
- deltacat/tests/compute/test_util_constant.py +0 -1
- deltacat/tests/{storage/conftest.py → conftest.py} +1 -1
- deltacat/tests/daft/__init__.py +0 -0
- deltacat/tests/daft/test_model.py +97 -0
- deltacat/tests/experimental/__init__.py +1 -0
- deltacat/tests/experimental/catalog/__init__.py +0 -0
- deltacat/tests/experimental/catalog/iceberg/__init__.py +0 -0
- deltacat/tests/experimental/catalog/iceberg/test_iceberg_catalog.py +71 -0
- deltacat/tests/experimental/compatibility/__init__.py +1 -0
- deltacat/tests/experimental/compatibility/test_backfill_locator_to_id_mappings.py +582 -0
- deltacat/tests/experimental/daft/__init__.py +0 -0
- deltacat/tests/experimental/daft/test_deltacat_daft_integration.py +136 -0
- deltacat/tests/experimental/storage/__init__.py +0 -0
- deltacat/tests/experimental/storage/rivulet/__init__.py +0 -0
- deltacat/tests/{storage → experimental/storage}/rivulet/conftest.py +3 -3
- deltacat/tests/experimental/storage/rivulet/fs/__init__.py +0 -0
- deltacat/tests/{storage → experimental/storage}/rivulet/fs/test_file_location_provider.py +3 -2
- deltacat/tests/experimental/storage/rivulet/reader/__init__.py +0 -0
- deltacat/tests/experimental/storage/rivulet/reader/query_expression.py +80 -0
- deltacat/tests/experimental/storage/rivulet/reader/test_data_scan.py +119 -0
- deltacat/tests/experimental/storage/rivulet/reader/test_dataset_metastore.py +71 -0
- deltacat/tests/experimental/storage/rivulet/schema/__init__.py +0 -0
- deltacat/tests/{storage → experimental/storage}/rivulet/schema/test_schema.py +1 -1
- deltacat/tests/experimental/storage/rivulet/shard/__init__.py +0 -0
- deltacat/tests/experimental/storage/rivulet/shard/test_range_shard.py +162 -0
- deltacat/tests/{storage → experimental/storage}/rivulet/test_dataset.py +6 -4
- deltacat/tests/{storage → experimental/storage}/rivulet/test_manifest.py +5 -5
- deltacat/tests/{storage → experimental/storage}/rivulet/test_sst_interval_tree.py +5 -5
- deltacat/tests/{storage → experimental/storage}/rivulet/test_utils.py +8 -6
- deltacat/tests/experimental/storage/rivulet/writer/__init__.py +0 -0
- deltacat/tests/{storage → experimental/storage}/rivulet/writer/test_dataset_write_then_read.py +11 -9
- deltacat/tests/{storage → experimental/storage}/rivulet/writer/test_dataset_writer.py +2 -2
- deltacat/tests/{storage → experimental/storage}/rivulet/writer/test_memtable_dataset_writer.py +7 -7
- deltacat/tests/storage/main/test_main_storage.py +6900 -95
- deltacat/tests/storage/model/test_expression.py +327 -0
- deltacat/tests/storage/model/test_manifest.py +129 -0
- deltacat/tests/storage/model/test_metafile_io.py +78 -173
- deltacat/tests/storage/model/test_partition_scheme.py +85 -0
- deltacat/tests/storage/model/test_schema.py +171 -0
- deltacat/tests/storage/model/test_schema_update.py +1925 -0
- deltacat/tests/storage/model/test_shard.py +3 -1
- deltacat/tests/storage/model/test_sort_scheme.py +90 -0
- deltacat/tests/storage/model/test_transaction.py +393 -48
- deltacat/tests/storage/model/test_transaction_history.py +886 -0
- deltacat/tests/test_deltacat_api.py +1036 -11
- deltacat/tests/test_exceptions.py +9 -5
- deltacat/tests/test_utils/pyarrow.py +52 -21
- deltacat/tests/test_utils/storage.py +23 -34
- deltacat/tests/types/__init__.py +0 -0
- deltacat/tests/types/test_tables.py +104 -0
- deltacat/tests/utils/exceptions.py +22 -0
- deltacat/tests/utils/main_deltacat_storage_mock.py +31 -0
- deltacat/tests/utils/ray_utils/test_dataset.py +123 -5
- deltacat/tests/utils/test_daft.py +121 -31
- deltacat/tests/utils/test_numpy.py +1193 -0
- deltacat/tests/utils/test_pandas.py +1106 -0
- deltacat/tests/utils/test_polars.py +1040 -0
- deltacat/tests/utils/test_pyarrow.py +1370 -89
- deltacat/types/media.py +345 -37
- deltacat/types/tables.py +2344 -46
- deltacat/utils/arguments.py +33 -1
- deltacat/utils/daft.py +824 -40
- deltacat/utils/export.py +3 -1
- deltacat/utils/filesystem.py +139 -9
- deltacat/utils/metafile_locator.py +2 -1
- deltacat/utils/numpy.py +118 -26
- deltacat/utils/pandas.py +577 -48
- deltacat/utils/polars.py +759 -0
- deltacat/utils/pyarrow.py +1373 -192
- deltacat/utils/ray_utils/concurrency.py +1 -1
- deltacat/utils/ray_utils/dataset.py +101 -10
- deltacat/utils/ray_utils/runtime.py +56 -4
- deltacat/utils/reader_compatibility_mapping.py +3083 -0
- deltacat/utils/url.py +1325 -0
- deltacat-2.0.0.dist-info/METADATA +1163 -0
- deltacat-2.0.0.dist-info/RECORD +439 -0
- {deltacat-2.0.dist-info → deltacat-2.0.0.dist-info}/WHEEL +1 -1
- deltacat/catalog/iceberg/__init__.py +0 -4
- deltacat/compute/compactor/utils/round_completion_file.py +0 -97
- deltacat/compute/merge_on_read/__init__.py +0 -4
- deltacat/compute/merge_on_read/daft.py +0 -40
- deltacat/compute/merge_on_read/model/merge_on_read_params.py +0 -66
- deltacat/compute/merge_on_read/utils/delta.py +0 -42
- deltacat/examples/common/fixtures.py +0 -15
- deltacat/storage/iceberg/iceberg_scan_planner.py +0 -28
- deltacat/storage/rivulet/__init__.py +0 -11
- deltacat/storage/rivulet/feather/__init__.py +0 -5
- deltacat/storage/rivulet/parquet/__init__.py +0 -5
- deltacat/tests/compute/compactor/utils/test_round_completion_file.py +0 -231
- deltacat/tests/compute/test_util_create_table_deltas_repo.py +0 -388
- deltacat/tests/local_deltacat_storage/__init__.py +0 -1235
- deltacat/tests/local_deltacat_storage/exceptions.py +0 -10
- deltacat/utils/s3fs.py +0 -21
- deltacat-2.0.dist-info/METADATA +0 -65
- deltacat-2.0.dist-info/RECORD +0 -347
- /deltacat/compute/{merge_on_read/model → jobs}/__init__.py +0 -0
- /deltacat/{compute/merge_on_read/utils → docs}/__init__.py +0 -0
- /deltacat/{examples/common → docs/autogen}/__init__.py +0 -0
- /deltacat/{examples/iceberg → docs/autogen/schema}/__init__.py +0 -0
- /deltacat/{storage/iceberg → docs/autogen/schema/inference}/__init__.py +0 -0
- /deltacat/{storage/rivulet/arrow → examples/compactor}/__init__.py +0 -0
- /deltacat/{storage/rivulet/fs → examples/experimental}/__init__.py +0 -0
- /deltacat/{storage/rivulet/metastore → examples/experimental/iceberg}/__init__.py +0 -0
- /deltacat/{storage/rivulet/reader → examples/experimental/iceberg/converter}/__init__.py +0 -0
- /deltacat/{storage/rivulet/schema → examples/experimental/iceberg/converter/beam}/__init__.py +0 -0
- /deltacat/{storage/rivulet/writer → examples/indexer}/__init__.py +0 -0
- /deltacat/{tests/storage/rivulet → examples/indexer/aws}/__init__.py +0 -0
- /deltacat/{tests/storage/rivulet/fs → examples/indexer/gcp}/__init__.py +0 -0
- /deltacat/{tests/storage/rivulet/schema → experimental}/__init__.py +0 -0
- /deltacat/{tests/storage/rivulet/writer → experimental/catalog}/__init__.py +0 -0
- /deltacat/{storage/rivulet/parquet/data_reader.py → experimental/compatibility/__init__.py} +0 -0
- /deltacat/{storage → experimental/storage}/rivulet/fs/input_file.py +0 -0
- /deltacat/{storage → experimental/storage}/rivulet/mvp/Table.py +0 -0
- /deltacat/{storage → experimental/storage}/rivulet/mvp/__init__.py +0 -0
- /deltacat/{storage → experimental/storage}/rivulet/reader/query_expression.py +0 -0
- /deltacat/{storage → experimental/storage}/rivulet/schema/datatype.py +0 -0
- /deltacat/{storage → experimental/storage}/rivulet/writer/dataset_writer.py +0 -0
- {deltacat-2.0.dist-info → deltacat-2.0.0.dist-info/licenses}/LICENSE +0 -0
- {deltacat-2.0.dist-info → deltacat-2.0.0.dist-info}/top_level.txt +0 -0
deltacat/types/media.py
CHANGED
@@ -1,30 +1,45 @@
|
|
1
1
|
from enum import Enum
|
2
|
-
from typing import
|
2
|
+
from typing import Set, Dict
|
3
3
|
|
4
4
|
|
5
5
|
class ContentType(str, Enum):
|
6
|
-
|
7
|
-
|
8
|
-
|
6
|
+
"""
|
7
|
+
Enumeration used to resolve a file's entity-body Media Type (formerly known
|
8
|
+
as MIME type). All content types here are writeable by at least one
|
9
|
+
:class:`deltacat.types.media.DatasetType`. The Media Type is used as the
|
10
|
+
content type of each :class:`deltacat.storage.model.manifest.ManifestEntry`
|
11
|
+
written by that dataset type.
|
12
|
+
|
13
|
+
https://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.17
|
14
|
+
|
15
|
+
https://www.iana.org/assignments/media-types/media-types.xhtml
|
16
|
+
"""
|
9
17
|
|
10
18
|
# IANA registered types
|
19
|
+
AVRO = "application/avro"
|
20
|
+
BINARY = "application/octet-stream"
|
11
21
|
CSV = "text/csv"
|
12
22
|
JSON = "application/json"
|
13
23
|
|
14
24
|
# unregistered types
|
15
|
-
TSV = "text/tsv"
|
16
|
-
PSV = "text/psv"
|
17
|
-
PARQUET = "application/parquet"
|
18
|
-
ORC = "application/orc"
|
19
25
|
FEATHER = "application/feather"
|
26
|
+
ORC = "application/orc"
|
27
|
+
PARQUET = "application/parquet"
|
28
|
+
PSV = "text/psv"
|
29
|
+
TSV = "text/tsv"
|
20
30
|
UNESCAPED_TSV = "application/x-amzn-unescaped-tsv"
|
21
|
-
ION = "application/x-amzn-ion"
|
22
31
|
|
23
32
|
|
24
33
|
class ContentEncoding(str, Enum):
|
25
|
-
|
26
|
-
|
27
|
-
|
34
|
+
"""
|
35
|
+
Enumeration used as a modifier for :class:`deltacat.types.media.ContentType`
|
36
|
+
to indicate that additional encodings have been applied to the entity-body
|
37
|
+
Media Type.
|
38
|
+
|
39
|
+
https://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.11
|
40
|
+
|
41
|
+
http://www.iana.org/assignments/http-parameters/http-parameters.xhtml#content-coding
|
42
|
+
"""
|
28
43
|
|
29
44
|
# IANA registered encodings
|
30
45
|
GZIP = "gzip"
|
@@ -37,26 +52,45 @@ class ContentEncoding(str, Enum):
|
|
37
52
|
SNAPPY = "snappy"
|
38
53
|
|
39
54
|
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
55
|
+
# Map of file extensions to content types
|
56
|
+
EXT_TO_CONTENT_TYPE: Dict[str, ContentType] = {
|
57
|
+
".parquet": ContentType.PARQUET,
|
58
|
+
".pq": ContentType.PARQUET,
|
59
|
+
".csv": ContentType.CSV,
|
60
|
+
".tsv": ContentType.TSV,
|
61
|
+
".psv": ContentType.PSV,
|
62
|
+
".json": ContentType.JSON,
|
63
|
+
".feather": ContentType.FEATHER,
|
64
|
+
".avro": ContentType.AVRO,
|
65
|
+
".orc": ContentType.ORC,
|
66
|
+
}
|
51
67
|
|
52
|
-
|
53
|
-
|
68
|
+
# Inverse map of content types to file extensions
|
69
|
+
CONTENT_TYPE_TO_EXT: Dict[ContentType, str] = {
|
70
|
+
v: k for k, v in EXT_TO_CONTENT_TYPE.items()
|
71
|
+
}
|
54
72
|
|
73
|
+
# Map of file extensions to content encodings
|
74
|
+
EXT_TO_CONTENT_ENCODING: Dict[str, ContentEncoding] = {
|
75
|
+
".gz": ContentEncoding.GZIP,
|
76
|
+
".bz2": ContentEncoding.BZIP2,
|
77
|
+
".zst": ContentEncoding.ZSTD,
|
78
|
+
".sz": ContentEncoding.SNAPPY,
|
79
|
+
".zz": ContentEncoding.DEFLATE,
|
80
|
+
".zip": ContentEncoding.DEFLATE,
|
81
|
+
}
|
55
82
|
|
56
|
-
|
57
|
-
|
58
|
-
|
83
|
+
# Inverse map of content encodings to file extensions
|
84
|
+
CONTENT_ENCODING_TO_EXT: Dict[ContentEncoding, str] = {
|
85
|
+
v: k for k, v in EXT_TO_CONTENT_ENCODING.items()
|
86
|
+
}
|
59
87
|
|
88
|
+
SCHEMA_CONTENT_TYPES: Set[str] = {
|
89
|
+
ContentType.PARQUET.value,
|
90
|
+
ContentType.ORC.value,
|
91
|
+
ContentType.FEATHER.value,
|
92
|
+
ContentType.AVRO.value,
|
93
|
+
}
|
60
94
|
|
61
95
|
DELIMITED_TEXT_CONTENT_TYPES: Set[str] = {
|
62
96
|
ContentType.UNESCAPED_TSV.value,
|
@@ -73,6 +107,7 @@ TABULAR_CONTENT_TYPES: Set[str] = {
|
|
73
107
|
ContentType.PARQUET.value,
|
74
108
|
ContentType.ORC.value,
|
75
109
|
ContentType.FEATHER.value,
|
110
|
+
ContentType.AVRO.value,
|
76
111
|
}
|
77
112
|
|
78
113
|
EXPLICIT_COMPRESSION_CONTENT_TYPES: Set[str] = {
|
@@ -83,13 +118,286 @@ EXPLICIT_COMPRESSION_CONTENT_TYPES: Set[str] = {
|
|
83
118
|
ContentType.JSON.value,
|
84
119
|
}
|
85
120
|
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
121
|
+
|
122
|
+
class DatasetType(str, Enum):
|
123
|
+
"""
|
124
|
+
Enumeration used to identify the in-memory local or distributed dataset
|
125
|
+
to be used for file IO, queries, and data transformation. Typically used
|
126
|
+
together with :class:`deltacat.types.media.DatastoreType` to resolve the
|
127
|
+
compute layer that will be responsible for reading, transforming, and
|
128
|
+
writing data to a given datastore.
|
129
|
+
"""
|
130
|
+
|
131
|
+
# local
|
132
|
+
NUMPY = "numpy" # numpy.ndarray
|
133
|
+
PANDAS = "pandas" # pandas.DataFrame
|
134
|
+
POLARS = "polars" # polars.DataFrame
|
135
|
+
PYARROW = "pyarrow" # pyarrow.Table
|
136
|
+
PYARROW_PARQUET = "pyarrow_parquet" # pyarrow.parquet.ParquetFile
|
137
|
+
|
138
|
+
# distributed
|
139
|
+
DAFT = "daft" # daft.DataFrame
|
140
|
+
RAY_DATASET = "ray_dataset" # ray.data.Dataset
|
141
|
+
|
142
|
+
@staticmethod
|
143
|
+
def distributed():
|
144
|
+
return {
|
145
|
+
DatasetType.DAFT,
|
146
|
+
DatasetType.RAY_DATASET,
|
147
|
+
}
|
148
|
+
|
149
|
+
@staticmethod
|
150
|
+
def local():
|
151
|
+
return {
|
152
|
+
DatasetType.NUMPY,
|
153
|
+
DatasetType.PANDAS,
|
154
|
+
DatasetType.POLARS,
|
155
|
+
DatasetType.PYARROW,
|
156
|
+
DatasetType.PYARROW_PARQUET,
|
157
|
+
}
|
158
|
+
|
159
|
+
def readable_content_types(self) -> Set[ContentType]:
|
160
|
+
# if this is DAFT then it can read PARQUET, JSON, and CSV
|
161
|
+
if self == DatasetType.DAFT:
|
162
|
+
return {
|
163
|
+
ContentType.PARQUET,
|
164
|
+
ContentType.JSON,
|
165
|
+
ContentType.CSV,
|
166
|
+
ContentType.PSV,
|
167
|
+
ContentType.TSV,
|
168
|
+
ContentType.UNESCAPED_TSV,
|
169
|
+
}
|
170
|
+
if self == DatasetType.RAY_DATASET:
|
171
|
+
return {
|
172
|
+
ContentType.CSV,
|
173
|
+
ContentType.TSV,
|
174
|
+
ContentType.UNESCAPED_TSV,
|
175
|
+
ContentType.PSV,
|
176
|
+
ContentType.PARQUET,
|
177
|
+
ContentType.JSON,
|
178
|
+
ContentType.AVRO,
|
179
|
+
ContentType.ORC,
|
180
|
+
ContentType.FEATHER,
|
181
|
+
}
|
182
|
+
if self == DatasetType.PYARROW:
|
183
|
+
return {
|
184
|
+
ContentType.CSV,
|
185
|
+
ContentType.TSV,
|
186
|
+
ContentType.UNESCAPED_TSV,
|
187
|
+
ContentType.PSV,
|
188
|
+
ContentType.PARQUET,
|
189
|
+
ContentType.FEATHER,
|
190
|
+
ContentType.JSON,
|
191
|
+
ContentType.AVRO,
|
192
|
+
ContentType.ORC,
|
193
|
+
}
|
194
|
+
if self == DatasetType.PANDAS:
|
195
|
+
return {
|
196
|
+
ContentType.CSV,
|
197
|
+
ContentType.TSV,
|
198
|
+
ContentType.UNESCAPED_TSV,
|
199
|
+
ContentType.PSV,
|
200
|
+
ContentType.PARQUET,
|
201
|
+
ContentType.FEATHER,
|
202
|
+
ContentType.JSON,
|
203
|
+
ContentType.AVRO,
|
204
|
+
ContentType.ORC,
|
205
|
+
}
|
206
|
+
if self == DatasetType.POLARS:
|
207
|
+
return {
|
208
|
+
ContentType.CSV,
|
209
|
+
ContentType.TSV,
|
210
|
+
ContentType.UNESCAPED_TSV,
|
211
|
+
ContentType.PSV,
|
212
|
+
ContentType.PARQUET,
|
213
|
+
ContentType.FEATHER,
|
214
|
+
ContentType.JSON,
|
215
|
+
ContentType.AVRO,
|
216
|
+
ContentType.ORC,
|
217
|
+
}
|
218
|
+
if self == DatasetType.NUMPY:
|
219
|
+
return {
|
220
|
+
ContentType.CSV,
|
221
|
+
ContentType.TSV,
|
222
|
+
ContentType.UNESCAPED_TSV,
|
223
|
+
ContentType.PSV,
|
224
|
+
ContentType.PARQUET,
|
225
|
+
ContentType.FEATHER,
|
226
|
+
ContentType.JSON,
|
227
|
+
ContentType.AVRO,
|
228
|
+
ContentType.ORC,
|
229
|
+
}
|
230
|
+
if self == DatasetType.PYARROW_PARQUET:
|
231
|
+
return {ContentType.PARQUET}
|
232
|
+
raise ValueError(f"No readable content types for {self}")
|
233
|
+
|
234
|
+
def writable_content_types(self) -> Set[ContentType]:
|
235
|
+
if self == DatasetType.PYARROW:
|
236
|
+
return {
|
237
|
+
ContentType.CSV,
|
238
|
+
ContentType.TSV,
|
239
|
+
ContentType.UNESCAPED_TSV,
|
240
|
+
ContentType.PSV,
|
241
|
+
ContentType.PARQUET,
|
242
|
+
ContentType.FEATHER,
|
243
|
+
ContentType.JSON,
|
244
|
+
ContentType.AVRO,
|
245
|
+
ContentType.ORC,
|
246
|
+
}
|
247
|
+
if self == DatasetType.PANDAS:
|
248
|
+
return {
|
249
|
+
ContentType.CSV,
|
250
|
+
ContentType.TSV,
|
251
|
+
ContentType.UNESCAPED_TSV,
|
252
|
+
ContentType.PSV,
|
253
|
+
ContentType.PARQUET,
|
254
|
+
ContentType.FEATHER,
|
255
|
+
ContentType.JSON,
|
256
|
+
ContentType.AVRO,
|
257
|
+
ContentType.ORC,
|
258
|
+
}
|
259
|
+
if self == DatasetType.POLARS:
|
260
|
+
return {
|
261
|
+
ContentType.CSV,
|
262
|
+
ContentType.TSV,
|
263
|
+
ContentType.UNESCAPED_TSV,
|
264
|
+
ContentType.PSV,
|
265
|
+
ContentType.PARQUET,
|
266
|
+
ContentType.FEATHER,
|
267
|
+
ContentType.JSON,
|
268
|
+
ContentType.AVRO,
|
269
|
+
ContentType.ORC,
|
270
|
+
}
|
271
|
+
if self == DatasetType.RAY_DATASET:
|
272
|
+
return {
|
273
|
+
ContentType.CSV,
|
274
|
+
ContentType.TSV,
|
275
|
+
ContentType.UNESCAPED_TSV,
|
276
|
+
ContentType.PSV,
|
277
|
+
ContentType.PARQUET,
|
278
|
+
ContentType.JSON,
|
279
|
+
}
|
280
|
+
if self == DatasetType.DAFT:
|
281
|
+
return {
|
282
|
+
ContentType.CSV,
|
283
|
+
ContentType.TSV,
|
284
|
+
ContentType.UNESCAPED_TSV,
|
285
|
+
ContentType.PSV,
|
286
|
+
ContentType.PARQUET,
|
287
|
+
ContentType.JSON,
|
288
|
+
}
|
289
|
+
if self == DatasetType.NUMPY:
|
290
|
+
return {
|
291
|
+
ContentType.CSV,
|
292
|
+
ContentType.TSV,
|
293
|
+
ContentType.UNESCAPED_TSV,
|
294
|
+
ContentType.PSV,
|
295
|
+
ContentType.PARQUET,
|
296
|
+
ContentType.FEATHER,
|
297
|
+
ContentType.JSON,
|
298
|
+
ContentType.AVRO,
|
299
|
+
ContentType.ORC,
|
300
|
+
}
|
301
|
+
if self == DatasetType.PYARROW_PARQUET:
|
302
|
+
return {}
|
303
|
+
raise ValueError(f"No writable content types for {self}")
|
304
|
+
|
305
|
+
def can_read(self, content_type: ContentType) -> bool:
|
306
|
+
return content_type in self.readable_content_types()
|
307
|
+
|
308
|
+
def can_write(self, content_type: ContentType) -> bool:
|
309
|
+
return content_type in self.writable_content_types()
|
310
|
+
|
311
|
+
|
312
|
+
# deprecated by DatasetType - populated dynamically for backwards compatibility
|
313
|
+
TableType = Enum(
|
314
|
+
"TableType",
|
315
|
+
{d.name: d.value for d in DatasetType.local()},
|
316
|
+
)
|
317
|
+
|
318
|
+
# deprecated by DatasetType - populated dynamically for backwards compatibility
|
319
|
+
DistributedDatasetType = Enum(
|
320
|
+
"DistributedDatasetType",
|
321
|
+
{d.name: d.value for d in DatasetType.distributed()},
|
322
|
+
)
|
323
|
+
|
324
|
+
|
325
|
+
# deprecated by DatasetType.local() and DatasetType.distributed()
|
326
|
+
# kept for backwards compatibility
|
327
|
+
class StorageType(str, Enum):
|
328
|
+
LOCAL = "local"
|
329
|
+
DISTRIBUTED = "distributed"
|
330
|
+
|
331
|
+
|
332
|
+
DATASET_TYPE_TO_SUPPORTED_READ_CONTENT_TYPES: Dict[DatasetType, Set[str]] = {
|
333
|
+
DatasetType.DAFT: {
|
334
|
+
ContentType.CSV,
|
335
|
+
ContentType.PARQUET,
|
336
|
+
ContentType.JSON,
|
337
|
+
},
|
338
|
+
DatasetType.RAY_DATASET: {
|
339
|
+
ContentType.CSV,
|
340
|
+
ContentType.TSV,
|
341
|
+
ContentType.UNESCAPED_TSV,
|
342
|
+
ContentType.PSV,
|
343
|
+
ContentType.PARQUET,
|
344
|
+
ContentType.JSON,
|
345
|
+
ContentType.AVRO,
|
346
|
+
ContentType.ORC,
|
347
|
+
ContentType.FEATHER,
|
348
|
+
},
|
95
349
|
}
|
350
|
+
|
351
|
+
|
352
|
+
class DatastoreType(str, Enum):
|
353
|
+
"""
|
354
|
+
Enumeration used to identify the type of reader required to connect to and
|
355
|
+
correctly interpret data stored at a given path. Typically used together
|
356
|
+
with :class:`deltacat.types.media.DatasetType` to resolve a reader or
|
357
|
+
writer for that data store. Note that, although some overlap exists between
|
358
|
+
enum values here and in :class:`deltacat.types.media.ContentType`, each
|
359
|
+
enum serve a different purpose. The purpose of
|
360
|
+
:class:`deltacat.types.media.ContentType` is to resolve a file's MIME type,
|
361
|
+
and may be used together with datastores that support storing different
|
362
|
+
file types to describe the specific file type read/written from/to that
|
363
|
+
datastore (e.g., DeltaCAT, Iceberg, Hudi, Delta Lake, Audio, Images, Video,
|
364
|
+
etc.)
|
365
|
+
"""
|
366
|
+
|
367
|
+
# DeltaCAT Catalog Datasets
|
368
|
+
DELTACAT = "dc"
|
369
|
+
DELTACAT_NAMESPACE = "namespace"
|
370
|
+
DELTACAT_TABLE = "table"
|
371
|
+
DELTACAT_TABLE_VERSION = "tableversion"
|
372
|
+
DELTACAT_STREAM = "stream"
|
373
|
+
DELTACAT_PARTITION = "partition"
|
374
|
+
DELTACAT_DELTA = "delta"
|
375
|
+
|
376
|
+
# External Datasets
|
377
|
+
AUDIO = "audio"
|
378
|
+
AVRO = "avro"
|
379
|
+
BIGQUERY = "bigquery"
|
380
|
+
BINARY = "binary"
|
381
|
+
CSV = "csv"
|
382
|
+
CLICKHOUSE = "clickhouse"
|
383
|
+
DATABRICKS_TABLES = "databricks"
|
384
|
+
DELTA_LAKE = "deltalake"
|
385
|
+
DELTA_SHARING = "deltasharing"
|
386
|
+
FEATHER = "feather"
|
387
|
+
HDF = "hdf"
|
388
|
+
HTML = "html"
|
389
|
+
HUDI = "hudi"
|
390
|
+
ICEBERG = "iceberg"
|
391
|
+
IMAGES = "images"
|
392
|
+
JSON = "json"
|
393
|
+
LANCE = "lance"
|
394
|
+
MONGO = "mongodb"
|
395
|
+
NUMPY = "numpy"
|
396
|
+
ORC = "orc"
|
397
|
+
PARQUET = "parquet"
|
398
|
+
TEXT = "text"
|
399
|
+
TFRECORDS = "tfrecords"
|
400
|
+
VIDEOS = "videos"
|
401
|
+
WARC = "warc"
|
402
|
+
WEBDATASET = "webdataset"
|
403
|
+
XML = "xml"
|