From c5081cf24aa923449e5f6d478ab4e34f0a782eac Mon Sep 17 00:00:00 2001 From: Nick Crews Date: Wed, 8 Mar 2023 12:32:28 -0900 Subject: [PATCH] refactor(pyspark): remove another private function Similar to https://github.com/ibis-project/ibis/pull/5704 --- ibis/backends/pyspark/__init__.py | 24 ------------------------ ibis/backends/pyspark/tests/test_ddl.py | 22 ---------------------- 2 files changed, 46 deletions(-) diff --git a/ibis/backends/pyspark/__init__.py b/ibis/backends/pyspark/__init__.py index 957645d955e3..91f729f54e40 100644 --- a/ibis/backends/pyspark/__init__.py +++ b/ibis/backends/pyspark/__init__.py @@ -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, diff --git a/ibis/backends/pyspark/tests/test_ddl.py b/ibis/backends/pyspark/tests/test_ddl.py index 12911f1b429d..5598bbda5547 100644 --- a/ibis/backends/pyspark/tests/test_ddl.py +++ b/ibis/backends/pyspark/tests/test_ddl.py @@ -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)