@@ -175,7 +175,7 @@ func (m *timestampPredicateMapper) verify(expr physical.Expression) error {
175
175
if ! okRHS {
176
176
return fmt .Errorf ("invalid RHS for comparison: expected literal timestamp, got %T" , binop .Right )
177
177
}
178
- if rhsLit .ValueType () != datatype .Timestamp {
178
+ if rhsLit .ValueType () != datatype .Loki . Timestamp {
179
179
return fmt .Errorf ("unsupported literal type for RHS: %s, expected timestamp" , rhsLit .ValueType ())
180
180
}
181
181
return nil
@@ -231,11 +231,12 @@ func (m *timestampPredicateMapper) rebound(op types.BinaryOp, rightExpr physical
231
231
return fmt .Errorf ("internal error: rebound expected LiteralExpr, got %T for: %s" , rightExpr , rightExpr .String ())
232
232
}
233
233
234
- if literalExpr .ValueType () != datatype .Timestamp {
234
+ if literalExpr .ValueType () != datatype .Loki . Timestamp {
235
235
// Also should be caught by verify.
236
236
return fmt .Errorf ("internal error: unsupported literal type in rebound: %s, expected timestamp" , literalExpr .ValueType ())
237
237
}
238
- val := literalExpr .Literal .(* datatype.TimestampLiteral ).Value ()
238
+ v := literalExpr .Literal .(datatype.TimestampLiteral ).Value ()
239
+ val := time .Unix (0 , int64 (v )).UTC ()
239
240
240
241
switch op {
241
242
case types .BinaryOpEq : // ts == val
@@ -334,10 +335,10 @@ func mapMetadataPredicate(expr physical.Expression) (logs.RowPredicate, error) {
334
335
if ! ok { // Should not happen
335
336
return nil , fmt .Errorf ("RHS of EQ metadata predicate failed to cast to LiteralExpr" )
336
337
}
337
- if rightLiteral .ValueType () != datatype .String {
338
+ if rightLiteral .ValueType () != datatype .Loki . String {
338
339
return nil , fmt .Errorf ("unsupported RHS literal type (%v) for EQ metadata predicate, expected ValueTypeStr" , rightLiteral .ValueType ())
339
340
}
340
- val := rightLiteral .Literal .(* datatype.StringLiteral ).Value ()
341
+ val := rightLiteral .Literal .(datatype.StringLiteral ).Value ()
341
342
342
343
return logs.MetadataMatcherRowPredicate {
343
344
Key : leftColumn .Ref .Column ,
@@ -510,9 +511,9 @@ func rhsValue(e *physical.BinaryExpr) (string, error) {
510
511
if ! ok { // Should not happen
511
512
return "" , fmt .Errorf ("RHS of %s message predicate failed to cast to LiteralExpr" , op )
512
513
}
513
- if rightLiteral .ValueType () != datatype .String {
514
+ if rightLiteral .ValueType () != datatype .Loki . String {
514
515
return "" , fmt .Errorf ("unsupported RHS literal type (%v) for %s message predicate, expected ValueTypeStr" , rightLiteral .ValueType (), op )
515
516
}
516
517
517
- return rightLiteral .Literal .(* datatype.StringLiteral ).Value (), nil
518
+ return rightLiteral .Literal .(datatype.StringLiteral ).Value (), nil
518
519
}
0 commit comments