2727import org .apache .paimon .disk .IOManager ;
2828import org .apache .paimon .fs .FileIO ;
2929import org .apache .paimon .index .DeletionVectorMeta ;
30+ import org .apache .paimon .index .GlobalIndexMeta ;
3031import org .apache .paimon .index .IndexFileHandler ;
3132import org .apache .paimon .index .IndexFileMetaSerializer ;
3233import org .apache .paimon .manifest .IndexManifestEntry ;
@@ -84,9 +85,11 @@ public class TableIndexesTable implements ReadonlyTable {
8485 new DataField (4 , "file_size" , new BigIntType (false )),
8586 new DataField (5 , "row_count" , new BigIntType (false )),
8687 new DataField (
87- 6 ,
88- "dv_ranges" ,
89- new ArrayType (true , DeletionVectorMeta .SCHEMA ))));
88+ 6 , "dv_ranges" , new ArrayType (true , DeletionVectorMeta .SCHEMA )),
89+ new DataField (7 , "row_range_start" , new BigIntType (true )),
90+ new DataField (8 , "row_range_end" , new BigIntType (true )),
91+ new DataField (9 , "index_field_id" , new IntType (true )),
92+ new DataField (10 , "index_field_name" , newStringType (true ))));
9093
9194 private final FileStoreTable dataTable ;
9295
@@ -201,10 +204,16 @@ public RecordReader<InternalRow> createReader(Split split) {
201204 CastExecutors .resolveToString (
202205 dataTable .schema ().logicalPartitionType ());
203206
207+ RowType logicalRowType = dataTable .schema ().logicalRowType ();
208+
204209 Iterator <InternalRow > rows =
205210 Iterators .transform (
206211 manifestFileMetas .iterator (),
207- indexManifestEntry -> toRow (indexManifestEntry , partitionCastExecutor ));
212+ indexManifestEntry ->
213+ toRow (
214+ indexManifestEntry ,
215+ partitionCastExecutor ,
216+ logicalRowType ));
208217 if (readType != null ) {
209218 rows =
210219 Iterators .transform (
@@ -218,9 +227,18 @@ public RecordReader<InternalRow> createReader(Split split) {
218227
219228 private InternalRow toRow (
220229 IndexManifestEntry indexManifestEntry ,
221- CastExecutor <InternalRow , BinaryString > partitionCastExecutor ) {
230+ CastExecutor <InternalRow , BinaryString > partitionCastExecutor ,
231+ RowType logicalRowType ) {
222232 LinkedHashMap <String , DeletionVectorMeta > dvMetas =
223233 indexManifestEntry .indexFile ().dvRanges ();
234+ GlobalIndexMeta globalMeta = indexManifestEntry .indexFile ().globalIndexMeta ();
235+ String indexFieldName = null ;
236+ if (globalMeta != null ) {
237+ try {
238+ indexFieldName = logicalRowType .getField (globalMeta .indexFieldId ()).name ();
239+ } catch (RuntimeException ignored ) {
240+ }
241+ }
224242 return GenericRow .of (
225243 partitionCastExecutor .cast (indexManifestEntry .partition ()),
226244 indexManifestEntry .bucket (),
@@ -230,7 +248,11 @@ private InternalRow toRow(
230248 indexManifestEntry .indexFile ().rowCount (),
231249 dvMetas == null
232250 ? null
233- : IndexFileMetaSerializer .dvMetasToRowArrayData (dvMetas .values ()));
251+ : IndexFileMetaSerializer .dvMetasToRowArrayData (dvMetas .values ()),
252+ globalMeta != null ? globalMeta .rowRangeStart () : null ,
253+ globalMeta != null ? globalMeta .rowRangeEnd () : null ,
254+ globalMeta != null ? globalMeta .indexFieldId () : null ,
255+ indexFieldName != null ? BinaryString .fromString (indexFieldName ) : null );
234256 }
235257 }
236258
0 commit comments