Skip to content

Commit

Permalink
Review with Chip contd.
Browse files Browse the repository at this point in the history
  • Loading branch information
malhotrashivam committed Nov 22, 2024
1 parent 2dacdf8 commit d0a09fa
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
public interface SchemaProvider {

// Static factory methods for creating SchemaProvider instances
static SchemaProvider current() {
static SchemaProvider fromCurrent() {
return new SchemaProviderInternal.CurrentSchemaProvider();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,11 @@ public abstract class TableWriterOptions {
* <p>
* Users can specify how to extract the schema in multiple ways (by schema ID, snapshot ID, etc.).
* <p>
* Defaults to {@link SchemaProvider#current()}, which means use the current schema from the table.
* Defaults to {@link SchemaProvider#fromCurrent()}, which means use the current schema from the table.
*/
@Value.Default
public SchemaProvider schemaProvider() {
return SchemaProvider.current();
return SchemaProvider.fromCurrent();
}

/**
Expand Down
51 changes: 26 additions & 25 deletions py/server/deephaven/experimental/iceberg.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@

class IcebergUpdateMode(JObjectWrapper):
"""
IcebergUpdateMode specifies the update mode for an Iceberg table to be loaded into Deephaven. The modes are:
:class:`.IcebergUpdateMode` specifies the update mode for an Iceberg table to be loaded into Deephaven. The modes
are:
- :py:func:`static() <IcebergUpdateMode.static>`: The table is loaded once and does not change
- :py:func:`manual_refresh() <IcebergUpdateMode.manual_refresh>`: The table can be manually refreshed by the user.
Expand Down Expand Up @@ -85,9 +86,9 @@ def j_object(self) -> jpy.JType:

class IcebergReadInstructions(JObjectWrapper):
"""
IcebergReadInstructions specifies the instructions for reading an Iceberg table into Deephaven. These include column
rename instructions and table definitions, as well as special data instructions for loading data files from the
cloud.
:class:`.IcebergReadInstructions` specifies the instructions for reading an Iceberg table into Deephaven. These
include column rename instructions and table definitions, as well as special data instructions for loading data
files from the cloud.
"""

j_object_type = _JIcebergReadInstructions
Expand Down Expand Up @@ -202,19 +203,19 @@ def j_object(self) -> jpy.JType:

class SchemaProvider(JObjectWrapper):
"""
Used for extracting the schema from an Iceberg table. Users can specify multiple ways to do so, for example, by
schema ID, snapshot ID, current schema, etc. This can be useful for passing a schema when writing to an Iceberg
table.
:class:`.SchemaProvider` is used to extract the schema from an Iceberg table. Users can specify multiple ways to do
so, for example, by schema ID, snapshot ID, current schema, etc. This can be useful for passing a schema when
writing to an Iceberg table.
"""

j_object_type = _JSchemaProvider

def __init__(self, _j_object: jpy.JType):
"""
Initializes the SchemaProvider object.
Initializes the :class:`.SchemaProvider` object.
Args:
_j_object (SchemaProvider): the Java SchemaProvider object.
_j_object (SchemaProvider): the Java :class:`.SchemaProvider` object.
"""
self._j_object = _j_object

Expand All @@ -223,14 +224,14 @@ def j_object(self) -> jpy.JType:
return self._j_object

@classmethod
def current(cls) -> 'SchemaProvider':
def from_current(cls) -> 'SchemaProvider':
"""
Used for extracting the current schema from the table.
Returns:
the SchemaProvider object.
"""
return cls(_JSchemaProvider.current())
return cls(_JSchemaProvider.fromCurrent())

@classmethod
def from_schema_id(cls, schema_id: int) -> 'SchemaProvider':
Expand All @@ -241,7 +242,7 @@ def from_schema_id(cls, schema_id: int) -> 'SchemaProvider':
schema_id (int): the schema id to use.
Returns:
the SchemaProvider object.
the :class:`.SchemaProvider` object.
"""
return cls(_JSchemaProvider.fromSchemaId(schema_id))

Expand All @@ -254,7 +255,7 @@ def from_snapshot_id(cls, snapshot_id: int) -> 'SchemaProvider':
snapshot_id (int): the snapshot id to use.
Returns:
the SchemaProvider object.
the :class:`.SchemaProvider` object.
"""
return cls(_JSchemaProvider.fromSnapshotId(snapshot_id))

Expand Down Expand Up @@ -356,8 +357,8 @@ def j_object(self) -> jpy.JType:

class IcebergTable(Table):
"""
IcebergTable is a subclass of Table that allows users to dynamically update the table with new snapshots from
the Iceberg catalog.
:class:`.IcebergTable` is a subclass of Table that allows users to dynamically update the table with new snapshots
from the Iceberg catalog.
"""
j_object_type = _JIcebergTable

Expand Down Expand Up @@ -396,8 +397,8 @@ def j_object(self) -> jpy.JType:
class IcebergTableWriter(JObjectWrapper):
"""
:class:`.IcebergTableWriter` is responsible for writing Deephaven tables to an Iceberg table. Each
:class:`.IcebergTableWriter` instance associated with a single IcebergTableAdapter and can be used to write multiple
Deephaven tables to this Iceberg table.
:class:`.IcebergTableWriter` instance associated with a single :class:`.IcebergTableAdapter` and can be used to
write multiple Deephaven tables to this Iceberg table.
"""
j_object_type = _JIcebergTableWriter or type(None)

Expand Down Expand Up @@ -425,8 +426,8 @@ def j_object(self) -> jpy.JType:

class IcebergTableAdapter(JObjectWrapper):
"""
IcebergTableAdapter provides an interface for interacting with Iceberg tables. It allows the user to list snapshots,
retrieve table definitions and reading Iceberg tables into Deephaven tables.
:class:`.IcebergTableAdapter` provides an interface for interacting with Iceberg tables. It allows the user to list
snapshots, retrieve table definitions and reading Iceberg tables into Deephaven tables.
"""
j_object_type = _JIcebergTableAdapter or type(None)

Expand Down Expand Up @@ -506,8 +507,8 @@ def j_object(self) -> jpy.JType:

class IcebergCatalogAdapter(JObjectWrapper):
"""
IcebergCatalogAdapter provides an interface for interacting with Iceberg catalogs. It allows listing namespaces,
tables and snapshots, as well as reading Iceberg tables into Deephaven tables.
:class:`.IcebergCatalogAdapter` provides an interface for interacting with Iceberg catalogs. It allows listing
namespaces, tables and snapshots, as well as reading Iceberg tables into Deephaven tables.
"""
j_object_type = _JIcebergCatalogAdapter or type(None)

Expand Down Expand Up @@ -567,7 +568,7 @@ def create_table(self, table_identifier: str, table_definition: TableDefinitionL
table_definition (TableDefinitionLike): the table definition of the new table.
Returns:
IcebergTableAdapter: the table adapter for the new Iceberg table.
:class:`.IcebergTableAdapter`: the table adapter for the new Iceberg table.
"""

return IcebergTableAdapter(self.j_object.createTable(table_identifier,
Expand Down Expand Up @@ -607,7 +608,7 @@ def adapter_s3_rest(
need to set this; it is most useful when connecting to non-AWS, S3-compatible APIs.
Returns:
IcebergCatalogAdapter: the catalog adapter for the provided S3 REST catalog.
:class:`.IcebergCatalogAdapter`: the catalog adapter for the provided S3 REST catalog.
Raises:
DHError: If unable to build the catalog adapter.
Expand Down Expand Up @@ -645,7 +646,7 @@ def adapter_aws_glue(
catalog URI.
Returns:
IcebergCatalogAdapter: the catalog adapter for the provided AWS Glue catalog.
:class:`.IcebergCatalogAdapter`: the catalog adapter for the provided AWS Glue catalog.
Raises:
DHError: If unable to build the catalog adapter.
Expand Down Expand Up @@ -741,7 +742,7 @@ def adapter(
hadoop_config (Optional[Dict[str, str]]): hadoop configuration properties for the catalog to load
s3_instructions (Optional[s3.S3Instructions]): the S3 instructions if applicable
Returns:
IcebergCatalogAdapter: the catalog adapter created from the provided properties
:class:`.IcebergCatalogAdapter`: the catalog adapter created from the provided properties
Raises:
DHError: If unable to build the catalog adapter
Expand Down

0 comments on commit d0a09fa

Please sign in to comment.