Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(pyspark): remove another private function #5705

Merged
merged 1 commit into from
Mar 8, 2023
Merged
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
24 changes: 0 additions & 24 deletions ibis/backends/pyspark/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -331,30 +331,6 @@ def get_schema(

return sch.infer(df)

def _schema_from_csv(self, path: str, **kwargs: Any) -> sch.Schema:
"""Return a Schema object for the indicated csv file.

Spark goes through the file once to determine the schema.

Parameters
----------
path
Path to CSV
kwargs
See documentation for `pyspark.sql.DataFrameReader` for more information.

Returns
-------
sch.Schema
An ibis schema instance
"""
options = _read_csv_defaults.copy()
options.update(kwargs)
options['inferSchema'] = True

df = self._session.read.csv(path, **options)
return spark_dataframe_schema(df)

def create_table(
self,
table_name: str,
Expand Down
22 changes: 0 additions & 22 deletions ibis/backends/pyspark/tests/test_ddl.py
Original file line number Diff line number Diff line change
Expand Up @@ -230,25 +230,3 @@ def test_create_table_reserved_identifier(client, alltypes):
assert result == expected
finally:
client.drop_table(table_name)


@pytest.fixture(scope='session')
def awards_players_filename(data_directory):
return str(data_directory / 'awards_players.csv')


awards_players_schema = ibis.schema(
[
('playerID', 'string'),
('awardID', 'string'),
('yearID', 'int32'),
('lgID', 'string'),
('tie', 'string'),
('notes', 'string'),
]
)


def test_schema_from_csv(client, awards_players_filename):
schema = client._schema_from_csv(awards_players_filename)
assert schema.equals(awards_players_schema)