@@ -76,6 +76,39 @@ public void CreateIndex(DataFrame df, IndexConfig indexConfig) =>
7676 [ HyperspaceSince ( HyperspaceVersions . V0_0_1 ) ]
7777 public void RefreshIndex ( string indexName ) => _jvmObject . Invoke ( "refreshIndex" , indexName ) ;
7878
79+ /// <summary>
80+ /// Update indexes for the latest version of the data. This API provides a few supported refresh
81+ /// modes as listed below.
82+ /// </summary>
83+ /// <param name="indexName">Name of the index to refresh.</param>
84+ /// <param name="mode">Refresh mode. Currently supported modes are <c>incremental</c> and
85+ /// <c>full</c>.</param>
86+ [ HyperspaceSince ( HyperspaceVersions . V0_0_3 ) ]
87+ public void RefreshIndex ( string indexName , string mode ) =>
88+ _jvmObject . Invoke ( "refreshIndex" , indexName , mode ) ;
89+
90+ /// <summary>
91+ /// Optimize index by changing the underlying index data layout (e.g., compaction).
92+ ///
93+ /// Note: This API does NOT refresh (i.e. update) the index if the underlying data changes. It only
94+ /// rearranges the index data into a better layout, by compacting small index files. The index files
95+ /// larger than a threshold remain untouched to avoid rewriting large contents.
96+ ///
97+ /// <c>quick</c> optimize mode is used by default.
98+ ///
99+ /// Available modes:
100+ /// <c>quick</c> mode: This mode allows for fast optimization. Files smaller than a predefined
101+ /// threshold <c>spark.hyperspace.index.optimize.fileSizeThreshold</c> will be picked for compaction.
102+ ///
103+ /// <c>full</c> mode: This allows for slow but complete optimization. ALL index files are picked for
104+ /// compaction.
105+ /// </summary>
106+ /// <param name="indexName">Name of the index to optimize.</param>
107+ /// <param name="mode">Optimize mode <c>quick</c> or <c>full</c>.</param>
108+ [ HyperspaceSince ( HyperspaceVersions . V0_0_3 ) ]
109+ public void OptimizeIndex ( string indexName , string mode = "quick" ) =>
110+ _jvmObject . Invoke ( "optimizeIndex" , indexName , mode ) ;
111+
79112 /// <summary>
80113 /// Cancel api to bring back index from an inconsistent state to the last known stable
81114 /// state.
@@ -120,5 +153,14 @@ public void Explain(DataFrame df, bool verbose, Action<string> redirectFunc)
120153 verbose ) ;
121154 redirectFunc ( explainString ) ;
122155 }
156+
157+ /// <summary>
158+ /// Get index metadata and detailed index statistics for a given index.
159+ /// </summary>
160+ /// <param name="indexName">Name of the index to get stats for.</param>
161+ /// <returns>Index metadata and statistics as a <see cref="DataFrame"/>.</returns>
162+ [ HyperspaceSince ( HyperspaceVersions . V0_0_4 ) ]
163+ public DataFrame Index ( string indexName ) =>
164+ new DataFrame ( ( JvmObjectReference ) _jvmObject . Invoke ( "index" , indexName ) ) ;
123165 }
124166}
0 commit comments