vogievetsky commented on pull request #10232:
URL: https://github.com/apache/druid/pull/10232#issuecomment-705259550
I would suggest:
Change `function guessInputFormat(sampleData: string[]): InputFormat {` to
`export function guessInputFormat(sampleData: string[]): InputFormat {`
Also in `ingestion-spec.spec.ts` change `import { cleanSpec, downgradeSpec,
upgradeSpec } from './ingestion-spec';` to `import { cleanSpec, downgradeSpec,
guessInputFormat, upgradeSpec } from './ingestion-spec';`
And add this just before the final `});` of the file:
```
describe('guessInputFormat', () => {
it('works for parquet', () => {
expect(guessInputFormat(['PAR1lol']).type).toEqual('parquet');
});
it('works for orc', () => {
expect(guessInputFormat(['ORClol']).type).toEqual('orc');
});
it('works for AVRO', () => {
expect(guessInputFormat(['Obj\x01lol']).type).toEqual('avro_ocf');
expect(guessInputFormat(['Obj1lol']).type).toEqual('regex');
});
it('works for JSON', () => {
expect(guessInputFormat(['{"a":1}']).type).toEqual('json');
});
it('works for TSV', () => {
expect(guessInputFormat(['A\tB\tX\tY']).type).toEqual('tsv');
});
it('works for CSV', () => {
expect(guessInputFormat(['A,B,X,Y']).type).toEqual('csv');
});
it('works for regex', () => {
expect(guessInputFormat(['A|B|X|Y']).type).toEqual('regex');
});
});
```
That should do it.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]