@Test public void testFileAsRowFailsWithMoreThanOneColumn() { expectedException.expect(IllegalArgumentException.class); expectedException.expectMessage("the FILE_AS_ROW property " + "only supports tables with a single column in the table " + "definition. 2 columns were provided"); context.addOption("FILE_AS_ROW", "true"); context.getTupleDescription().add(new ColumnDescriptor("col1", 1, 1, "TEXT", null)); context.getTupleDescription().add(new ColumnDescriptor("col2", 1, 2, "TEXT", null)); accessor.initialize(context); }
@Override public void initialize(RequestContext requestContext) { super.initialize(requestContext); fileAsRow = StringUtils.equalsIgnoreCase("true", context.getOption("FILE_AS_ROW")); if (fileAsRow && context.getTupleDescription().size() != 1) { throw new IllegalArgumentException(String.format("the FILE_AS_ROW " + "property only supports tables with a single column in " + "the table definition. %d columns were provided", context.getTupleDescription().size())); } }
QuotedLineBreakAccessor extends HdfsAtomicDataAccessor { @Override public void initialize(RequestContext requestContext) { super.initialize(requestContext); fileAsRow = StringUtils.equalsIgnoreCase("true", context.getOption("FILE_AS_ROW")); if (fileAsRow && context.getTupleDescription().size() != 1) { throw new IllegalArgumentException(String.format("the FILE_AS_ROW " + "property only supports tables with a single column in " + "the table definition. %d columns were provided", context.getTupleDescription().size())); } } }
QuotedLineBreakAccessor extends HdfsAtomicDataAccessor { @Override public void initialize(RequestContext requestContext) { super.initialize(requestContext); fileAsRow = StringUtils.equalsIgnoreCase("true", context.getOption("FILE_AS_ROW")); if (fileAsRow && context.getTupleDescription().size() != 1) { throw new IllegalArgumentException(String.format("the FILE_AS_ROW " + "property only supports tables with a single column in " + "the table definition. %d columns were provided", context.getTupleDescription().size())); } }  }
QuotedLineBreakAccessor extends HdfsAtomicDataAccessor { @Override public void initialize(RequestContext requestContext) { super.initialize(requestContext); fileAsRow = StringUtils.equalsIgnoreCase("true", context.getOption("FILE_AS_ROW")); if (fileAsRow && context.getTupleDescription().size() != 1) { throw new IllegalArgumentException(String.format("the FILE_AS_ROW " + "property only supports tables with a single column in " + "the table definition. %d columns were provided", context.getTupleDescription().size())); } }  @Override void initialize(RequestContext requestContext); @Override boolean openForRead(); @Override OneRow readNextObject(); @Override boolean openForWrite(); @Override boolean writeNextObject(OneRow onerow); @Override void closeForWrite(); }
QuotedLineBreakAccessor extends HdfsAtomicDataAccessor { @Override public void initialize(RequestContext requestContext) { super.initialize(requestContext); fileAsRow = StringUtils.equalsIgnoreCase("true", context.getOption("FILE_AS_ROW")); if (fileAsRow && context.getTupleDescription().size() != 1) { throw new IllegalArgumentException(String.format("the FILE_AS_ROW " + "property only supports tables with a single column in " + "the table definition. %d columns were provided", context.getTupleDescription().size())); } }  @Override void initialize(RequestContext requestContext); @Override boolean openForRead(); @Override OneRow readNextObject(); @Override boolean openForWrite(); @Override boolean writeNextObject(OneRow onerow); @Override void closeForWrite();  }