(
(let $1 (ListType (StructType '('bc_type (DataType 'String)) '('"permalink" (OptionalType (DataType 'Int64))))))
(let $2 (DqPhyStage '() (lambda '() (block '(
  (let $6 '@@["StructType";[["bc_type_tuple";["TupleType";[["DataType";"String"];["DataType";"String"]]]];["parsed_answers_and_clicks";["ListType";["TupleType";[["OptionalType";["DataType";"Int64"]];["DataType";"Int32"];["OptionalType";["DataType";"String"]]]]]]]]@@)
  (let $7 (YqlRowSpec '('NativeYtTypeFlags '0) '('StrictSchema '1) '('UniqueKeys '0) '('Type $6)))
  (let $8 (YtMeta '('CanWrite '1) '('DoesExist '1) '('YqlCompatibleScheme '1) '('InferredScheme '0) '('IsDynamic '0) '('Attrs '('('"native_strict_schema" '"false")))))
  (let $9 (YtStat '('Id '"Input") '('RecordsCount '"8") '('DataSize '"1276") '('ChunkCount '1) '('ModifyTime '0) '('Revision '0)))
  (let $10 (YtTable '"Input" $7 $8 $9 '() (Void) (Void) '"/Root/plato"))
  (let $11 (YtReadTable! world (DataSource '"yt" '"/Root/plato") '((YtSection '((YtPath $10 '('bc_type_tuple 'parsed_answers_and_clicks) (Void) (Void))) '()))))
  (return (FromFlow (NarrowFlatMap (DqReadWideWrap $11 '()) (lambda '($12 $13) (FlatMap (Collect $13) (lambda '($14) (block '(
    (let $15 '('"permalink" (Nth $14 '0)))
    (return (If (== (Nth $14 '1) (Int32 '1)) (AsList (AsStruct '('bc_type (Nth $12 '0)) $15) (AsStruct '('bc_type (String '"total")) $15)) (List $1)))
  ))))))))
))) '('('"_logical_id" '2321) '('"_id" '"a3e310d3-17852f4-d34f33a4-e5912a5b"))))
(let $3 (DqCnUnionAll (TDqOutput $2 '0)))
(let $4 (DqPhyStage '($3) (lambda '($16) $16) '('('"_logical_id" '2400) '('"_id" '"cc55d421-d7eb9cf-a40e7023-cfca88bf"))))
(let $5 (DqCnResult (TDqOutput $4 '0) '('bc_type '"permalink")))
(return (KqpPhysicalQuery '((KqpPhysicalTx '($2 $4) '($5) '() '('('"type" '"generic")))) '((KqpTxResultBinding $1 '0 '0)) '('('"type" '"query"))))
)
