SelectWithUnionQuery (children 1)
 ExpressionList (children 1)
  SelectQuery (children 4)
   ExpressionList (children 2)
    Identifier loyalty
    Function count (children 1)
     ExpressionList
   TablesInSelectQuery (children 2)
    TablesInSelectQueryElement (children 1)
     TableExpression (children 1)
      Subquery (children 1)
       SelectWithUnionQuery (children 1)
        ExpressionList (children 1)
         SelectQuery (children 2)
          ExpressionList (children 1)
           Identifier UserID
          TablesInSelectQuery (children 1)
           TablesInSelectQueryElement (children 1)
            TableExpression (children 1)
             TableIdentifier test.hits
    TablesInSelectQueryElement (children 2)
     TableExpression (children 1)
      Subquery (children 1)
       SelectWithUnionQuery (children 1)
        ExpressionList (children 1)
         SelectQuery (children 5)
          ExpressionList (children 4)
           Identifier UserID
           Function sum (alias yandex) (children 1)
            ExpressionList (children 1)
             Function equals (children 1)
              ExpressionList (children 2)
               Identifier SearchEngineID
               Literal UInt64_2
           Function sum (alias google) (children 1)
            ExpressionList (children 1)
             Function equals (children 1)
              ExpressionList (children 2)
               Identifier SearchEngineID
               Literal UInt64_3
           Function toInt8 (alias loyalty) (children 1)
            ExpressionList (children 1)
             Function multiply (children 1)
              ExpressionList (children 2)
               Function if (children 1)
                ExpressionList (children 3)
                 Function greater (children 1)
                  ExpressionList (children 2)
                   Identifier yandex
                   Identifier google
                 Function divide (children 1)
                  ExpressionList (children 2)
                   Identifier yandex
                   Function plus (children 1)
                    ExpressionList (children 2)
                     Identifier yandex
                     Identifier google
                 Function divide (children 1)
                  ExpressionList (children 2)
                   Function negate (children 1)
                    ExpressionList (children 1)
                     Identifier google
                   Function plus (children 1)
                    ExpressionList (children 2)
                     Identifier yandex
                     Identifier google
               Literal UInt64_10
          TablesInSelectQuery (children 1)
           TablesInSelectQueryElement (children 1)
            TableExpression (children 1)
             TableIdentifier test.hits
          Function or (children 1)
           ExpressionList (children 2)
            Function equals (children 1)
             ExpressionList (children 2)
              Identifier SearchEngineID
              Literal UInt64_2
            Function equals (children 1)
             ExpressionList (children 2)
              Identifier SearchEngineID
              Literal UInt64_3
          ExpressionList (children 1)
           Identifier UserID
          Function greater (children 1)
           ExpressionList (children 2)
            Function plus (children 1)
             ExpressionList (children 2)
              Identifier yandex
              Identifier google
            Literal UInt64_10
     TableJoin (children 1)
      ExpressionList (children 1)
       Identifier UserID
   ExpressionList (children 1)
    Identifier loyalty
   ExpressionList (children 1)
    OrderByElement (children 1)
     Identifier loyalty
