mirror of https://github.com/apache/druid.git
make double detection better (#15998)
This commit is contained in:
parent
c5b032799c
commit
acb5124679
|
@ -720,6 +720,7 @@ describe('spec utils', () => {
|
|||
expect(guessColumnTypeFromInput([null, 1, 2.1, 3], true)).toEqual('double');
|
||||
expect(guessColumnTypeFromInput([null, '1', '2.1', '3'], false)).toEqual('string');
|
||||
expect(guessColumnTypeFromInput([null, '1', '2.1', '3'], true)).toEqual('double');
|
||||
expect(guessColumnTypeFromInput([null, '1.0', '2.0', '3.0'], true)).toEqual('double');
|
||||
});
|
||||
|
||||
it('works for ARRAY<string>', () => {
|
||||
|
|
|
@ -2588,7 +2588,9 @@ function isIntegerOrNull(x: any): boolean {
|
|||
|
||||
function isIntegerOrNullAcceptString(x: any): boolean {
|
||||
return (
|
||||
x == null || ((typeof x === 'number' || typeof x === 'string') && Number.isInteger(Number(x)))
|
||||
x == null ||
|
||||
(typeof x === 'number' && Number.isInteger(x)) ||
|
||||
(typeof x === 'string' && !x.includes('.') && Number.isInteger(Number(x)))
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -193,6 +193,9 @@ export const InputFormatStep = React.memo(function InputFormatStep(props: InputF
|
|||
inputSourceAndFormat.inputSource,
|
||||
);
|
||||
|
||||
const needsResample = inputSourceAndFormatToSample !== inputSourceAndFormat;
|
||||
const nextDisabled = !inputSourceFormatAndMore || needsResample;
|
||||
|
||||
return (
|
||||
<div className="input-format-step">
|
||||
<div className="preview">
|
||||
|
@ -246,7 +249,7 @@ export const InputFormatStep = React.memo(function InputFormatStep(props: InputF
|
|||
onChange={setInputSourceAndFormat as any}
|
||||
/>
|
||||
)}
|
||||
{inputSourceAndFormatToSample !== inputSourceAndFormat && (
|
||||
{needsResample && (
|
||||
<FormGroup className="control-buttons">
|
||||
<Button
|
||||
text="Preview changes"
|
||||
|
@ -283,7 +286,7 @@ export const InputFormatStep = React.memo(function InputFormatStep(props: InputF
|
|||
text={altText}
|
||||
rightIcon={IconNames.ARROW_TOP_RIGHT}
|
||||
minimal
|
||||
disabled={!inputSourceFormatAndMore}
|
||||
disabled={nextDisabled}
|
||||
onClick={() => {
|
||||
if (!inputSourceFormatAndMore) return;
|
||||
onAltSet(inputSourceFormatAndMore);
|
||||
|
@ -299,7 +302,7 @@ export const InputFormatStep = React.memo(function InputFormatStep(props: InputF
|
|||
text={doneButton ? 'Done' : 'Next'}
|
||||
rightIcon={doneButton ? IconNames.TICK : IconNames.ARROW_RIGHT}
|
||||
intent={Intent.PRIMARY}
|
||||
disabled={!inputSourceFormatAndMore}
|
||||
disabled={nextDisabled}
|
||||
onClick={() => {
|
||||
if (!inputSourceFormatAndMore) return;
|
||||
onSet(inputSourceFormatAndMore);
|
||||
|
|
Loading…
Reference in New Issue