use of io.crate.metadata.PartitionName 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 io.crate.metadata.PartitionName 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 io.crate.metadata.PartitionName 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 io.crate.metadata.PartitionName 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));
}
use of io.crate.metadata.PartitionName in project crate by crate.
the class CopyAnalyzerTest method testCopyToWithPartitionIdentAndPartitionInWhereClause.
@Test
public void testCopyToWithPartitionIdentAndPartitionInWhereClause() throws Exception {
CopyToAnalyzedStatement analysis = e.analyze("copy parted partition (date=1395874800000) 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));
}
Aggregations