'Set the input dataset to display.'

@Inputs.data
def set_dataset(self, data=None):

    self.closeContext()
    self.clear()
    self.clear_messages()
    if isinstance(data, SqlTable):
        if (data.approx_len() < 4000):
            data = Table(data)
        else:
            self.Information.sampled()
            data_sample = data.sample_time(1, no_cache=True)
            data_sample.download_data(2000, partial=True)
            data = Table(data_sample)
    if ((data is not None) and (not len(data))):
        data = None
    if ((data is not None) and sp.issparse(data.X)):
        try:
            data = data.copy()
            data.X = data.X.toarray()
        except MemoryError:
            data = None
            self.Error.not_enough_memory()
        else:
            self.Information.sparse_densified()
    input_data = data
    if ((data is not None) and (len(data.domain.attributes) == 0)):
        self.Error.no_continuous()
        input_data = data = None
    if ((data is not None) and any((var.is_discrete for var in data.domain.attributes))):
        ndisc = sum((var.is_discrete for var in data.domain.attributes))
        data = data.transform(Domain([var for var in data.domain.attributes if var.is_continuous], data.domain.class_vars, data.domain.metas))
        if (not data.domain.attributes):
            self.Error.no_continuous()
            input_data = data = None
        else:
            self.Information.discrete_ignored(ndisc, ('s' if (ndisc > 1) else ''))
    self.data = data
    self.input_data = input_data
    if (data is not None):
        variables = (self.data.domain.class_vars + self.data.domain.metas)
        variables = [var for var in variables if isinstance(var, (DiscreteVariable, StringVariable))]
        self.annotation_vars.extend(variables)
        for var in variables:
            self.annotations_cb.addItem(*gui.attributeItem(var))
        self.openContext(self.data)
        if (self.annotation_index >= len(self.annotation_vars)):
            self.annotation_index = 0
    self.update_heatmaps()
