Rules and structs for functions pig sample