.inferNullableSchema( recordName, open(samplePaths.get(0)), props, required) .toString(!minimize);
@Test public void testSchemaNamespace() throws Exception { InputStream stream = new ByteArrayInputStream(csvLines.getBytes("utf8")); Schema schema = CSVUtil.inferNullableSchema("com.example.TestRecord", stream, new CSVProperties.Builder().hasHeader().build()); Assert.assertEquals("Should use name", "TestRecord", schema.getName()); Assert.assertEquals("Should set namespace", "com.example", schema.getNamespace()); }
@Test public void testNullableSchemaInference() throws Exception { InputStream stream = new ByteArrayInputStream(csvLines.getBytes("utf8")); Schema schema = CSVUtil.inferNullableSchema("TestRecord", stream, new CSVProperties.Builder().hasHeader().build(), ImmutableSet.of("float"));
@Test public void testNullableSchemaInferenceWithoutHeader() throws Exception { InputStream stream = new ByteArrayInputStream(csvLines.getBytes("utf8")); Schema schema = CSVUtil.inferNullableSchema("TestRecord", stream, new CSVProperties.Builder().build(), ImmutableSet.of("long", "field_1"));