|
| 1 | +import { InputFormat, OutputFormat } from '../lib'; |
| 2 | + |
| 3 | +// Regression test: OutputFormat.AVRO and OutputFormat.ORC were previously |
| 4 | +// constructed as `InputFormat` instances. That compiled in TypeScript because |
| 5 | +// the two classes are structurally identical, but in jsii's nominally-typed |
| 6 | +// languages (Java, C#, Go, Python) it made these members unusable wherever an |
| 7 | +// `OutputFormat` is required. At runtime the classes have distinct prototypes, |
| 8 | +// so `instanceof` distinguishes the bug (would fail below) from the fix. |
| 9 | +describe('OutputFormat static members are OutputFormat instances', () => { |
| 10 | + test.each([ |
| 11 | + ['AVRO', OutputFormat.AVRO, 'org.apache.hadoop.hive.ql.io.avro.AvroContainerOutputFormat'], |
| 12 | + ['ORC', OutputFormat.ORC, 'org.apache.hadoop.hive.ql.io.orc.OrcOutputFormat'], |
| 13 | + ['HIVE_IGNORE_KEY_TEXT', OutputFormat.HIVE_IGNORE_KEY_TEXT, 'org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat'], |
| 14 | + ['PARQUET', OutputFormat.PARQUET, 'org.apache.hadoop.hive.ql.io.parquet.MapredParquetOutputFormat'], |
| 15 | + ])('OutputFormat.%s is an OutputFormat with an unchanged class name', (_name, format, className) => { |
| 16 | + expect(format).toBeInstanceOf(OutputFormat); |
| 17 | + expect(format).not.toBeInstanceOf(InputFormat); |
| 18 | + expect(format.className).toEqual(className); |
| 19 | + }); |
| 20 | +}); |
0 commit comments