@Override public String getInputFormatClassName() { Collection<PartitionKey> inputKeys = getInputKeys(); if (inputKeys.isEmpty()) { return EmptyInputFormat.class.getName(); } return files.getInputFormatClassName(); }
@Override public String getInputFormatClassName() { Collection<PartitionKey> inputKeys = getInputKeys(); if (inputKeys.isEmpty()) { return EmptyInputFormat.class.getName(); } return files.getInputFormatClassName(); }
@Override public String getInputFormatClassName() { return delegate.getInputFormatClassName(); }
@Test public void testInputOutputFormatClassAtRuntime() throws Exception { // create a dataset with text input and output formats DatasetId datasetId = OTHER_NAMESPACE.dataset("testRuntimeFormats"); dsFrameworkUtil.createInstance("fileSet", datasetId, FileSetProperties.builder() .setInputFormat(TextInputFormat.class) .setOutputFormat(TextOutputFormat.class) .build()); // without passing anything in arguments, the input/output format classes will come from dataset properties FileSet fs = dsFrameworkUtil.getInstance(datasetId); Assert.assertEquals(TextInputFormat.class.getName(), fs.getInputFormatClassName()); Assert.assertEquals(TextOutputFormat.class.getName(), fs.getOutputFormatClassName()); // allow overriding the input format in dataset runtime args fs = dsFrameworkUtil.getInstance(datasetId, ImmutableMap.of( FileSetProperties.INPUT_FORMAT, CombineTextInputFormat.class.getName())); Assert.assertEquals(CombineTextInputFormat.class.getName(), fs.getInputFormatClassName()); Assert.assertEquals(TextOutputFormat.class.getName(), fs.getOutputFormatClassName()); // allow overriding both the input and output format in dataset runtime args fs = dsFrameworkUtil.getInstance(datasetId, ImmutableMap.of( FileSetProperties.INPUT_FORMAT, CombineTextInputFormat.class.getName(), FileSetProperties.OUTPUT_FORMAT, NullOutputFormat.class.getName())); Assert.assertEquals(CombineTextInputFormat.class.getName(), fs.getInputFormatClassName()); Assert.assertEquals(NullOutputFormat.class.getName(), fs.getOutputFormatClassName()); }
.builder().setBasePath("some/path").setInputFormat(TextInputFormat.class).build()); DataSetManager<FileSet> bManager = getDataset("b"); String bFormat = bManager.get().getInputFormatClassName(); String bPath = bManager.get().getBaseLocation().toURI().getPath(); Assert.assertTrue(bPath.endsWith("some/path/")); Assert.assertEquals(bFormat, bManager.get().getInputFormatClassName()); String newBPath = bManager.get().getBaseLocation().toURI().getPath(); Assert.assertTrue(newBPath.endsWith("/extra/"));