use of org.elasticsearch.test.cluster.NoopClusterService in project crate by crate.
the class JobContextServiceTest method prepare.
@Before
public void prepare() throws Exception {
JobsLogs jobsLogs = new JobsLogs(() -> true);
jobContextService = new JobContextService(Settings.EMPTY, new NoopClusterService(), jobsLogs);
}
use of org.elasticsearch.test.cluster.NoopClusterService in project crate by crate.
the class NestedLoopConsumerTest method initPlanner.
@Before
public void initPlanner() throws Exception {
ClusterService clusterService = new NoopClusterService();
TableStats tableStats = getTableStats();
e = SQLExecutor.builder(clusterService).enableDefaultTables().setTableStats(tableStats).addDocTable(emptyRoutingTable).build();
Functions functions = e.functions();
EvaluatingNormalizer normalizer = EvaluatingNormalizer.functionOnlyNormalizer(functions, ReplaceMode.COPY);
plannerContext = new Planner.Context(e.planner, clusterService, UUID.randomUUID(), new ConsumingPlanner(clusterService, functions, tableStats), normalizer, new TransactionContext(SessionContext.SYSTEM_SESSION), 0, 0);
consumer = new NestedLoopConsumer(clusterService, functions, tableStats);
}
use of org.elasticsearch.test.cluster.NoopClusterService in project crate by crate.
the class InsertFromValuesAnalyzerTest method init.
@Before
public void init() {
SQLExecutor.Builder executorBuilder = SQLExecutor.builder(new NoopClusterService()).enableDefaultTables().addDocTable(testAliasTableInfo).addDocTable(nestedClusteredTableInfo);
TableIdent notNullColumnTableIdent = new TableIdent(null, "not_null_column");
TestingTableInfo.Builder notNullColumnTable = new TestingTableInfo.Builder(notNullColumnTableIdent, new Routing(ImmutableMap.of())).add("id", DataTypes.INTEGER, null).add("name", DataTypes.STRING, null, ColumnPolicy.DYNAMIC, IndexType.NOT_ANALYZED, false, false);
executorBuilder.addDocTable(notNullColumnTable);
TableIdent generatedColumnTableIdent = new TableIdent(null, "generated_column");
TestingTableInfo.Builder generatedColumnTable = new TestingTableInfo.Builder(generatedColumnTableIdent, new Routing(ImmutableMap.<String, Map<String, List<Integer>>>of())).add("ts", DataTypes.TIMESTAMP, null).add("user", DataTypes.OBJECT, null).add("user", DataTypes.STRING, Arrays.asList("name")).addGeneratedColumn("day", DataTypes.TIMESTAMP, "date_trunc('day', ts)", false).addGeneratedColumn("name", DataTypes.STRING, "concat(user['name'], 'bar')", false);
executorBuilder.addDocTable(generatedColumnTable);
TableIdent generatedPkColumnTableIdent = new TableIdent(null, "generated_pk_column");
TestingTableInfo.Builder generatedPkColumnTable = new TestingTableInfo.Builder(generatedPkColumnTableIdent, SHARD_ROUTING).add("serial_no", DataTypes.INTEGER, null).add("product_no", DataTypes.INTEGER, null).add("color", DataTypes.STRING, null).addGeneratedColumn("id", DataTypes.INTEGER, "serial_no + 1", false).addGeneratedColumn("id2", DataTypes.INTEGER, "product_no + 1", false).addPrimaryKey("id").addPrimaryKey("id2");
executorBuilder.addDocTable(generatedPkColumnTable);
TableIdent generatedClusteredByTableIdent = new TableIdent(null, "generated_clustered_by_column");
TestingTableInfo.Builder clusteredByGeneratedTable = new TestingTableInfo.Builder(generatedClusteredByTableIdent, SHARD_ROUTING).add("serial_no", DataTypes.INTEGER, null).add("color", DataTypes.STRING, null).addGeneratedColumn("routing_col", DataTypes.INTEGER, "serial_no + 1", false).clusteredBy("routing_col");
executorBuilder.addDocTable(clusteredByGeneratedTable);
TableIdent generatedNestedClusteredByTableIdent = new TableIdent(null, "generated_nested_clustered_by");
TestingTableInfo.Builder generatedNestedClusteredByInfo = new TestingTableInfo.Builder(generatedNestedClusteredByTableIdent, SHARD_ROUTING).add("o", DataTypes.OBJECT, null, ColumnPolicy.DYNAMIC).add("o", DataTypes.INTEGER, Arrays.asList("serial_number")).addGeneratedColumn("routing_col", DataTypes.INTEGER, "o['serial_number'] + 1", false).clusteredBy("routing_col");
executorBuilder.addDocTable(generatedNestedClusteredByInfo);
e = executorBuilder.build();
}
use of org.elasticsearch.test.cluster.NoopClusterService in project crate by crate.
the class BlobTableAnalyzerTest method init.
@Before
public void init() throws Exception {
NoopClusterService clusterService = new NoopClusterService();
TableIdent myBlobsIdent = new TableIdent(BlobSchemaInfo.NAME, "blobs");
TestingBlobTableInfo myBlobsTableInfo = TableDefinitions.createBlobTable(myBlobsIdent, clusterService);
e = SQLExecutor.builder(clusterService).addBlobTable(myBlobsTableInfo).build();
}
use of org.elasticsearch.test.cluster.NoopClusterService in project crate by crate.
the class CreateDropRepositoryAnalyzerTest method init.
@Before
public void init() throws Exception {
RepositoriesMetaData repositoriesMetaData = new RepositoriesMetaData(new RepositoryMetaData("my_repo", "fs", Settings.builder().put("location", "/tmp/my_repo").build()));
ClusterState clusterState = ClusterState.builder(new ClusterName("testing")).metaData(MetaData.builder().putCustom(RepositoriesMetaData.TYPE, repositoriesMetaData)).build();
NoopClusterService clusterService = new NoopClusterService(clusterState);
e = SQLExecutor.builder(clusterService).build();
}
Aggregations