use of io.crate.metadata.TableIdent in project crate by crate.
the class FetchBatchAccumulatorTest method buildFetchProjectorContext.
private FetchProjectorContext buildFetchProjectorContext() {
Map<String, IntSet> nodeToReaderIds = new HashMap<>(2);
IntSet nodeReadersNodeOne = new IntHashSet();
nodeReadersNodeOne.add(0);
IntSet nodeReadersNodeTwo = new IntHashSet();
nodeReadersNodeTwo.add(2);
nodeToReaderIds.put("nodeOne", nodeReadersNodeOne);
nodeToReaderIds.put("nodeTwo", nodeReadersNodeTwo);
TreeMap<Integer, String> readerIndices = new TreeMap<>();
readerIndices.put(0, "t1");
Map<String, TableIdent> indexToTable = new HashMap<>(1);
indexToTable.put("t1", USER_TABLE_IDENT);
Map<TableIdent, FetchSource> tableToFetchSource = new HashMap<>(2);
FetchSource fetchSource = new FetchSource(Collections.emptyList(), Collections.singletonList(new InputColumn(0)), Collections.singletonList(ID));
tableToFetchSource.put(USER_TABLE_IDENT, fetchSource);
return new FetchProjectorContext(tableToFetchSource, nodeToReaderIds, readerIndices, indexToTable);
}
use of io.crate.metadata.TableIdent in project crate by crate.
the class LuceneReferenceResolverTest method testGetImplementationWithColumnsOfTypeCollection.
@Test
public void testGetImplementationWithColumnsOfTypeCollection() {
Reference arrayRef = new Reference(new ReferenceIdent(new TableIdent("s", "t"), "a"), RowGranularity.DOC, DataTypes.DOUBLE_ARRAY);
assertThat(luceneReferenceResolver.getImplementation(arrayRef), instanceOf(DocCollectorExpression.ChildDocCollectorExpression.class));
Reference setRef = new Reference(new ReferenceIdent(new TableIdent("s", "t"), "a"), RowGranularity.DOC, new SetType(DataTypes.DOUBLE));
assertThat(luceneReferenceResolver.getImplementation(setRef), instanceOf(DocCollectorExpression.ChildDocCollectorExpression.class));
}
use of io.crate.metadata.TableIdent in project crate by crate.
the class SnapshotRestoreDDLDispatcherTest method testResolveTableIndexFromSnapshot.
@Test
public void testResolveTableIndexFromSnapshot() throws Exception {
String resolvedIndex = SnapshotRestoreDDLDispatcher.ResolveFromSnapshotActionListener.resolveIndexNameFromSnapshot(new TableIdent("custom", "restoreme"), Collections.singletonList(new SnapshotInfo(new Snapshot("snapshot01", Collections.singletonList("custom.restoreme"), 0L))));
assertThat(resolvedIndex, is("custom.restoreme"));
}
use of io.crate.metadata.TableIdent in project crate by crate.
the class SnapshotRestoreDDLDispatcherTest method testResolvePartitionedTableIndexFromSnapshot.
@Test
public void testResolvePartitionedTableIndexFromSnapshot() throws Exception {
String resolvedIndex = SnapshotRestoreDDLDispatcher.ResolveFromSnapshotActionListener.resolveIndexNameFromSnapshot(new TableIdent(null, "restoreme"), Collections.singletonList(new SnapshotInfo(new Snapshot("snapshot01", Collections.singletonList(".partitioned.restoreme.046jcchm6krj4e1g60o30c0"), 0L))));
String template = PartitionName.templateName(null, "restoreme") + "*";
assertThat(resolvedIndex, is(template));
}
use of io.crate.metadata.TableIdent in project crate by crate.
the class WhereClauseAnalyzerTest method registerTables.
private void registerTables(SQLExecutor.Builder builder) {
builder.addDocTable(TestingTableInfo.builder(new TableIdent("doc", "users"), twoNodeRouting).add("id", DataTypes.STRING, null).add("name", DataTypes.STRING, null).add("tags", new ArrayType(DataTypes.STRING), null).addPrimaryKey("id").clusteredBy("id").build());
builder.addDocTable(TestingTableInfo.builder(new TableIdent("doc", "parted"), twoNodeRouting).add("id", DataTypes.INTEGER, null).add("name", DataTypes.STRING, null).add("date", DataTypes.TIMESTAMP, null, true).add("obj", DataTypes.OBJECT, null, ColumnPolicy.IGNORED).addPartitions(new PartitionName("parted", Arrays.asList(new BytesRef("1395874800000"))).asIndexName(), new PartitionName("parted", Arrays.asList(new BytesRef("1395961200000"))).asIndexName(), new PartitionName("parted", new ArrayList<BytesRef>() {
{
add(null);
}
}).asIndexName()).build());
builder.addDocTable(TestingTableInfo.builder(new TableIdent("doc", "parted_pk"), twoNodeRouting).addPrimaryKey("id").addPrimaryKey("date").add("id", DataTypes.INTEGER, null).add("name", DataTypes.STRING, null).add("date", DataTypes.TIMESTAMP, null, true).add("obj", DataTypes.OBJECT, null, ColumnPolicy.IGNORED).addPartitions(new PartitionName("parted_pk", Arrays.asList(new BytesRef("1395874800000"))).asIndexName(), new PartitionName("parted_pk", Arrays.asList(new BytesRef("1395961200000"))).asIndexName(), new PartitionName("parted_pk", new ArrayList<BytesRef>() {
{
add(null);
}
}).asIndexName()).build());
builder.addDocTable(TestingTableInfo.builder(new TableIdent("doc", "bystring"), twoNodeRouting).add("name", DataTypes.STRING, null).add("score", DataTypes.DOUBLE, null).addPrimaryKey("name").clusteredBy("name").build());
builder.addDocTable(TestingTableInfo.builder(new TableIdent("doc", "users_multi_pk"), twoNodeRouting).add("id", DataTypes.LONG, null).add("name", DataTypes.STRING, null).add("details", DataTypes.OBJECT, null).add("awesome", DataTypes.BOOLEAN, null).add("friends", new ArrayType(DataTypes.OBJECT), null, ColumnPolicy.DYNAMIC).addPrimaryKey("id").addPrimaryKey("name").clusteredBy("id").build());
builder.addDocTable(TestingTableInfo.builder(new TableIdent("doc", "pk4"), twoNodeRouting).add("i1", DataTypes.INTEGER, null).add("i2", DataTypes.INTEGER, null).add("i3", DataTypes.INTEGER, null).add("i4", DataTypes.INTEGER, null).addPrimaryKey("i1").addPrimaryKey("i2").addPrimaryKey("i3").addPrimaryKey("i4").build());
builder.addDocTable(TestingTableInfo.builder(new TableIdent("doc", "users_clustered_by_only"), twoNodeRouting).add("id", DataTypes.LONG, null).add("name", DataTypes.STRING, null).add("details", DataTypes.OBJECT, null).add("awesome", DataTypes.BOOLEAN, null).add("friends", new ArrayType(DataTypes.OBJECT), null, ColumnPolicy.DYNAMIC).clusteredBy("id").build());
}
Aggregations