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

Add support for Hive auto.purge property #955

Closed
electrum opened this issue Jun 10, 2019 · 3 comments · Fixed by #9457
Closed

Add support for Hive auto.purge property #955

electrum opened this issue Jun 10, 2019 · 3 comments · Fixed by #9457
Labels
good first issue Good for newcomers

Comments

@electrum
Copy link
Member

Hive has a boolean table property auto.purge which we should expose as a Presto table property in the Hive connector.

See https://issues.apache.org/jira/browse/HIVE-9118

@electrum electrum added the good first issue Good for newcomers label Jun 10, 2019
@tusharag171
Copy link

Working on this

@findepi
Copy link
Member

findepi commented Jun 11, 2019

@electrum is this issue only about exposing a property, or about changing behavior?
If the former, I'd consider #954

@sshardool
Copy link
Contributor

sshardool commented Jun 11, 2019

The behavior of skipping the .Trash during the table drop can be achieved in at least two different ways (which are not mutually exclusive)
(1) Provide an auto.purge property during table creation
(2) Setting the property ifPurge in the environment context during table drop

I started making changes for (2) but I made them in a manner such that the decision to skip the Trash could be made based on session property configuration. As a result I passed a ConnectorSession reference all the way to the ThriftHiveMetastoreClient.
Modified ThriftHiveMetastoreClient::dropTable looks like this:

    @Override
    public void dropTable(String databaseName, String name, boolean deleteData, Optional<ConnectorSession> session)
            throws TException
    {
        if (session.isPresent() && session.get().getProperty(HiveSessionProperties.PURGE_TABLE_DATA_ON_DROP, Boolean.class)) {
            EnvironmentContext envContext = new EnvironmentContext(ImmutableMap.of("ifPurge", "true"));
            client.drop_table_with_environment_context(databaseName, name, deleteData, envContext);
        }
        else {
            client.drop_table(databaseName, name, deleteData);
        }
    }

If there is interest I can look into creating a PR for this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
4 participants