/*
syntax = 'proto3';

import "yt/yt_proto/yt/formats/extension.proto";

message Test {
    bytes Any = 1 [(NYT.flags) = ANY];
    string x = 2;
}
*/

$config = @@{
  "name": "Test",
  "format": "json",
  "skip": 0,
  "lists": {
    "optional": false
  },
  "meta": "eNrFWltvG8cVDq8iDyVquZJtRo7rhEks2YmpwLlWbtPwspLp8NYlmUQGgsWKHFFrk7vM7tI2jaIo0Kc+9rUoiqIvAfoDChR9aVCgjwUKtHlqgaIt0P6EPvbMzO5ylxeLCZAkDwr3zLnNmW/mnDNj+MNteL5vGP0B2R+Zhm2cjE/3e8TqmtrINsw8o4mbnCPvcuRqkDnUBqTsMbaILb4D0VMkZkPPR/ZSt17KzwjlgxJNSpaZRO7fUdhaMCqKENXVIdUY2kvK7LeYhbWR2n2g9kk2zMjup/gtgB4ZEb1H9O4kG0EvkrKPIr4CmdH4ZKB1FR8bIFtMFvhAecq8C5uPiPrAz5pirGlK9jGWYH1ILAsdUOzJiGSjbPbPz81+duYpR6qNQmIBkkQfD7mG2JL4ScgxqyVBxRwVaxYxH2pdko0zBbtzClp8fFaHK4dTSZLHNtEtzdCza0zJywtWkQx6syqmcuJbsGaMbPxlZRO4Pqlbzy0EQoPzyC6zWAHBMsZmlyhdo0cUTT81skmm4Or8RBhjCfkqyCanrcC3eBHi1kS31cfZdYYQ5yv32zhsrgKx2xA7pbNEgH2BGHCZYBDjXzKIBUjpxLJJjyMisiKmgAvNQyr6pSD1EWx6LimmqvddbO6f50lecuVkKianSeBbLAMYOjFOcXt1B4iTxVFqUJa5KBmc2h2I355CbW0JUmp8k82hrQNpk1DcY4j5zJLMify5M5MdMT6xDdP/Kb4IHkFhsAJ2Cq27xDrSdp5AOhgecRtilq2aNkNhTOYfogARPGTYKReT6U/xvemEI2zC1+ZXNKB5dt47b8NGYAKrms79AC4sVI0g2R7rmm4Tc2QSilhuKvuftSWY6/i5uRZ5azxPvJFM/HdN+BH+F859FoftRXtm4fbF7Y8IPiEmC1JMdr5wR8QG6g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yYoHrLi4ERxRFhW66MXr93bV/ESlr483baIO8+Z4f3GigjNITGxuYGfFZJZ7FaJtYtmY4CMFfcI6tPVi9Jd/v/yMTAl4UoceO2k99Pgkzt8j/w99CcIy",
  "view": {
    "recursion": "fail",
    "enum": "number",
    "yt_mode": true
  }
}
@@;

$udfParse = Udf(Protobuf::Parse, $config as TypeConfig);
$udfSerialize = Udf(Protobuf::Serialize, $config as TypeConfig);

$data = @@
{
    "Any": "<x=y>{a=1;b=c}",
    "x": "aaa"
}
@@;

SELECT
    $data,
    $udfParse($data),
    $udfSerialize($udfParse($data)),
    Ensure("Success", StablePickle($udfParse($data)) == StablePickle($udfParse($udfSerialize($udfParse($data)))), "Fail")
;
