@@ -584,6 +584,59 @@ describe('function AST nodes', () => {
584584 ] ,
585585 } ) ;
586586 } ) ;
587+
588+ it ( 'IN ts subquery' , ( ) => {
589+ const query = 'FROM a | WHERE a IN (TS b | KEEP c)' ;
590+ const { root, errors } = parse ( query ) ;
591+ const expression = Walker . findFunction ( root , ( { name } ) => name === 'in' ) ;
592+
593+ expect ( errors . length ) . toBe ( 0 ) ;
594+ expect ( expression ?. args . length ) . toBe ( 2 ) ;
595+ expect ( expression ) . toMatchObject ( {
596+ type : 'function' ,
597+ subtype : 'binary-expression' ,
598+ name : 'in' ,
599+ args : [
600+ { type : 'column' , name : 'a' } ,
601+ {
602+ type : 'parens' ,
603+ child : {
604+ type : 'query' ,
605+ commands : [
606+ { type : 'command' , name : 'ts' } ,
607+ { type : 'command' , name : 'keep' } ,
608+ ] ,
609+ } ,
610+ } ,
611+ ] ,
612+ } ) ;
613+ } ) ;
614+
615+ it ( 'NOT IN ts subquery' , ( ) => {
616+ const query = 'FROM a | WHERE a NOT IN (TS b | KEEP c)' ;
617+ const { root, errors } = parse ( query ) ;
618+ const expression = Walker . findFunction ( root , ( { name } ) => name === 'not in' ) ;
619+
620+ expect ( errors . length ) . toBe ( 0 ) ;
621+ expect ( expression ) . toMatchObject ( {
622+ type : 'function' ,
623+ subtype : 'binary-expression' ,
624+ name : 'not in' ,
625+ args : [
626+ { type : 'column' , name : 'a' } ,
627+ {
628+ type : 'parens' ,
629+ child : {
630+ type : 'query' ,
631+ commands : [
632+ { type : 'command' , name : 'ts' } ,
633+ { type : 'command' , name : 'keep' } ,
634+ ] ,
635+ } ,
636+ } ,
637+ ] ,
638+ } ) ;
639+ } ) ;
587640 } ) ;
588641 } ) ;
589642} ) ;
0 commit comments