Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ operatorsArr.forEach(op => {
});

const propTypes = {
choices: PropTypes.array,
changeFilter: PropTypes.func,
removeFilter: PropTypes.func,
filter: PropTypes.object.isRequired,
Expand All @@ -32,7 +31,6 @@ const propTypes = {
const defaultProps = {
changeFilter: () => {},
removeFilter: () => {},
choices: [],
datasource: null,
};

Expand All @@ -54,8 +52,7 @@ export default class Filter extends React.Component {
type: 'GET',
url: `/superset/filter/${datasource.type}/${datasource.id}/${col}/`,
success: (data) => {
this.props.changeFilter('choices', data);
this.setState({ valuesLoading: false });
this.setState({ valuesLoading: false, valueChoices: data });
},
});
}
Expand Down Expand Up @@ -100,7 +97,7 @@ export default class Filter extends React.Component {
name="filter-value"
value={filter.val}
isLoading={this.state.valuesLoading}
choices={filter.choices}
choices={this.state.valueChoices}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

curious, why not call this choices rather than valueChoices?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there's another colChoices variable somewhere in the in the code of this component that represent the column name choices. I decided to be a bit more specific since I was a tiny bit confused while reading the code.

onChange={this.changeSelect.bind(this)}
/>
);
Expand Down
9 changes: 6 additions & 3 deletions superset/connectors/druid/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -709,8 +709,7 @@ def values_for_column(self,
client = self.cluster.get_pydruid_client()
client.topn(**qry)
df = client.export_pandas()

return [row[0] for row in df.to_records(index=False)]
return [row[column_name] for row in df.to_records(index=False)]

def get_query_str( # noqa / druid
self,
Expand Down Expand Up @@ -981,7 +980,11 @@ def get_filters(self, raw_filters): # noqa
eq = flt['val']
cond = None
if op in ('in', 'not in'):
eq = [types.replace("'", '').strip() for types in eq]
eq = [
types.replace("'", '').strip()
if isinstance(types, basestring)
else types
for types in eq]
elif not isinstance(flt['val'], basestring):
eq = eq[0] if len(eq) > 0 else ''
if col in self.num_cols:
Expand Down