@@ -443,9 +443,25 @@ impl From<sqlparser::ast::BinaryOperator> for BinaryOperator {
443
443
BinOp :: Question => todo ! ( ) ,
444
444
BinOp :: QuestionAnd => Self :: QuestionMarkAnd ,
445
445
BinOp :: QuestionPipe => Self :: QuestionMarkPipe ,
446
- BinOp :: Spaceship => unimplemented ! ( "<=> {value:?}" ) ,
446
+ BinOp :: Spaceship => todo ! ( ) ,
447
447
BinOp :: StringConcat => todo ! ( ) ,
448
448
BinOp :: Xor => todo ! ( ) ,
449
+ BinOp :: DoubleHash => todo ! ( ) ,
450
+ BinOp :: LtDashGt => todo ! ( ) ,
451
+ BinOp :: AndLt => todo ! ( ) ,
452
+ BinOp :: AndGt => todo ! ( ) ,
453
+ BinOp :: LtLtPipe => todo ! ( ) ,
454
+ BinOp :: PipeGtGt => todo ! ( ) ,
455
+ BinOp :: AndLtPipe => todo ! ( ) ,
456
+ BinOp :: PipeAndGt => todo ! ( ) ,
457
+ BinOp :: LtCaret => todo ! ( ) ,
458
+ BinOp :: GtCaret => todo ! ( ) ,
459
+ BinOp :: QuestionHash => todo ! ( ) ,
460
+ BinOp :: QuestionDash => todo ! ( ) ,
461
+ BinOp :: QuestionDashPipe => todo ! ( ) ,
462
+ BinOp :: QuestionDoublePipe => todo ! ( ) ,
463
+ BinOp :: At => todo ! ( ) ,
464
+ BinOp :: TildeEq => todo ! ( ) ,
449
465
}
450
466
}
451
467
}
@@ -496,20 +512,27 @@ pub enum UnaryOperator {
496
512
Not ,
497
513
}
498
514
499
- impl From < sqlparser:: ast:: UnaryOperator > for UnaryOperator {
500
- fn from ( value : sqlparser:: ast:: UnaryOperator ) -> Self {
515
+ impl TryFrom < sqlparser:: ast:: UnaryOperator > for UnaryOperator {
516
+ type Error = AstConversionError ;
517
+
518
+ fn try_from ( value : sqlparser:: ast:: UnaryOperator ) -> Result < Self , Self :: Error > {
501
519
use sqlparser:: ast:: UnaryOperator as UnOp ;
502
520
match value {
503
- UnOp :: Plus => todo ! ( ) ,
504
- UnOp :: Minus => Self :: Neg ,
505
- UnOp :: Not => Self :: Not ,
521
+ UnOp :: Plus => not_yet_implemented ! ( "Unary + operator" ) ,
522
+ UnOp :: Minus => Ok ( Self :: Neg ) ,
523
+ UnOp :: Not => Ok ( Self :: Not ) ,
506
524
UnOp :: PGBitwiseNot
507
525
| UnOp :: PGSquareRoot
508
526
| UnOp :: PGCubeRoot
509
527
| UnOp :: PGPostfixFactorial
510
528
| UnOp :: PGPrefixFactorial
511
- | UnOp :: PGAbs => unimplemented ! ( "unsupported postgres unary operator" ) ,
512
- UnOp :: BangNot => unimplemented ! ( "unsupported bang not (!)" ) ,
529
+ | UnOp :: PGAbs => unsupported ! ( "unsupported postgres unary operator" ) ,
530
+ UnOp :: BangNot
531
+ | UnOp :: Hash
532
+ | UnOp :: AtDashAt
533
+ | UnOp :: DoubleAt
534
+ | UnOp :: QuestionDash
535
+ | UnOp :: QuestionPipe => unsupported ! ( "unsupported unary operator {value}" ) ,
513
536
}
514
537
}
515
538
}
@@ -796,6 +819,7 @@ impl TryFromDialect<sqlparser::ast::Expr> for Expr {
796
819
expr,
797
820
data_type,
798
821
format : _, // TODO: I think this is where we would support `AT TIMEZONE` syntax
822
+ mysql_style_int : _, // TODO: We render this incorrectly
799
823
} => Ok ( Self :: Cast {
800
824
expr : expr. try_into_dialect ( dialect) ?,
801
825
ty : data_type. try_into_dialect ( dialect) ?,
@@ -1002,7 +1026,7 @@ impl TryFromDialect<sqlparser::ast::Expr> for Expr {
1002
1026
} ) ,
1003
1027
} ,
1004
1028
UnaryOp { op, expr } => Ok ( Self :: UnaryOp {
1005
- op : op. into ( ) ,
1029
+ op : op. try_into ( ) ? ,
1006
1030
rhs : expr. try_into_dialect ( dialect) ?,
1007
1031
} ) ,
1008
1032
Value ( value) => Ok ( Self :: Literal ( value. try_into ( ) ?) ) ,
0 commit comments