use of io.crate.metadata.settings.SessionSettings in project crate by crate.
the class ShardUpsertRequestTest method test_streaming_without_returnvalues.
@Test
public void test_streaming_without_returnvalues() throws Exception {
ShardId shardId = new ShardId("test", UUIDs.randomBase64UUID(), 1);
String[] assignmentColumns = new String[] { "id", "name" };
UUID jobId = UUID.randomUUID();
Reference[] missingAssignmentColumns = new Reference[] { ID_REF, NAME_REF };
ShardUpsertRequest request = new ShardUpsertRequest.Builder(new SessionSettings("dummyUser", SearchPath.createSearchPathFrom("dummySchema")), TimeValue.timeValueSeconds(30), DuplicateKeyAction.UPDATE_OR_FAIL, false, assignmentColumns, missingAssignmentColumns, null, jobId, false).newRequest(shardId);
request.add(123, new ShardUpsertRequest.Item("99", null, new Object[] { 99, "Marvin" }, null, null, null));
request.add(42, new ShardUpsertRequest.Item("99", new Symbol[0], new Object[] { 99, "Marvin" }, null, null, null));
request.add(5, new ShardUpsertRequest.Item("42", new Symbol[] { Literal.of(42), Literal.of("Deep Thought") }, null, 2L, 1L, 5L));
BytesStreamOutput out = new BytesStreamOutput();
request.writeTo(out);
StreamInput in = out.bytes().streamInput();
ShardUpsertRequest request2 = new ShardUpsertRequest(in);
assertThat(request, equalTo(request2));
}
use of io.crate.metadata.settings.SessionSettings in project crate by crate.
the class OptimizerTest method test_rule_filtering.
@Test
public void test_rule_filtering() {
SessionSettings sessionSettings = new SessionSettings("User", SearchPath.pathWithPGCatalogAndDoc(), true, Set.of(MergeFilters.class), true);
List<Rule<?>> rules = Optimizer.removeExcludedRules(List.of(new MergeFilters()), sessionSettings.excludedOptimizerRules());
assertThat(rules.isEmpty(), is(true));
rules = Optimizer.removeExcludedRules(List.of(new MoveFilterBeneathHashJoin()), sessionSettings.excludedOptimizerRules());
assertThat(rules.size(), is(1));
}
use of io.crate.metadata.settings.SessionSettings in project crate by crate.
the class RemoteCollectorTest method prepare.
@Before
public void prepare() {
MockitoAnnotations.initMocks(this);
UUID jobId = UUID.randomUUID();
RoutedCollectPhase collectPhase = new RoutedCollectPhase(jobId, 0, "remoteCollect", new Routing(Map.of("remoteNode", Map.of("dummyTable", IntArrayList.from(1)))), RowGranularity.DOC, Collections.singletonList(createReference("name", DataTypes.STRING)), Collections.emptyList(), WhereClause.MATCH_ALL.queryOrFallback(), DistributionInfo.DEFAULT_BROADCAST);
transportJobAction = mock(TransportJobAction.class);
TasksService tasksService = new TasksService(clusterService, new JobsLogs(() -> true));
numBroadcastCalls = new AtomicInteger(0);
transportKillJobsNodeAction = new TransportKillJobsNodeAction(tasksService, clusterService, mock(TransportService.class)) {
@Override
public void broadcast(KillJobsRequest request, ActionListener<Long> listener) {
numBroadcastCalls.incrementAndGet();
}
};
consumer = new TestingRowConsumer();
remoteCollector = new RemoteCollector(jobId, new SessionSettings("dummyUser", SearchPath.createSearchPathFrom("dummySchema")), "localNode", "remoteNode", transportJobAction, transportKillJobsNodeAction, Runnable::run, tasksService, RamAccounting.NO_ACCOUNTING, consumer, collectPhase);
}
use of io.crate.metadata.settings.SessionSettings in project crate by crate.
the class ShardUpsertRequestTest method test_streaming_with_returnvalues.
@Test
public void test_streaming_with_returnvalues() throws Exception {
ShardId shardId = new ShardId("test", UUIDs.randomBase64UUID(), 1);
String[] assignmentColumns = new String[] { "id", "name" };
UUID jobId = UUID.randomUUID();
Reference[] missingAssignmentColumns = new Reference[] { ID_REF, NAME_REF };
ShardUpsertRequest request = new ShardUpsertRequest.Builder(new SessionSettings("dummyUser", SearchPath.createSearchPathFrom("dummySchema")), TimeValue.timeValueSeconds(30), DuplicateKeyAction.UPDATE_OR_FAIL, false, assignmentColumns, missingAssignmentColumns, null, jobId, false).newRequest(shardId);
request.add(123, new ShardUpsertRequest.Item("99", null, new Object[] { 99, "Marvin" }, null, null, null));
request.add(42, new ShardUpsertRequest.Item("99", new Symbol[0], new Object[] { 99, "Marvin" }, null, null, null));
request.add(5, new ShardUpsertRequest.Item("42", new Symbol[] { Literal.of(42), Literal.of("Deep Thought") }, null, 2L, 1L, 5L));
BytesStreamOutput out = new BytesStreamOutput();
request.writeTo(out);
StreamInput in = out.bytes().streamInput();
ShardUpsertRequest request2 = new ShardUpsertRequest(in);
assertThat(request, equalTo(request2));
}
use of io.crate.metadata.settings.SessionSettings in project crate by crate.
the class JobRequestTest method testJobRequestStreaming.
@Test
public void testJobRequestStreaming() throws Exception {
JobRequest r1 = new JobRequest(UUID.randomUUID(), new SessionSettings("dummyUser", SearchPath.createSearchPathFrom("dummySchema")), "n1", Collections.emptyList(), true);
BytesStreamOutput out = new BytesStreamOutput();
r1.writeTo(out);
JobRequest r2 = new JobRequest(out.bytes().streamInput());
assertThat(r1.coordinatorNodeId(), is(r2.coordinatorNodeId()));
assertThat(r1.jobId(), is(r2.jobId()));
assertThat(r1.sessionSettings(), is(r2.sessionSettings()));
assertThat(r1.nodeOperations().isEmpty(), is(true));
assertThat(r1.enableProfiling(), is(r2.enableProfiling()));
}
Aggregations