@cached_property
def schema(self):
    names = []
    types = []
    for e in (self.by + self.metrics):
        if isinstance(e, ir.DestructValue):
            struct_type = e.type()
            for name in struct_type.names:
                names.append(name)
                types.append(struct_type[name])
        else:
            names.append(e.get_name())
            types.append(e.type())
    return Schema(names, types)
@cached_property
def schema(self):
    names = []
    types = []
    for e in (self.by + self.metrics):
        if isinstance(e, ir.DestructValue):
            struct_type = e.type()
            for name in struct_type.names:
                names.append(name)
                types.append(struct_type[name])
        else:
            names.append(e.get_name())
            types.append(e.type())
    return Schema(names, types)