You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Spark 3: Consider providing better support for path-based tables #1306
In Spark 3, support for path-based tables is limited. In particular, I don't see a way to create a Hadoop table at a given location through Spark. Users have to use the Iceberg API for that as we use HadoopTables only for reading.
I see a lot of use cases with no metastore where tables are persisted in a location. Usually, these are HDFS use cases. While we can leverage HadoopCatalog for such cases, it has its own drawbacks: list operations to find a table and what is even more important it requires a special layout. The latter point is important as we cannot use HadoopCatalog for path-based tables that were migrated to Iceberg. I want Iceberg to support migration of path-based as well as metastore-based tables through SQL extensions.
I'd consider adding support to our Spark catalogs to create/load a table using a table path as an identifier. Under the hood, it will use HadoopTables.
For example, CREATE TABLE `path/to/table` USING iceberg or SELECT * FROM `path/to/table` WHERE pred.
Couldn't we use the existing Create table to do something like
CREATE TABLE "name" USING iceberg OPTIONS (path = "x")
Or are we trying to keep from ever naming the table representing the directory?
As for the select, I think that sounds reasonable as long as those kind of strings with slashes can be passed through easily. I'm assuming we would just branch off in the Catalog load table method?
I'm sorry I'm still a bit new here, so I'm not fully up to date on what's going on here. But it seems as though we just want a way of treating a directory as a table?
I was also thinking about adding support for identifiers with a path. We could use that to delegate from IcebergSource to a catalog, which would the bring support for all of the SaveMode options in the v1 DataFrameWriter. Since that write path is very confusing and often broken, I think adding that is a very minor benefit.
I think there may already be support for tables that are identified using ```iceberg.`fs:/path/to/table````. That works for v1 sources, like Parquet. Russell's option could work as well.
Isn't the main blocker that we need an atomic operation? HadoopTableOperations works for HDFS tables, but any other file system, including file:, needs something for coordination. I'm not sure what that would be for path-based tables.
CREATE TABLE "name" USING iceberg OPTIONS (path = "x")
@RussellSpitzer, create table statements are delegated to either HadoopCatalog or HiveCatalog in Iceberg. The example above can be processed only by HiveCatalog as we cannot set a table location in HadoopCatalog. While HiveCatalog allows arbitrary table locations, it requires HMS. While HadoopCatalog doesn't need HMS, it requires a special layout and does list operations. We have one more API to work with Iceberg tables: HadoopTables. As opposed to HadoopCatalog, the location can be arbitrary.
I see a lot of cases when people just refer to a table by location. While we can load such tables, we cannot create them through Spark and there is no SQL support. I wonder if there is something we could do differently and provide better user experience with tables identified by path.
I think there may already be support for tables that are identified using ```iceberg.`fs:/path/to/table````.
@rdblue, I actually forgot about the SQL on files syntax. Unfortunately, it works only with built-in v1 internal file sources. Ideally, we should see whether we can enable support for such syntax in all V2 data sources. Even if we do so, this will only address query support. Users will have to call Iceberg APIs to create tables. An alternative is to interpret path identifiers in our Spark catalogs. For example, we could support iceberg_spark_catalog.`path/to/table/` syntax.
Isn't the main blocker that we need an atomic operation? HadoopTableOperations works for HDFS tables, but any other file system, including file:, needs something for coordination. I'm not sure what that would be for path-based tables.
I'd just use HadoopTables and document the limitations.
I'd just use HadoopTables and document the limitations.
That sounds dangerous. I would really rather not provide an easy way to have tables that work most of the time, but fail in ways that are hard to track down. I think it would be fine to build a catalog that supports this, but I don't think that we should make a recommended way to interact with Iceberg.
I think it would be fine to build a catalog that supports this
I was referring to a catalog as one option. Shouldn't it use HadoopTables API internally, though?
Then we can support the following use cases:
CREATE TABLE catalog_name.`path/to/table` USING iceberg
SELECT * FROM catalog_name.`path/to/table` WHERE predicate
SELECT * FROM catalog_name.`path/to/table`.snapshots
Just a heads up, I have picked this up and have a partial impl which I hope to publish a draft PR of soon.
As per #1306 (comment) it is not clear to me how this will work for filesystems that don't offer atomic primitives. Should we check the uri schema and reject if it isn't supported?
This issue has been automatically marked as stale because it has been open for 180 days with no activity. It will be closed in next 14 days if no further activity occurs. To permanently prevent this issue from being considered stale, add the label 'not-stale', but commenting on the issue is preferred when possible.
Activity
aokolnychyi commentedon Aug 7, 2020
We will have to figure out caching and a few other things but I want to discuss whether this makes sense or not.
@rdblue @rdsr @prodeezy @RussellSpitzer @jerryshao any thoughts on this?
RussellSpitzer commentedon Aug 7, 2020
Couldn't we use the existing Create table to do something like
CREATE TABLE "name" USING iceberg OPTIONS (path = "x")Or are we trying to keep from ever naming the table representing the directory?
As for the select, I think that sounds reasonable as long as those kind of strings with slashes can be passed through easily. I'm assuming we would just branch off in the Catalog load table method?
I'm sorry I'm still a bit new here, so I'm not fully up to date on what's going on here. But it seems as though we just want a way of treating a directory as a table?
rdblue commentedon Aug 8, 2020
I was also thinking about adding support for identifiers with a path. We could use that to delegate from
IcebergSourceto a catalog, which would the bring support for all of theSaveModeoptions in the v1DataFrameWriter. Since that write path is very confusing and often broken, I think adding that is a very minor benefit.I think there may already be support for tables that are identified using ```iceberg.`fs:/path/to/table````. That works for v1 sources, like Parquet. Russell's option could work as well.
Isn't the main blocker that we need an atomic operation? HadoopTableOperations works for HDFS tables, but any other file system, including
file:, needs something for coordination. I'm not sure what that would be for path-based tables.aokolnychyi commentedon Aug 10, 2020
@RussellSpitzer, create table statements are delegated to either
HadoopCatalogorHiveCatalogin Iceberg. The example above can be processed only byHiveCatalogas we cannot set a table location inHadoopCatalog. WhileHiveCatalogallows arbitrary table locations, it requires HMS. WhileHadoopCatalogdoesn't need HMS, it requires a special layout and does list operations. We have one more API to work with Iceberg tables:HadoopTables. As opposed toHadoopCatalog, the location can be arbitrary.I see a lot of cases when people just refer to a table by location. While we can load such tables, we cannot create them through Spark and there is no SQL support. I wonder if there is something we could do differently and provide better user experience with tables identified by path.
@rdblue, I actually forgot about the SQL on files syntax. Unfortunately, it works only with built-in v1 internal file sources. Ideally, we should see whether we can enable support for such syntax in all V2 data sources. Even if we do so, this will only address query support. Users will have to call Iceberg APIs to create tables. An alternative is to interpret path identifiers in our Spark catalogs. For example, we could support
iceberg_spark_catalog.`path/to/table/`syntax.I'd just use
HadoopTablesand document the limitations.rdblue commentedon Aug 10, 2020
That sounds dangerous. I would really rather not provide an easy way to have tables that work most of the time, but fail in ways that are hard to track down. I think it would be fine to build a catalog that supports this, but I don't think that we should make a recommended way to interact with Iceberg.
aokolnychyi commentedon Aug 11, 2020
I was referring to a catalog as one option. Shouldn't it use
HadoopTablesAPI internally, though?Then we can support the following use cases:
aokolnychyi commentedon Nov 23, 2020
I think the current plan is to support loading path-based tables in all Spark catalogs by using
HadoopTables.rymurr commentedon Nov 26, 2020
Just a heads up, I have picked this up and have a partial impl which I hope to publish a draft PR of soon.
As per #1306 (comment) it is not clear to me how this will work for filesystems that don't offer atomic primitives. Should we check the uri schema and reject if it isn't supported?
wip: create and drop support for file paths
wip: create and drop support for file paths
wip: create and drop support for file paths
github-actions commentedon Feb 13, 2024
This issue has been automatically marked as stale because it has been open for 180 days with no activity. It will be closed in next 14 days if no further activity occurs. To permanently prevent this issue from being considered stale, add the label 'not-stale', but commenting on the issue is preferred when possible.
github-actions commentedon Feb 28, 2024
This issue has been closed because it has not received any activity in the last 14 days since being marked as 'stale'
Merge pull request apache#1306 from szehon-ho/apple-1.5.0.x-release