New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(explore): Explore page boolean filter is broken for Presto DB #14952
fix(explore): Explore page boolean filter is broken for Presto DB #14952
Conversation
@m-ajay Thanks for the fix. I tested this PR in dev environment. it works as expected. You can add more description and it will be ready for code review. |
Codecov Report
@@ Coverage Diff @@
## master #14952 +/- ##
==========================================
- Coverage 77.51% 77.36% -0.16%
==========================================
Files 966 967 +1
Lines 49615 49740 +125
Branches 6311 6351 +40
==========================================
+ Hits 38458 38479 +21
- Misses 10956 11059 +103
- Partials 201 202 +1
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
some comments, nice work so far!
operation: string; | ||
} | ||
|
||
export const OPERATOR_MAPPING: { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure about this naming, perhaps OPERATOR_ENUM_TO_OPERATOR_TYPE
?
'IS TRUE': 'IS TRUE', | ||
'IS FALSE': 'IS FALSE', | ||
export enum Operators { | ||
EQUALS = 1, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if we're using this as an id, then for ease of debugging, i think i'd prefer using
EQUALS = 'EQUALS',
NOT_EQUALS = 'NOT_EQUALS',
etc.
sumValueAdhocMetric, | ||
]; | ||
|
||
function setup(overrides?: object) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Prefer Record<string, any>
to object
}; | ||
const onSubjectChange = (id: string) => { | ||
const option = props.options.find( | ||
// @ts-ignore |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is the ts-ignore
needed here? Can we type option as ColumnType
to get around it?
isOperatorRelevant, | ||
onComparatorChange, | ||
} = useSimpleTabFilterProps(props); | ||
const [suggestions, setSuggestions] = useState<JsonObject>([]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is JsonObject
the right thing to use here since you initialize to an empty array? Perhaps Record<string, any>[]
is correct?
const [abortActiveRequest, setAbortActiveRequest] = useState< | ||
(() => void) | null | ||
>(null); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe out of scope, but initializing this to NO_OP
(or maybe noOp
, I forget how it's named in our utils file, it's basically an empty function) would prevent the need to manually set the type and to check if abortActiveRequest
exists before calling it everytime. Seems cleaner
name="filter-value" | ||
ref={ref => | ||
focusComparator( | ||
ref as HTMLInputElement | null, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ideally we don't need to force the typing here, but it might be tricky
import { EXPRESSION_TYPES, CLAUSES } from './AdhocFilter'; | ||
|
||
export default PropTypes.oneOfType([ | ||
PropTypes.shape({ | ||
expressionType: PropTypes.oneOf([EXPRESSION_TYPES.SIMPLE]).isRequired, | ||
clause: PropTypes.oneOf([CLAUSES.HAVING, CLAUSES.WHERE]).isRequired, | ||
subject: PropTypes.string.isRequired, | ||
operator: PropTypes.oneOf(Object.keys(OPERATORS)).isRequired, | ||
// TODO: Fix the type | ||
// operator: PropTypes.oneOf(Object.keys(OPERATORS)).isRequired, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks like we need to fix something here?
@@ -51,5 +51,6 @@ export default function FilterDefinitionOption({ option }) { | |||
/> | |||
); | |||
} | |||
return null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice catch
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no more code review comments, but it looks like there are some frontend lint errors still? I believe running npm run lint-fix
locally will help you find/autofix them
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
woohoo!
…ache#14952) * Front end update - modify OPERATORS, to have SQL operation and display value * Updated tests * More tests * Remove OPERATOR imports * Fix break tests * PR comments * fix issue with comparator loading * rename a variable * Linting
…ache#14952) * Front end update - modify OPERATORS, to have SQL operation and display value * Updated tests * More tests * Remove OPERATOR imports * Fix break tests * PR comments * fix issue with comparator loading * rename a variable * Linting
…ache#14952) * Front end update - modify OPERATORS, to have SQL operation and display value * Updated tests * More tests * Remove OPERATOR imports * Fix break tests * PR comments * fix issue with comparator loading * rename a variable * Linting
SUMMARY
Explore page boolean filter was not working for presto db even after the PR #14567. #10098
BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
IS_TRUE
filterIS_TRUE
falseTESTING INSTRUCTIONS
ADDITIONAL INFORMATION