-
Notifications
You must be signed in to change notification settings - Fork 5.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add unit tests for partition versioning enabled Metastore
- Loading branch information
1 parent
584fd8c
commit 4b8021f
Showing
3 changed files
with
130 additions
and
3 deletions.
There are no files selected for viewing
51 changes: 51 additions & 0 deletions
51
presto-hive-metastore/src/test/java/com/facebook/presto/hive/MockHiveMetastore.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
/* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package com.facebook.presto.hive; | ||
|
||
import com.facebook.presto.common.predicate.Domain; | ||
import com.facebook.presto.hive.metastore.Column; | ||
import com.facebook.presto.hive.metastore.PartitionNameWithVersion; | ||
import com.facebook.presto.hive.metastore.thrift.ThriftHiveMetastore; | ||
import com.facebook.presto.spi.PrestoException; | ||
import org.apache.thrift.TException; | ||
|
||
import java.util.List; | ||
import java.util.Map; | ||
|
||
import static com.facebook.presto.hive.HiveErrorCode.HIVE_METASTORE_ERROR; | ||
import static com.facebook.presto.hive.metastore.TestCachingHiveMetastore.MockHiveCluster; | ||
import static java.util.Objects.requireNonNull; | ||
|
||
public class MockHiveMetastore | ||
extends ThriftHiveMetastore | ||
{ | ||
private final MockHiveCluster clientProvider; | ||
|
||
public MockHiveMetastore(MockHiveCluster mockHiveCluster) | ||
{ | ||
super(mockHiveCluster); | ||
this.clientProvider = requireNonNull(mockHiveCluster, "mockHiveCluster is null"); | ||
} | ||
|
||
@Override | ||
public List<PartitionNameWithVersion> getPartitionNamesWithVersionByFilter(String databaseName, String tableName, Map<Column, Domain> partitionPredicates) | ||
{ | ||
try { | ||
return clientProvider.createPartitionVersionSupportedMetastoreClient().getPartitionNamesWithVersionByFilter(databaseName, tableName, partitionPredicates); | ||
} | ||
catch (TException e) { | ||
throw new PrestoException(HIVE_METASTORE_ERROR, e); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters