expected, ',', true);
}
public void testEval(Schema schema, String tableName, String csvTuple, String query, String [] expected,
char delimiter, boolean condition) throws IOException {
LazyTuple lazyTuple;
VTuple vtuple = null;
String qualifiedTableName =
CatalogUtil.buildFQName(DEFAULT_DATABASE_NAME,
tableName != null ? CatalogUtil.normalizeIdentifier(tableName) : null);
Schema inputSchema = null;
if (schema != null) {
inputSchema = SchemaUtil.clone(schema);
inputSchema.setQualifier(qualifiedTableName);
int targetIdx [] = new int[inputSchema.size()];
for (int i = 0; i < targetIdx.length; i++) {
targetIdx[i] = i;
}
lazyTuple =
new LazyTuple(inputSchema, Bytes.splitPreserveAllTokens(csvTuple.getBytes(), delimiter, targetIdx),0);
vtuple = new VTuple(inputSchema.size());
for (int i = 0; i < inputSchema.size(); i++) {
// If null value occurs, null datum is manually inserted to an input tuple.
if (lazyTuple.get(i) instanceof TextDatum && lazyTuple.get(i).asChars().equals("")) {
vtuple.put(i, NullDatum.get());
} else {
vtuple.put(i, lazyTuple.get(i));
}
}
cat.createTable(new TableDesc(qualifiedTableName, inputSchema,
CatalogProtos.StoreType.CSV, new Options(), CommonTestingUtil.getTestDir()));
}