You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@iceberg.apache.org by Anton Okolnychyi <ao...@apple.com.INVALID> on 2019/03/18 18:11:13 UTC

Extend SparkTableUtil to Handle Tables Not Tracked in Hive Metastore

Hi,

SparkTableUtil can be helpful for migrating existing Spark tables into Iceberg. Right now, SparkTableUtil assumes that the partition information is always tracked in Hive metastore.

What about extending SparkTableUtil to handle Spark tables that don’t rely on Hive metastore? I have a local prototype that makes use of Spark InMemoryFileIndex to infer the partitioning info.

Thanks,
Anton

Re: Extend SparkTableUtil to Handle Tables Not Tracked in Hive Metastore

Posted by Ryan Blue <rb...@netflix.com.INVALID>.
I opened a PR for appending manifests:
https://github.com/apache/incubator-iceberg/pull/201

On Mon, Jun 3, 2019 at 12:32 PM Ryan Blue <rb...@netflix.com> wrote:

> Yes, we will need to expose ManifestWriter, but only the methods that work
> with DataFile because we only need to support append.
>
> Unfortunately, these manifests will need to be rewritten because they
> don't have the correct snapshot ID in the file metadata because that is set
> in the final commit.
>
> Iceberg doesn't support Spark bucketing because they use different bucket
> functions. We will need to extend Spark to allow using a custom partition
> function to get bucketed joins working.
>
> On Mon, Jun 3, 2019 at 12:18 PM Anton Okolnychyi <ao...@apple.com>
> wrote:
>
>> If we are to support appending manifest files, do we expect to expose
>> ManifestWriter?
>>
>> Also, one more question about migrating bucketed Spark tables. Am I
>> correct it won’t work because of [1]? The bucketing field won’t be present
>> in the partition values map, as bucket ids are encoded in file names, right?
>>
>> [1] -
>> https://github.com/apache/incubator-iceberg/blob/master/spark/src/main/scala/org/apache/iceberg/spark/SparkTableUtil.scala#L107
>>
>> On 20 May 2019, at 11:17, Anton Okolnychyi <ao...@apple.com> wrote:
>>
>> A few comments from me inline:
>>
>> I think it is reasonable to make this a Spark job. The number of files in
>> tables we convert typically requires it. This would only be too much for
>> the driver if all of the files are collected at one time. We commit 500,000
>> files per batch, which seems to work well. That trades atomicity, though.
>>
>>
>> Makes sense to me, just wanted to double-check that the “proper” API
>> should still be based on a Spark job.
>>
>> - What should be the scope? Do we want the migration to modify the
>> catalog?
>>
>> What do you mean modify the catalog?
>>
>> We've built two SQL commands using these helper classes and methods:
>> SNAPSHOT TABLE that creates a new table copy, and MIGRATE TABLE that
>> basically builds a snapshot, but also renames the new table into place.
>>
>>
>> By modifying catalog I mean creating/dropping tables in it. My question
>> is whether this should be part of the migration tool/API or not. Right now,
>> it isn’t. Instead, the catalog is modified by SNAPSHOT TABLE and MIGRATE
>> TABLE commands that are using SparkTableUtil. I think is reasonable to keep
>> it this way, meaning that the scope of the migration tool is to find files
>> and append them to an existing Iceberg table.
>>
>> - If we stick to having Dataset[DataFiles], we will have one append per
>> dataset partition. How do we want to guarantee that either all files are
>> appended or none? One way is to rely on temporary tables but this requires
>> looking into the catalog. Another approach is to say that if the
>> migration isn’t successful, users will need to remove the metadata and
>> retry.
>>
>> I don't recommend committing from tasks. If Spark runs speculative
>> attempts, you can get duplicate data.
>>
>>
>> That’s exactly my point. In addition, if one task fails, then we end up
>> with partial results. However, it seems to be the only possible way right
>> now. We can mitigate the effects by having temporary tables but this
>> doesn’t solve the problem completely.
>>
>> Another option is to add a way to append manifest files, not just data
>> files. That way, each task produces a manifest and we can create a single
>> commit to add all of the manifests. This requires some rewriting, but I
>> think it would be a good way to distribute the majority of the work and
>> still have an atomic commit.
>>
>>
>> This sounds promising but requires quite some changes to the public API.
>> I am wondering if we can group all files per Dataset partition and
>> leverage ReplacePartitions/OverwriteFiles APIs in Iceberg. That way, the
>> migration won’t be atomic but idempotent.
>>
>> Thanks,
>> Anton
>>
>> On 15 May 2019, at 19:12, Ryan Blue <rb...@netflix.com> wrote:
>>
>> Replies inline:
>>
>> On Tue, May 14, 2019 at 3:21 AM Anton Okolnychyi <ao...@apple.com>
>> wrote:
>> I would like to resume this topic. How do we see the proper API for
>> migration?
>>
>> I have a couple of questions in mind:
>> - Now, it is based on a Spark job. Do we want to keep it that way because
>> the number of files might be huge? Will it be too much for the driver?
>>
>> I think it is reasonable to make this a Spark job. The number of files in
>> tables we convert typically requires it. This would only be too much for
>> the driver if all of the files are collected at one time. We commit 500,000
>> files per batch, which seems to work well. That trades atomicity, though.
>>
>> - What should be the scope? Do we want the migration to modify the
>> catalog?
>>
>> What do you mean modify the catalog?
>>
>> We've built two SQL commands using these helper classes and methods:
>> SNAPSHOT TABLE that creates a new table copy, and MIGRATE TABLE that
>> basically builds a snapshot, but also renames the new table into place.
>>
>> - If we stick to having Dataset[DataFiles], we will have one append per
>> dataset partition. How do we want to guarantee that either all files are
>> appended or none? One way is to rely on temporary tables but this requires
>> looking into the catalog. Another approach is to say that if the
>> migration isn’t successful, users will need to remove the metadata and
>> retry.
>>
>> I don't recommend committing from tasks. If Spark runs speculative
>> attempts, you can get duplicate data.
>>
>> Another option is to add a way to append manifest files, not just data
>> files. That way, each task produces a manifest and we can create a single
>> commit to add all of the manifests. This requires some rewriting, but I
>> think it would be a good way to distribute the majority of the work and
>> still have an atomic commit.
>>
>> --
>> Ryan Blue
>> Software Engineer
>> Netflix
>>
>>
>>
>>
>
> --
> Ryan Blue
> Software Engineer
> Netflix
>


-- 
Ryan Blue
Software Engineer
Netflix

Re: Extend SparkTableUtil to Handle Tables Not Tracked in Hive Metastore

Posted by Ryan Blue <rb...@netflix.com.INVALID>.
Yes, we will need to expose ManifestWriter, but only the methods that work
with DataFile because we only need to support append.

Unfortunately, these manifests will need to be rewritten because they don't
have the correct snapshot ID in the file metadata because that is set in
the final commit.

Iceberg doesn't support Spark bucketing because they use different bucket
functions. We will need to extend Spark to allow using a custom partition
function to get bucketed joins working.

On Mon, Jun 3, 2019 at 12:18 PM Anton Okolnychyi <ao...@apple.com>
wrote:

> If we are to support appending manifest files, do we expect to expose
> ManifestWriter?
>
> Also, one more question about migrating bucketed Spark tables. Am I
> correct it won’t work because of [1]? The bucketing field won’t be present
> in the partition values map, as bucket ids are encoded in file names, right?
>
> [1] -
> https://github.com/apache/incubator-iceberg/blob/master/spark/src/main/scala/org/apache/iceberg/spark/SparkTableUtil.scala#L107
>
> On 20 May 2019, at 11:17, Anton Okolnychyi <ao...@apple.com> wrote:
>
> A few comments from me inline:
>
> I think it is reasonable to make this a Spark job. The number of files in
> tables we convert typically requires it. This would only be too much for
> the driver if all of the files are collected at one time. We commit 500,000
> files per batch, which seems to work well. That trades atomicity, though.
>
>
> Makes sense to me, just wanted to double-check that the “proper” API
> should still be based on a Spark job.
>
> - What should be the scope? Do we want the migration to modify the
> catalog?
>
> What do you mean modify the catalog?
>
> We've built two SQL commands using these helper classes and methods:
> SNAPSHOT TABLE that creates a new table copy, and MIGRATE TABLE that
> basically builds a snapshot, but also renames the new table into place.
>
>
> By modifying catalog I mean creating/dropping tables in it. My question is
> whether this should be part of the migration tool/API or not. Right now, it
> isn’t. Instead, the catalog is modified by SNAPSHOT TABLE and MIGRATE TABLE
> commands that are using SparkTableUtil. I think is reasonable to keep it
> this way, meaning that the scope of the migration tool is to find files and
> append them to an existing Iceberg table.
>
> - If we stick to having Dataset[DataFiles], we will have one append per
> dataset partition. How do we want to guarantee that either all files are
> appended or none? One way is to rely on temporary tables but this requires
> looking into the catalog. Another approach is to say that if the
> migration isn’t successful, users will need to remove the metadata and
> retry.
>
> I don't recommend committing from tasks. If Spark runs speculative
> attempts, you can get duplicate data.
>
>
> That’s exactly my point. In addition, if one task fails, then we end up
> with partial results. However, it seems to be the only possible way right
> now. We can mitigate the effects by having temporary tables but this
> doesn’t solve the problem completely.
>
> Another option is to add a way to append manifest files, not just data
> files. That way, each task produces a manifest and we can create a single
> commit to add all of the manifests. This requires some rewriting, but I
> think it would be a good way to distribute the majority of the work and
> still have an atomic commit.
>
>
> This sounds promising but requires quite some changes to the public API. I
> am wondering if we can group all files per Dataset partition and
> leverage ReplacePartitions/OverwriteFiles APIs in Iceberg. That way, the
> migration won’t be atomic but idempotent.
>
> Thanks,
> Anton
>
> On 15 May 2019, at 19:12, Ryan Blue <rb...@netflix.com> wrote:
>
> Replies inline:
>
> On Tue, May 14, 2019 at 3:21 AM Anton Okolnychyi <ao...@apple.com>
> wrote:
> I would like to resume this topic. How do we see the proper API for
> migration?
>
> I have a couple of questions in mind:
> - Now, it is based on a Spark job. Do we want to keep it that way because
> the number of files might be huge? Will it be too much for the driver?
>
> I think it is reasonable to make this a Spark job. The number of files in
> tables we convert typically requires it. This would only be too much for
> the driver if all of the files are collected at one time. We commit 500,000
> files per batch, which seems to work well. That trades atomicity, though.
>
> - What should be the scope? Do we want the migration to modify the
> catalog?
>
> What do you mean modify the catalog?
>
> We've built two SQL commands using these helper classes and methods:
> SNAPSHOT TABLE that creates a new table copy, and MIGRATE TABLE that
> basically builds a snapshot, but also renames the new table into place.
>
> - If we stick to having Dataset[DataFiles], we will have one append per
> dataset partition. How do we want to guarantee that either all files are
> appended or none? One way is to rely on temporary tables but this requires
> looking into the catalog. Another approach is to say that if the
> migration isn’t successful, users will need to remove the metadata and
> retry.
>
> I don't recommend committing from tasks. If Spark runs speculative
> attempts, you can get duplicate data.
>
> Another option is to add a way to append manifest files, not just data
> files. That way, each task produces a manifest and we can create a single
> commit to add all of the manifests. This requires some rewriting, but I
> think it would be a good way to distribute the majority of the work and
> still have an atomic commit.
>
> --
> Ryan Blue
> Software Engineer
> Netflix
>
>
>
>

-- 
Ryan Blue
Software Engineer
Netflix

Re: Extend SparkTableUtil to Handle Tables Not Tracked in Hive Metastore

Posted by Anton Okolnychyi <ao...@apple.com.INVALID>.
If we are to support appending manifest files, do we expect to expose ManifestWriter?

Also, one more question about migrating bucketed Spark tables. Am I correct it won’t work because of [1]? The bucketing field won’t be present in the partition values map, as bucket ids are encoded in file names, right?

[1] - https://github.com/apache/incubator-iceberg/blob/master/spark/src/main/scala/org/apache/iceberg/spark/SparkTableUtil.scala#L107 <https://github.com/apache/incubator-iceberg/blob/master/spark/src/main/scala/org/apache/iceberg/spark/SparkTableUtil.scala#L107>

> On 20 May 2019, at 11:17, Anton Okolnychyi <ao...@apple.com> wrote:
> 
> A few comments from me inline:
> 
>> I think it is reasonable to make this a Spark job. The number of files in tables we convert typically requires it. This would only be too much for the driver if all of the files are collected at one time. We commit 500,000 files per batch, which seems to work well. That trades atomicity, though.
> 
> Makes sense to me, just wanted to double-check that the “proper” API should still be based on a Spark job. 
> 
>> - What should be the scope? Do we want the migration to modify the catalog? 
>> 
>> What do you mean modify the catalog?
>> 
>> We've built two SQL commands using these helper classes and methods: SNAPSHOT TABLE that creates a new table copy, and MIGRATE TABLE that basically builds a snapshot, but also renames the new table into place.
> 
> By modifying catalog I mean creating/dropping tables in it. My question is whether this should be part of the migration tool/API or not. Right now, it isn’t. Instead, the catalog is modified by SNAPSHOT TABLE and MIGRATE TABLE commands that are using SparkTableUtil. I think is reasonable to keep it this way, meaning that the scope of the migration tool is to find files and append them to an existing Iceberg table.
> 
>> - If we stick to having Dataset[DataFiles], we will have one append per dataset partition. How do we want to guarantee that either all files are appended or none? One way is to rely on temporary tables but this requires looking into the catalog. Another approach is to say that if the migration isn’t successful, users will need to remove the metadata and retry.
>> 
>> I don't recommend committing from tasks. If Spark runs speculative attempts, you can get duplicate data.
> 
> That’s exactly my point. In addition, if one task fails, then we end up with partial results. However, it seems to be the only possible way right now. We can mitigate the effects by having temporary tables but this doesn’t solve the problem completely.
> 
>> Another option is to add a way to append manifest files, not just data files. That way, each task produces a manifest and we can create a single commit to add all of the manifests. This requires some rewriting, but I think it would be a good way to distribute the majority of the work and still have an atomic commit.
> 
> This sounds promising but requires quite some changes to the public API. I am wondering if we can group all files per Dataset partition and leverage ReplacePartitions/OverwriteFiles APIs in Iceberg. That way, the migration won’t be atomic but idempotent.
> 
> Thanks,
> Anton
> 
>> On 15 May 2019, at 19:12, Ryan Blue <rb...@netflix.com> wrote:
>> 
>> Replies inline:
>> 
>> On Tue, May 14, 2019 at 3:21 AM Anton Okolnychyi <ao...@apple.com> wrote:
>> I would like to resume this topic. How do we see the proper API for migration?
>> 
>> I have a couple of questions in mind:
>> - Now, it is based on a Spark job. Do we want to keep it that way because the number of files might be huge? Will it be too much for the driver?
>> 
>> I think it is reasonable to make this a Spark job. The number of files in tables we convert typically requires it. This would only be too much for the driver if all of the files are collected at one time. We commit 500,000 files per batch, which seems to work well. That trades atomicity, though.
>>  
>> - What should be the scope? Do we want the migration to modify the catalog? 
>> 
>> What do you mean modify the catalog?
>> 
>> We've built two SQL commands using these helper classes and methods: SNAPSHOT TABLE that creates a new table copy, and MIGRATE TABLE that basically builds a snapshot, but also renames the new table into place.
>>  
>> - If we stick to having Dataset[DataFiles], we will have one append per dataset partition. How do we want to guarantee that either all files are appended or none? One way is to rely on temporary tables but this requires looking into the catalog. Another approach is to say that if the migration isn’t successful, users will need to remove the metadata and retry.
>> 
>> I don't recommend committing from tasks. If Spark runs speculative attempts, you can get duplicate data.
>> 
>> Another option is to add a way to append manifest files, not just data files. That way, each task produces a manifest and we can create a single commit to add all of the manifests. This requires some rewriting, but I think it would be a good way to distribute the majority of the work and still have an atomic commit.
>> 
>> -- 
>> Ryan Blue
>> Software Engineer
>> Netflix
> 


Re: Extend SparkTableUtil to Handle Tables Not Tracked in Hive Metastore

Posted by Anton Okolnychyi <ao...@apple.com.INVALID>.
A few comments from me inline:

> I think it is reasonable to make this a Spark job. The number of files in tables we convert typically requires it. This would only be too much for the driver if all of the files are collected at one time. We commit 500,000 files per batch, which seems to work well. That trades atomicity, though.

Makes sense to me, just wanted to double-check that the “proper” API should still be based on a Spark job. 

> - What should be the scope? Do we want the migration to modify the catalog? 
> 
> What do you mean modify the catalog?
> 
> We've built two SQL commands using these helper classes and methods: SNAPSHOT TABLE that creates a new table copy, and MIGRATE TABLE that basically builds a snapshot, but also renames the new table into place.

By modifying catalog I mean creating/dropping tables in it. My question is whether this should be part of the migration tool/API or not. Right now, it isn’t. Instead, the catalog is modified by SNAPSHOT TABLE and MIGRATE TABLE commands that are using SparkTableUtil. I think is reasonable to keep it this way, meaning that the scope of the migration tool is to find files and append them to an existing Iceberg table.

> - If we stick to having Dataset[DataFiles], we will have one append per dataset partition. How do we want to guarantee that either all files are appended or none? One way is to rely on temporary tables but this requires looking into the catalog. Another approach is to say that if the migration isn’t successful, users will need to remove the metadata and retry.
> 
> I don't recommend committing from tasks. If Spark runs speculative attempts, you can get duplicate data.

That’s exactly my point. In addition, if one task fails, then we end up with partial results. However, it seems to be the only possible way right now. We can mitigate the effects by having temporary tables but this doesn’t solve the problem completely.

> Another option is to add a way to append manifest files, not just data files. That way, each task produces a manifest and we can create a single commit to add all of the manifests. This requires some rewriting, but I think it would be a good way to distribute the majority of the work and still have an atomic commit.

This sounds promising but requires quite some changes to the public API. I am wondering if we can group all files per Dataset partition and leverage ReplacePartitions/OverwriteFiles APIs in Iceberg. That way, the migration won’t be atomic but idempotent.

Thanks,
Anton

> On 15 May 2019, at 19:12, Ryan Blue <rb...@netflix.com> wrote:
> 
> Replies inline:
> 
> On Tue, May 14, 2019 at 3:21 AM Anton Okolnychyi <ao...@apple.com> wrote:
> I would like to resume this topic. How do we see the proper API for migration?
> 
> I have a couple of questions in mind:
> - Now, it is based on a Spark job. Do we want to keep it that way because the number of files might be huge? Will it be too much for the driver?
> 
> I think it is reasonable to make this a Spark job. The number of files in tables we convert typically requires it. This would only be too much for the driver if all of the files are collected at one time. We commit 500,000 files per batch, which seems to work well. That trades atomicity, though.
>  
> - What should be the scope? Do we want the migration to modify the catalog? 
> 
> What do you mean modify the catalog?
> 
> We've built two SQL commands using these helper classes and methods: SNAPSHOT TABLE that creates a new table copy, and MIGRATE TABLE that basically builds a snapshot, but also renames the new table into place.
>  
> - If we stick to having Dataset[DataFiles], we will have one append per dataset partition. How do we want to guarantee that either all files are appended or none? One way is to rely on temporary tables but this requires looking into the catalog. Another approach is to say that if the migration isn’t successful, users will need to remove the metadata and retry.
> 
> I don't recommend committing from tasks. If Spark runs speculative attempts, you can get duplicate data.
> 
> Another option is to add a way to append manifest files, not just data files. That way, each task produces a manifest and we can create a single commit to add all of the manifests. This requires some rewriting, but I think it would be a good way to distribute the majority of the work and still have an atomic commit.
> 
> -- 
> Ryan Blue
> Software Engineer
> Netflix


Re: Extend SparkTableUtil to Handle Tables Not Tracked in Hive Metastore

Posted by Ryan Blue <rb...@netflix.com.INVALID>.
Replies inline:

On Tue, May 14, 2019 at 3:21 AM Anton Okolnychyi <ao...@apple.com>
wrote:

> I would like to resume this topic. How do we see the proper API for
> migration?
>
> I have a couple of questions in mind:
> - Now, it is based on a Spark job. Do we want to keep it that way because
> the number of files might be huge? Will it be too much for the driver?
>

I think it is reasonable to make this a Spark job. The number of files in
tables we convert typically requires it. This would only be too much for
the driver if all of the files are collected at one time. We commit 500,000
files per batch, which seems to work well. That trades atomicity, though.


> - What should be the scope? Do we want the migration to modify the
> catalog?
>

What do you mean modify the catalog?

We've built two SQL commands using these helper classes and methods:
SNAPSHOT TABLE that creates a new table copy, and MIGRATE TABLE that
basically builds a snapshot, but also renames the new table into place.


> - If we stick to having Dataset[DataFiles], we will have one append per
> dataset partition. How do we want to guarantee that either all files are
> appended or none? One way is to rely on temporary tables but this requires
> looking into the catalog. Another approach is to say that if the migration
> isn’t successful, users will need to remove the metadata and retry.
>

I don't recommend committing from tasks. If Spark runs speculative
attempts, you can get duplicate data.

Another option is to add a way to append manifest files, not just data
files. That way, each task produces a manifest and we can create a single
commit to add all of the manifests. This requires some rewriting, but I
think it would be a good way to distribute the majority of the work and
still have an atomic commit.

-- 
Ryan Blue
Software Engineer
Netflix

Re: Extend SparkTableUtil to Handle Tables Not Tracked in Hive Metastore

Posted by Anton Okolnychyi <ao...@apple.com.INVALID>.
I would like to resume this topic. How do we see the proper API for migration?

I have a couple of questions in mind:
- Now, it is based on a Spark job. Do we want to keep it that way because the number of files might be huge? Will it be too much for the driver?
- What should be the scope? Do we want the migration to modify the catalog? 
- If we stick to having Dataset[DataFiles], we will have one append per dataset partition. How do we want to guarantee that either all files are appended or none? One way is to rely on temporary tables but this requires looking into the catalog. Another approach is to say that if the migration isn’t successful, users will need to remove the metadata and retry.

Any ideas would be welcome.

Thanks,
Anton

> On 20 Mar 2019, at 16:27, Ryan Blue <rb...@netflix.com.INVALID> wrote:
> 
> We can always consider moving interfaces from core to the API when they are relatively stable. For SPI classes, I'm not sure there's a good reason to do it because the API and SPI are purposely different. API is for using Iceberg from a processing engine or data management service. SPI is for customizing how the core table implementations work. Maybe we could move SPI to its own module, eventually.
> 
> On Tue, Mar 19, 2019 at 8:36 PM Sandeep Nayak <osgigeek@gmail.com <ma...@gmail.com>> wrote:
> Thanks for pointing me in the right direction Ryan.
> 
> One question comes to mind, the `TableOperations` is in the core project but the interface is identified as an SPI. If one were to plug in other metastores should we consider restricting any such extensions to be only against classes in api or maybe a separate spi  sub-project v/s core sub-project?  That pattern would allow for restricting dependencies in one isolated area and allowing other areas (like core) to evolve a bit more freely without worrying about breaking any dependents. 
> 
> Thoughts?
> 
> -Sandeep
> 
> On Tue, Mar 19, 2019 at 2:24 PM Ryan Blue <rb...@netflix.com.invalid> wrote:
> Sandeep, we use the `TableOperations` API to plug in other metastores, as well as other customizations like `FileIO` implementations. Thanks to Matt and Yifei for their work extending this area!
> 
> On Mon, Mar 18, 2019 at 8:49 PM Sandeep Nayak <osgigeek@gmail.com <ma...@gmail.com>> wrote:
> To Xabriel's point, it would be good to have a Store abstraction so that one could plug-in an implementation be it HMS or something else.
> 
> 
> On Mon, Mar 18, 2019 at 3:20 PM Xabriel Collazo Mojica <xc...@adobe.com.invalid> wrote:
> +1 for having a tool/API to migrate tables from HMS into Iceberg.
> 
>  
> 
> We do not use HMS in my current project, but since HMS is the de facto catalog in most companies doing Hadoop, I think such a tool would be vital for incentivizing Iceberg adoption and/or PoCs.
> 
>  
> 
> Xabriel J Collazo Mojica  |  Senior Software Engineer  |  Adobe  |  xcollazo@adobe.com <ma...@adobe.com>
>  
> 
> From: <aokolnychyi@apple.com <ma...@apple.com>> on behalf of Anton Okolnychyi <ao...@apple.com.INVALID>
> Reply-To: "dev@iceberg.apache.org <ma...@iceberg.apache.org>" <dev@iceberg.apache.org <ma...@iceberg.apache.org>>
> Date: Monday, March 18, 2019 at 2:22 PM
> To: "dev@iceberg.apache.org <ma...@iceberg.apache.org>" <dev@iceberg.apache.org <ma...@iceberg.apache.org>>, Ryan Blue <rblue@netflix.com <ma...@netflix.com>>
> Subject: Re: Extend SparkTableUtil to Handle Tables Not Tracked in Hive Metastore
> 
>  
> 
> I definitely support this idea. Having a clean and reliable API to migrate existing Spark tables to Iceberg will be helpful.
> 
> I propose to collect all requirements for the new API in this thread. Then I can come up with a doc that we will discuss within the community.
> 
>  
> 
> From the feature perspective, I think it would be important to support tables that persist partition information in HMS as well as tables that derive partition information from the folder structure. Also, migrating just a partition of a table would be useful. 
> 
>  
> 
> 
> 
> 
> On 18 Mar 2019, at 18:28, Ryan Blue <rblue@netflix.com.INVALID <ma...@netflix.com.INVALID>> wrote:
> 
>  
> 
> I think that would be fine, but I want to throw out a quick warning: SparkTableUtil was initially written as a few handy helpers, so it wasn't well designed as an API. It's really useful, so I can understand wanting to extend it. But should we come up with a real API for these conversion tasks instead of updating the hacks?
> 
>  
> 
> On Mon, Mar 18, 2019 at 11:11 AM Anton Okolnychyi <aokolnychyi@apple.com.invalid <ma...@apple.com.invalid>> wrote:
> 
> Hi,
> 
> SparkTableUtil can be helpful for migrating existing Spark tables into Iceberg. Right now, SparkTableUtil assumes that the partition information is always tracked in Hive metastore.
> 
> What about extending SparkTableUtil to handle Spark tables that don’t rely on Hive metastore? I have a local prototype that makes use of Spark InMemoryFileIndex to infer the partitioning info.
> 
> Thanks,
> Anton
> 
> 
> 
>  
> 
> --
> 
> Ryan Blue
> 
> Software Engineer
> 
> Netflix
> 
>  
> 
> 
> 
> -- 
> Ryan Blue
> Software Engineer
> Netflix
> 
> 
> -- 
> Ryan Blue
> Software Engineer
> Netflix


Re: Extend SparkTableUtil to Handle Tables Not Tracked in Hive Metastore

Posted by Ryan Blue <rb...@netflix.com.INVALID>.
We can always consider moving interfaces from core to the API when they are
relatively stable. For SPI classes, I'm not sure there's a good reason to
do it because the API and SPI are purposely different. API is for using
Iceberg from a processing engine or data management service. SPI is for
customizing how the core table implementations work. Maybe we could move
SPI to its own module, eventually.

On Tue, Mar 19, 2019 at 8:36 PM Sandeep Nayak <os...@gmail.com> wrote:

> Thanks for pointing me in the right direction Ryan.
>
> One question comes to mind, the `TableOperations` is in the core project
> but the interface is identified as an SPI. If one were to plug in other
> metastores should we consider restricting any such extensions to be only
> against classes in api or maybe a separate spi  sub-project v/s core
> sub-project?  That pattern would allow for restricting dependencies in one
> isolated area and allowing other areas (like core) to evolve a bit more
> freely without worrying about breaking any dependents.
>
> Thoughts?
>
> -Sandeep
>
> On Tue, Mar 19, 2019 at 2:24 PM Ryan Blue <rb...@netflix.com.invalid>
> wrote:
>
>> Sandeep, we use the `TableOperations` API to plug in other metastores, as
>> well as other customizations like `FileIO` implementations. Thanks to Matt
>> and Yifei for their work extending this area!
>>
>> On Mon, Mar 18, 2019 at 8:49 PM Sandeep Nayak <os...@gmail.com> wrote:
>>
>>> To Xabriel's point, it would be good to have a Store abstraction so that
>>> one could plug-in an implementation be it HMS or something else.
>>>
>>>
>>> On Mon, Mar 18, 2019 at 3:20 PM Xabriel Collazo Mojica
>>> <xc...@adobe.com.invalid> wrote:
>>>
>>>> +1 for having a tool/API to migrate tables from HMS into Iceberg.
>>>>
>>>>
>>>>
>>>> We do not use HMS in my current project, but since HMS is the de facto
>>>> catalog in most companies doing Hadoop, I think such a tool would be vital
>>>> for incentivizing Iceberg adoption and/or PoCs.
>>>>
>>>>
>>>>
>>>> *Xabriel J Collazo Mojica*  |  Senior Software Engineer  |  Adobe  |
>>>> xcollazo@adobe.com
>>>>
>>>>
>>>>
>>>> *From: *<ao...@apple.com> on behalf of Anton Okolnychyi
>>>> <ao...@apple.com.INVALID>
>>>> *Reply-To: *"dev@iceberg.apache.org" <de...@iceberg.apache.org>
>>>> *Date: *Monday, March 18, 2019 at 2:22 PM
>>>> *To: *"dev@iceberg.apache.org" <de...@iceberg.apache.org>, Ryan Blue <
>>>> rblue@netflix.com>
>>>> *Subject: *Re: Extend SparkTableUtil to Handle Tables Not Tracked in
>>>> Hive Metastore
>>>>
>>>>
>>>>
>>>> I definitely support this idea. Having a clean and reliable API to
>>>> migrate existing Spark tables to Iceberg will be helpful.
>>>>
>>>> I propose to collect all requirements for the new API in this thread.
>>>> Then I can come up with a doc that we will discuss within the community.
>>>>
>>>>
>>>>
>>>> From the feature perspective, I think it would be important to support
>>>> tables that persist partition information in HMS as well as tables that
>>>> derive partition information from the folder structure. Also, migrating
>>>> just a partition of a table would be useful.
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> On 18 Mar 2019, at 18:28, Ryan Blue <rb...@netflix.com.INVALID> wrote:
>>>>
>>>>
>>>>
>>>> I think that would be fine, but I want to throw out a quick warning:
>>>> SparkTableUtil was initially written as a few handy helpers, so it wasn't
>>>> well designed as an API. It's really useful, so I can understand wanting to
>>>> extend it. But should we come up with a real API for these conversion tasks
>>>> instead of updating the hacks?
>>>>
>>>>
>>>>
>>>> On Mon, Mar 18, 2019 at 11:11 AM Anton Okolnychyi <
>>>> aokolnychyi@apple.com.invalid> wrote:
>>>>
>>>> Hi,
>>>>
>>>> SparkTableUtil can be helpful for migrating existing Spark tables into
>>>> Iceberg. Right now, SparkTableUtil assumes that the partition information
>>>> is always tracked in Hive metastore.
>>>>
>>>> What about extending SparkTableUtil to handle Spark tables that don’t
>>>> rely on Hive metastore? I have a local prototype that makes use of Spark
>>>> InMemoryFileIndex to infer the partitioning info.
>>>>
>>>> Thanks,
>>>> Anton
>>>>
>>>>
>>>>
>>>>
>>>> --
>>>>
>>>> Ryan Blue
>>>>
>>>> Software Engineer
>>>>
>>>> Netflix
>>>>
>>>>
>>>>
>>>
>>
>> --
>> Ryan Blue
>> Software Engineer
>> Netflix
>>
>

-- 
Ryan Blue
Software Engineer
Netflix

Re: Extend SparkTableUtil to Handle Tables Not Tracked in Hive Metastore

Posted by Sandeep Nayak <os...@gmail.com>.
Thanks for pointing me in the right direction Ryan.

One question comes to mind, the `TableOperations` is in the core project
but the interface is identified as an SPI. If one were to plug in other
metastores should we consider restricting any such extensions to be only
against classes in api or maybe a separate spi  sub-project v/s core
sub-project?  That pattern would allow for restricting dependencies in one
isolated area and allowing other areas (like core) to evolve a bit more
freely without worrying about breaking any dependents.

Thoughts?

-Sandeep

On Tue, Mar 19, 2019 at 2:24 PM Ryan Blue <rb...@netflix.com.invalid> wrote:

> Sandeep, we use the `TableOperations` API to plug in other metastores, as
> well as other customizations like `FileIO` implementations. Thanks to Matt
> and Yifei for their work extending this area!
>
> On Mon, Mar 18, 2019 at 8:49 PM Sandeep Nayak <os...@gmail.com> wrote:
>
>> To Xabriel's point, it would be good to have a Store abstraction so that
>> one could plug-in an implementation be it HMS or something else.
>>
>>
>> On Mon, Mar 18, 2019 at 3:20 PM Xabriel Collazo Mojica
>> <xc...@adobe.com.invalid> wrote:
>>
>>> +1 for having a tool/API to migrate tables from HMS into Iceberg.
>>>
>>>
>>>
>>> We do not use HMS in my current project, but since HMS is the de facto
>>> catalog in most companies doing Hadoop, I think such a tool would be vital
>>> for incentivizing Iceberg adoption and/or PoCs.
>>>
>>>
>>>
>>> *Xabriel J Collazo Mojica*  |  Senior Software Engineer  |  Adobe  |
>>> xcollazo@adobe.com
>>>
>>>
>>>
>>> *From: *<ao...@apple.com> on behalf of Anton Okolnychyi
>>> <ao...@apple.com.INVALID>
>>> *Reply-To: *"dev@iceberg.apache.org" <de...@iceberg.apache.org>
>>> *Date: *Monday, March 18, 2019 at 2:22 PM
>>> *To: *"dev@iceberg.apache.org" <de...@iceberg.apache.org>, Ryan Blue <
>>> rblue@netflix.com>
>>> *Subject: *Re: Extend SparkTableUtil to Handle Tables Not Tracked in
>>> Hive Metastore
>>>
>>>
>>>
>>> I definitely support this idea. Having a clean and reliable API to
>>> migrate existing Spark tables to Iceberg will be helpful.
>>>
>>> I propose to collect all requirements for the new API in this thread.
>>> Then I can come up with a doc that we will discuss within the community.
>>>
>>>
>>>
>>> From the feature perspective, I think it would be important to support
>>> tables that persist partition information in HMS as well as tables that
>>> derive partition information from the folder structure. Also, migrating
>>> just a partition of a table would be useful.
>>>
>>>
>>>
>>>
>>>
>>> On 18 Mar 2019, at 18:28, Ryan Blue <rb...@netflix.com.INVALID> wrote:
>>>
>>>
>>>
>>> I think that would be fine, but I want to throw out a quick warning:
>>> SparkTableUtil was initially written as a few handy helpers, so it wasn't
>>> well designed as an API. It's really useful, so I can understand wanting to
>>> extend it. But should we come up with a real API for these conversion tasks
>>> instead of updating the hacks?
>>>
>>>
>>>
>>> On Mon, Mar 18, 2019 at 11:11 AM Anton Okolnychyi <
>>> aokolnychyi@apple.com.invalid> wrote:
>>>
>>> Hi,
>>>
>>> SparkTableUtil can be helpful for migrating existing Spark tables into
>>> Iceberg. Right now, SparkTableUtil assumes that the partition information
>>> is always tracked in Hive metastore.
>>>
>>> What about extending SparkTableUtil to handle Spark tables that don’t
>>> rely on Hive metastore? I have a local prototype that makes use of Spark
>>> InMemoryFileIndex to infer the partitioning info.
>>>
>>> Thanks,
>>> Anton
>>>
>>>
>>>
>>>
>>> --
>>>
>>> Ryan Blue
>>>
>>> Software Engineer
>>>
>>> Netflix
>>>
>>>
>>>
>>
>
> --
> Ryan Blue
> Software Engineer
> Netflix
>

Re: Extend SparkTableUtil to Handle Tables Not Tracked in Hive Metastore

Posted by Ryan Blue <rb...@netflix.com.INVALID>.
Sandeep, we use the `TableOperations` API to plug in other metastores, as
well as other customizations like `FileIO` implementations. Thanks to Matt
and Yifei for their work extending this area!

On Mon, Mar 18, 2019 at 8:49 PM Sandeep Nayak <os...@gmail.com> wrote:

> To Xabriel's point, it would be good to have a Store abstraction so that
> one could plug-in an implementation be it HMS or something else.
>
>
> On Mon, Mar 18, 2019 at 3:20 PM Xabriel Collazo Mojica
> <xc...@adobe.com.invalid> wrote:
>
>> +1 for having a tool/API to migrate tables from HMS into Iceberg.
>>
>>
>>
>> We do not use HMS in my current project, but since HMS is the de facto
>> catalog in most companies doing Hadoop, I think such a tool would be vital
>> for incentivizing Iceberg adoption and/or PoCs.
>>
>>
>>
>> *Xabriel J Collazo Mojica*  |  Senior Software Engineer  |  Adobe  |
>> xcollazo@adobe.com
>>
>>
>>
>> *From: *<ao...@apple.com> on behalf of Anton Okolnychyi
>> <ao...@apple.com.INVALID>
>> *Reply-To: *"dev@iceberg.apache.org" <de...@iceberg.apache.org>
>> *Date: *Monday, March 18, 2019 at 2:22 PM
>> *To: *"dev@iceberg.apache.org" <de...@iceberg.apache.org>, Ryan Blue <
>> rblue@netflix.com>
>> *Subject: *Re: Extend SparkTableUtil to Handle Tables Not Tracked in
>> Hive Metastore
>>
>>
>>
>> I definitely support this idea. Having a clean and reliable API to
>> migrate existing Spark tables to Iceberg will be helpful.
>>
>> I propose to collect all requirements for the new API in this thread.
>> Then I can come up with a doc that we will discuss within the community.
>>
>>
>>
>> From the feature perspective, I think it would be important to support
>> tables that persist partition information in HMS as well as tables that
>> derive partition information from the folder structure. Also, migrating
>> just a partition of a table would be useful.
>>
>>
>>
>>
>>
>> On 18 Mar 2019, at 18:28, Ryan Blue <rb...@netflix.com.INVALID> wrote:
>>
>>
>>
>> I think that would be fine, but I want to throw out a quick warning:
>> SparkTableUtil was initially written as a few handy helpers, so it wasn't
>> well designed as an API. It's really useful, so I can understand wanting to
>> extend it. But should we come up with a real API for these conversion tasks
>> instead of updating the hacks?
>>
>>
>>
>> On Mon, Mar 18, 2019 at 11:11 AM Anton Okolnychyi <
>> aokolnychyi@apple.com.invalid> wrote:
>>
>> Hi,
>>
>> SparkTableUtil can be helpful for migrating existing Spark tables into
>> Iceberg. Right now, SparkTableUtil assumes that the partition information
>> is always tracked in Hive metastore.
>>
>> What about extending SparkTableUtil to handle Spark tables that don’t
>> rely on Hive metastore? I have a local prototype that makes use of Spark
>> InMemoryFileIndex to infer the partitioning info.
>>
>> Thanks,
>> Anton
>>
>>
>>
>>
>> --
>>
>> Ryan Blue
>>
>> Software Engineer
>>
>> Netflix
>>
>>
>>
>

-- 
Ryan Blue
Software Engineer
Netflix

Re: Extend SparkTableUtil to Handle Tables Not Tracked in Hive Metastore

Posted by Sandeep Nayak <os...@gmail.com>.
To Xabriel's point, it would be good to have a Store abstraction so that
one could plug-in an implementation be it HMS or something else.


On Mon, Mar 18, 2019 at 3:20 PM Xabriel Collazo Mojica
<xc...@adobe.com.invalid> wrote:

> +1 for having a tool/API to migrate tables from HMS into Iceberg.
>
>
>
> We do not use HMS in my current project, but since HMS is the de facto
> catalog in most companies doing Hadoop, I think such a tool would be vital
> for incentivizing Iceberg adoption and/or PoCs.
>
>
>
> *Xabriel J Collazo Mojica*  |  Senior Software Engineer  |  Adobe  |
> xcollazo@adobe.com
>
>
>
> *From: *<ao...@apple.com> on behalf of Anton Okolnychyi
> <ao...@apple.com.INVALID>
> *Reply-To: *"dev@iceberg.apache.org" <de...@iceberg.apache.org>
> *Date: *Monday, March 18, 2019 at 2:22 PM
> *To: *"dev@iceberg.apache.org" <de...@iceberg.apache.org>, Ryan Blue <
> rblue@netflix.com>
> *Subject: *Re: Extend SparkTableUtil to Handle Tables Not Tracked in Hive
> Metastore
>
>
>
> I definitely support this idea. Having a clean and reliable API to migrate
> existing Spark tables to Iceberg will be helpful.
>
> I propose to collect all requirements for the new API in this thread. Then
> I can come up with a doc that we will discuss within the community.
>
>
>
> From the feature perspective, I think it would be important to support
> tables that persist partition information in HMS as well as tables that
> derive partition information from the folder structure. Also, migrating
> just a partition of a table would be useful.
>
>
>
>
>
> On 18 Mar 2019, at 18:28, Ryan Blue <rb...@netflix.com.INVALID> wrote:
>
>
>
> I think that would be fine, but I want to throw out a quick warning:
> SparkTableUtil was initially written as a few handy helpers, so it wasn't
> well designed as an API. It's really useful, so I can understand wanting to
> extend it. But should we come up with a real API for these conversion tasks
> instead of updating the hacks?
>
>
>
> On Mon, Mar 18, 2019 at 11:11 AM Anton Okolnychyi <
> aokolnychyi@apple.com.invalid> wrote:
>
> Hi,
>
> SparkTableUtil can be helpful for migrating existing Spark tables into
> Iceberg. Right now, SparkTableUtil assumes that the partition information
> is always tracked in Hive metastore.
>
> What about extending SparkTableUtil to handle Spark tables that don’t rely
> on Hive metastore? I have a local prototype that makes use of Spark
> InMemoryFileIndex to infer the partitioning info.
>
> Thanks,
> Anton
>
>
>
>
> --
>
> Ryan Blue
>
> Software Engineer
>
> Netflix
>
>
>

Re: Extend SparkTableUtil to Handle Tables Not Tracked in Hive Metastore

Posted by Xabriel Collazo Mojica <xc...@adobe.com.INVALID>.
+1 for having a tool/API to migrate tables from HMS into Iceberg.

We do not use HMS in my current project, but since HMS is the de facto catalog in most companies doing Hadoop, I think such a tool would be vital for incentivizing Iceberg adoption and/or PoCs.

Xabriel J Collazo Mojica  |  Senior Software Engineer  |  Adobe  |  xcollazo@adobe.com

From: <ao...@apple.com> on behalf of Anton Okolnychyi <ao...@apple.com.INVALID>
Reply-To: "dev@iceberg.apache.org" <de...@iceberg.apache.org>
Date: Monday, March 18, 2019 at 2:22 PM
To: "dev@iceberg.apache.org" <de...@iceberg.apache.org>, Ryan Blue <rb...@netflix.com>
Subject: Re: Extend SparkTableUtil to Handle Tables Not Tracked in Hive Metastore

I definitely support this idea. Having a clean and reliable API to migrate existing Spark tables to Iceberg will be helpful.
I propose to collect all requirements for the new API in this thread. Then I can come up with a doc that we will discuss within the community.

From the feature perspective, I think it would be important to support tables that persist partition information in HMS as well as tables that derive partition information from the folder structure. Also, migrating just a partition of a table would be useful.



On 18 Mar 2019, at 18:28, Ryan Blue <rb...@netflix.com.INVALID>> wrote:

I think that would be fine, but I want to throw out a quick warning: SparkTableUtil was initially written as a few handy helpers, so it wasn't well designed as an API. It's really useful, so I can understand wanting to extend it. But should we come up with a real API for these conversion tasks instead of updating the hacks?

On Mon, Mar 18, 2019 at 11:11 AM Anton Okolnychyi <ao...@apple.com.invalid>> wrote:
Hi,

SparkTableUtil can be helpful for migrating existing Spark tables into Iceberg. Right now, SparkTableUtil assumes that the partition information is always tracked in Hive metastore.

What about extending SparkTableUtil to handle Spark tables that don’t rely on Hive metastore? I have a local prototype that makes use of Spark InMemoryFileIndex to infer the partitioning info.

Thanks,
Anton


--
Ryan Blue
Software Engineer
Netflix


Re: Extend SparkTableUtil to Handle Tables Not Tracked in Hive Metastore

Posted by Anton Okolnychyi <ao...@apple.com.INVALID>.
I definitely support this idea. Having a clean and reliable API to migrate existing Spark tables to Iceberg will be helpful.
I propose to collect all requirements for the new API in this thread. Then I can come up with a doc that we will discuss within the community.

From the feature perspective, I think it would be important to support tables that persist partition information in HMS as well as tables that derive partition information from the folder structure. Also, migrating just a partition of a table would be useful. 


> On 18 Mar 2019, at 18:28, Ryan Blue <rb...@netflix.com.INVALID> wrote:
> 
> I think that would be fine, but I want to throw out a quick warning: SparkTableUtil was initially written as a few handy helpers, so it wasn't well designed as an API. It's really useful, so I can understand wanting to extend it. But should we come up with a real API for these conversion tasks instead of updating the hacks?
> 
> On Mon, Mar 18, 2019 at 11:11 AM Anton Okolnychyi <ao...@apple.com.invalid> wrote:
> Hi,
> 
> SparkTableUtil can be helpful for migrating existing Spark tables into Iceberg. Right now, SparkTableUtil assumes that the partition information is always tracked in Hive metastore.
> 
> What about extending SparkTableUtil to handle Spark tables that don’t rely on Hive metastore? I have a local prototype that makes use of Spark InMemoryFileIndex to infer the partitioning info.
> 
> Thanks,
> Anton
> 
> 
> -- 
> Ryan Blue
> Software Engineer
> Netflix


Re: Extend SparkTableUtil to Handle Tables Not Tracked in Hive Metastore

Posted by Ryan Blue <rb...@netflix.com.INVALID>.
I think that would be fine, but I want to throw out a quick warning:
SparkTableUtil was initially written as a few handy helpers, so it wasn't
well designed as an API. It's really useful, so I can understand wanting to
extend it. But should we come up with a real API for these conversion tasks
instead of updating the hacks?

On Mon, Mar 18, 2019 at 11:11 AM Anton Okolnychyi
<ao...@apple.com.invalid> wrote:

> Hi,
>
> SparkTableUtil can be helpful for migrating existing Spark tables into
> Iceberg. Right now, SparkTableUtil assumes that the partition information
> is always tracked in Hive metastore.
>
> What about extending SparkTableUtil to handle Spark tables that don’t rely
> on Hive metastore? I have a local prototype that makes use of Spark
> InMemoryFileIndex to infer the partitioning info.
>
> Thanks,
> Anton



-- 
Ryan Blue
Software Engineer
Netflix