use of org.apache.lucene.util.BytesRef in project crate by crate.
the class CopyAnalyzerTest method testCopyFromPartitionedTablePARTITIONKeywordValidArgs.
@Test
public void testCopyFromPartitionedTablePARTITIONKeywordValidArgs() throws Exception {
CopyFromAnalyzedStatement analysis = e.analyze("copy parted partition (date=1395874800000) from '/some/distant/file.ext'");
String parted = new PartitionName("parted", Collections.singletonList(new BytesRef("1395874800000"))).ident();
assertThat(analysis.partitionIdent(), equalTo(parted));
}
use of org.apache.lucene.util.BytesRef in project crate by crate.
the class CopyAnalyzerTest method testCopyToFileWithPartitionClause.
@Test
public void testCopyToFileWithPartitionClause() throws Exception {
CopyToAnalyzedStatement analysis = e.analyze("copy parted partition (date=1395874800000) to directory '/blah'");
String parted = new PartitionName("parted", Collections.singletonList(new BytesRef("1395874800000"))).asIndexName();
QuerySpec querySpec = analysis.subQueryRelation().querySpec();
assertThat(querySpec.where().partitions(), contains(parted));
}
use of org.apache.lucene.util.BytesRef in project crate by crate.
the class CopyAnalyzerTest method testCopyFromFileUriArray.
@Test
public void testCopyFromFileUriArray() throws Exception {
Object[] files = $("/f1.json", "/f2.json");
CopyFromAnalyzedStatement copyFrom = e.analyze("copy users from ?", new Object[] { files });
assertThat(copyFrom.uri(), isLiteral($(new BytesRef("/f1.json"), new BytesRef("/f2.json")), new ArrayType(DataTypes.STRING)));
}
use of org.apache.lucene.util.BytesRef in project crate by crate.
the class CopyAnalyzerTest method testCopyToWithPartitionIdentAndWhereClause.
@Test
public void testCopyToWithPartitionIdentAndWhereClause() throws Exception {
CopyToAnalyzedStatement analysis = e.analyze("copy parted partition (date=1395874800000) where id = 1 to directory '/tmp/foo'");
String parted = new PartitionName("parted", Collections.singletonList(new BytesRef("1395874800000"))).asIndexName();
QuerySpec querySpec = analysis.subQueryRelation().querySpec();
assertThat(querySpec.where().partitions(), contains(parted));
assertThat(querySpec.where().query(), isFunction("op_="));
}
use of org.apache.lucene.util.BytesRef in project crate by crate.
the class CopyAnalyzerTest method testCopyToWithPartitionInWhereClause.
@Test
public void testCopyToWithPartitionInWhereClause() throws Exception {
CopyToAnalyzedStatement analysis = e.analyze("copy parted where date = 1395874800000 to directory '/tmp/foo'");
String parted = new PartitionName("parted", Collections.singletonList(new BytesRef("1395874800000"))).asIndexName();
QuerySpec querySpec = analysis.subQueryRelation().querySpec();
assertThat(querySpec.where().partitions(), contains(parted));
assertThat(analysis.overwrites().size(), is(1));
}
Aggregations