mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2025-09-24 06:43:37 +08:00
fix decoding data
This commit is contained in:
@@ -1881,14 +1881,16 @@ func (e *SQLEngine) eachLogEntryInFile(filerClient filer_pb.FilerClient, filePat
|
|||||||
|
|
||||||
// convertLogEntryToRecordValue helper method (reuse existing logic)
|
// convertLogEntryToRecordValue helper method (reuse existing logic)
|
||||||
func (e *SQLEngine) convertLogEntryToRecordValue(logEntry *filer_pb.LogEntry) (*schema_pb.RecordValue, string, error) {
|
func (e *SQLEngine) convertLogEntryToRecordValue(logEntry *filer_pb.LogEntry) (*schema_pb.RecordValue, string, error) {
|
||||||
// Parse the log entry data as JSON
|
// Parse the log entry data as Protocol Buffer (not JSON!)
|
||||||
var jsonData map[string]interface{}
|
recordValue := &schema_pb.RecordValue{}
|
||||||
if err := json.Unmarshal(logEntry.Data, &jsonData); err != nil {
|
if err := proto.Unmarshal(logEntry.Data, recordValue); err != nil {
|
||||||
return nil, "", fmt.Errorf("failed to parse log entry JSON: %v", err)
|
return nil, "", fmt.Errorf("failed to unmarshal log entry protobuf: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create record value with system and user fields
|
// Ensure Fields map exists
|
||||||
recordValue := &schema_pb.RecordValue{Fields: make(map[string]*schema_pb.Value)}
|
if recordValue.Fields == nil {
|
||||||
|
recordValue.Fields = make(map[string]*schema_pb.Value)
|
||||||
|
}
|
||||||
|
|
||||||
// Add system columns
|
// Add system columns
|
||||||
recordValue.Fields[SW_COLUMN_NAME_TS] = &schema_pb.Value{
|
recordValue.Fields[SW_COLUMN_NAME_TS] = &schema_pb.Value{
|
||||||
|
Reference in New Issue
Block a user