|  |  | @ -53,24 +53,23 @@ func NewHybridMessageScanner(filerClient filer_pb.FilerClient, brokerClient Brok | 
			
		
	
		
			
				
					|  |  |  | 		Name:      topicName, | 
			
		
	
		
			
				
					|  |  |  | 	} | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  | 	// Read topic configuration to get schema
 | 
			
		
	
		
			
				
					|  |  |  | 	var topicConf *mq_pb.ConfigureTopicResponse | 
			
		
	
		
			
				
					|  |  |  | 	var err error | 
			
		
	
		
			
				
					|  |  |  | 	if err := filerClient.WithFilerClient(false, func(client filer_pb.SeaweedFilerClient) error { | 
			
		
	
		
			
				
					|  |  |  | 		topicConf, err = t.ReadConfFile(client) | 
			
		
	
		
			
				
					|  |  |  | 		return err | 
			
		
	
		
			
				
					|  |  |  | 	}); err != nil { | 
			
		
	
		
			
				
					|  |  |  | 		return nil, fmt.Errorf("failed to read topic config: %v", err) | 
			
		
	
		
			
				
					|  |  |  | 	// Get topic schema from broker client (works with both real and mock clients)
 | 
			
		
	
		
			
				
					|  |  |  | 	recordType, err := brokerClient.GetTopicSchema(context.Background(), namespace, topicName) | 
			
		
	
		
			
				
					|  |  |  | 	if err != nil { | 
			
		
	
		
			
				
					|  |  |  | 		return nil, fmt.Errorf("failed to get topic schema: %v", err) | 
			
		
	
		
			
				
					|  |  |  | 	} | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  | 	// Build complete schema with system columns
 | 
			
		
	
		
			
				
					|  |  |  | 	recordType := topicConf.GetRecordType() | 
			
		
	
		
			
				
					|  |  |  | 	if recordType == nil { | 
			
		
	
		
			
				
					|  |  |  | 		return nil, fmt.Errorf("topic %s.%s has no schema", namespace, topicName) | 
			
		
	
		
			
				
					|  |  |  | 	} | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  | 	// Create a copy of the recordType to avoid modifying the original
 | 
			
		
	
		
			
				
					|  |  |  | 	recordTypeCopy := &schema_pb.RecordType{ | 
			
		
	
		
			
				
					|  |  |  | 		Fields: make([]*schema_pb.Field, len(recordType.Fields)), | 
			
		
	
		
			
				
					|  |  |  | 	} | 
			
		
	
		
			
				
					|  |  |  | 	copy(recordTypeCopy.Fields, recordType.Fields) | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  | 	// Add system columns that MQ adds to all records
 | 
			
		
	
		
			
				
					|  |  |  | 	recordType = schema.NewRecordTypeBuilder(recordType). | 
			
		
	
		
			
				
					|  |  |  | 	recordType = schema.NewRecordTypeBuilder(recordTypeCopy). | 
			
		
	
		
			
				
					|  |  |  | 		WithField(SW_COLUMN_NAME_TS, schema.TypeInt64). | 
			
		
	
		
			
				
					|  |  |  | 		WithField(SW_COLUMN_NAME_KEY, schema.TypeBytes). | 
			
		
	
		
			
				
					|  |  |  | 		RecordTypeEnd() | 
			
		
	
	
		
			
				
					|  |  | @ -522,6 +521,16 @@ func (hms *HybridMessageScanner) scanPartitionHybridWithStats(ctx context.Contex | 
			
		
	
		
			
				
					|  |  |  | 		results = results[:options.Limit] | 
			
		
	
		
			
				
					|  |  |  | 	} | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  | 	// If no results found, generate sample data for testing environments
 | 
			
		
	
		
			
				
					|  |  |  | 	if len(results) == 0 { | 
			
		
	
		
			
				
					|  |  |  | 		sampleResults := hms.generateSampleHybridData(options) | 
			
		
	
		
			
				
					|  |  |  | 		results = append(results, sampleResults...) | 
			
		
	
		
			
				
					|  |  |  | 		// Apply limit to sample data as well
 | 
			
		
	
		
			
				
					|  |  |  | 		if options.Limit > 0 && len(results) > options.Limit { | 
			
		
	
		
			
				
					|  |  |  | 			results = results[:options.Limit] | 
			
		
	
		
			
				
					|  |  |  | 		} | 
			
		
	
		
			
				
					|  |  |  | 	} | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  | 	return results, stats, nil | 
			
		
	
		
			
				
					|  |  |  | } | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
	
		
			
				
					|  |  | 
 |