Return the schema of the dataset. Examples: >>> import ray >>> ds = ray.data.range(10) >>> ds.schema() Column Type ------ ---- id int64 Time complexity: O(1) Args: fetch_if_missing:
(self, fetch_if_missing: bool = True)
| 4158 | ) |
| 4159 | @PublicAPI(api_group=IM_API_GROUP) |
| 4160 | def schema(self, fetch_if_missing: bool = True) -> Optional["Schema"]: |
| 4161 | """Return the schema of the dataset. |
| 4162 | |
| 4163 | Examples: |
| 4164 | >>> import ray |
| 4165 | >>> ds = ray.data.range(10) |
| 4166 | >>> ds.schema() |
| 4167 | Column Type |
| 4168 | ------ ---- |
| 4169 | id int64 |
| 4170 | |
| 4171 | Time complexity: O(1) |
| 4172 | |
| 4173 | Args: |
| 4174 | fetch_if_missing: If True, synchronously fetch the schema if it's |
| 4175 | not known. If False, None is returned if the schema is not known. |
| 4176 | Default is True. |
| 4177 | |
| 4178 | Returns: |
| 4179 | The :class:`ray.data.Schema` class of the records, or None if the |
| 4180 | schema is not known and fetch_if_missing is False. |
| 4181 | """ |
| 4182 | base_schema = self._base_schema(fetch_if_missing=fetch_if_missing) |
| 4183 | if base_schema is not None: |
| 4184 | return Schema(base_schema, data_context=self.context) |
| 4185 | return None |
| 4186 | |
| 4187 | @ConsumptionAPI( |
| 4188 | if_more_than_read=True, |
no test coverage detected