You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@druid.apache.org by GitBox <gi...@apache.org> on 2020/10/08 00:19:26 UTC

[GitHub] [druid] vogievetsky commented on pull request #10232: Fix Avro support in Web Console

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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org