Expose hyperspace.index(indexName) for Python binding (#316)
This commit is contained in:
Родитель
b2b99320da
Коммит
2a1f62d060
|
@ -150,6 +150,14 @@ class Hyperspace:
|
|||
self.hyperspace.indexes(), verbose)
|
||||
redirectFunc(result_string)
|
||||
|
||||
def index(self, indexName):
|
||||
"""
|
||||
Get index metadata and detailed index statistics for a given index.
|
||||
:param indexName: index name
|
||||
:return: dataFrame object containing the index metadata and detailed index statistics.
|
||||
"""
|
||||
return DataFrame(self.hyperspace.index(indexName), self.spark._wrapped)
|
||||
|
||||
@staticmethod
|
||||
def enable(spark):
|
||||
"""
|
||||
|
|
|
@ -82,6 +82,13 @@ class HyperspaceIndexManagementTests(HyperspaceTestCase):
|
|||
self.hyperspace.optimizeIndex('idx1')
|
||||
self.hyperspace.optimizeIndex('idx1', 'full')
|
||||
|
||||
def test_index_metadata(self):
|
||||
idx_config = IndexConfig('idx1', ['name'], ['age'])
|
||||
self.hyperspace.createIndex(self.df, idx_config)
|
||||
# Test the inter-op works fine for "index" API.
|
||||
df = self.hyperspace.index('idx1')
|
||||
df.show()
|
||||
|
||||
hyperspace_test = unittest.TestLoader().loadTestsFromTestCase(HyperspaceIndexManagementTests)
|
||||
result = unittest.TextTestRunner(verbosity=3).run(hyperspace_test)
|
||||
sys.exit(not result.wasSuccessful())
|
||||
|
|
Загрузка…
Ссылка в новой задаче