Fix serialization for HitExtractorProcessor

Also get more information when SQL fails in IT.

Original commit: elastic/x-pack-elasticsearch@09f6625274
This commit is contained in:
Nik Everett 2017-09-20 14:15:35 -04:00
parent 87293272d8
commit 1405773acb
4 changed files with 9 additions and 10 deletions

View File

@ -22,7 +22,6 @@ import java.util.HashMap;
import java.util.Map;
import static java.util.Collections.emptyList;
import static java.util.Collections.emptyMap;
import static java.util.Collections.singletonList;
import static java.util.Collections.singletonMap;
import static java.util.Collections.unmodifiableMap;
@ -161,7 +160,7 @@ public abstract class RestSqlTestCase extends ESRestTestCase {
}
private Map<String, Object> runSql(HttpEntity sql) throws IOException {
Response response = client().performRequest("POST", "/_sql", emptyMap(), sql);
Response response = client().performRequest("POST", "/_sql", singletonMap("error_trace", "true"), sql);
try (InputStream content = response.getEntity().getContent()) {
return XContentHelper.convertToMap(JsonXContent.jsonXContent, content, false);
}

View File

@ -27,14 +27,14 @@ public class ExplainIT extends CliIntegrationTestCase {
assertThat(in.readLine(), startsWith("----------"));
assertThat(in.readLine(), startsWith("Project[[test_field{r}#"));
assertThat(in.readLine(), startsWith("\\_SubQueryAlias[test]"));
assertThat(in.readLine(), startsWith(" \\EsRelation[test][test_field{r}#"));
assertThat(in.readLine(), startsWith(" \\_EsRelation[test][test_field{r}#"));
assertEquals("", in.readLine());
command("EXPLAIN (PLAN OPTIMIZED) SELECT * FROM test");
assertThat(in.readLine(), containsString("plan"));
assertThat(in.readLine(), startsWith("----------"));
assertThat(in.readLine(), startsWith("Project[[test_field{r}#"));
assertThat(in.readLine(), startsWith("\\EsRelation[test][test_field{r}#"));
assertThat(in.readLine(), startsWith("\\_EsRelation[test][test_field{r}#"));
assertEquals("", in.readLine());
// TODO in this case we should probably remove the source filtering entirely. Right? It costs but we don't need it.
@ -71,7 +71,7 @@ public class ExplainIT extends CliIntegrationTestCase {
assertThat(in.readLine(), startsWith("Project[[i{r}#"));
assertThat(in.readLine(), startsWith("\\_Filter[i{r}#"));
assertThat(in.readLine(), startsWith(" \\_SubQueryAlias[test]"));
assertThat(in.readLine(), startsWith(" \\EsRelation[test][i{r}#"));
assertThat(in.readLine(), startsWith(" \\_EsRelation[test][i{r}#"));
assertEquals("", in.readLine());
command("EXPLAIN (PLAN OPTIMIZED) SELECT * FROM test WHERE i = 2");
@ -79,7 +79,7 @@ public class ExplainIT extends CliIntegrationTestCase {
assertThat(in.readLine(), startsWith("----------"));
assertThat(in.readLine(), startsWith("Project[[i{r}#"));
assertThat(in.readLine(), startsWith("\\_Filter[i{r}#"));
assertThat(in.readLine(), startsWith(" \\EsRelation[test][i{r}#"));
assertThat(in.readLine(), startsWith(" \\_EsRelation[test][i{r}#"));
assertEquals("", in.readLine());
command("EXPLAIN (PLAN EXECUTABLE) SELECT * FROM test WHERE i = 2");
@ -124,14 +124,14 @@ public class ExplainIT extends CliIntegrationTestCase {
assertThat(in.readLine(), startsWith("----------"));
assertThat(in.readLine(), startsWith("Aggregate[[],[COUNT(1)#"));
assertThat(in.readLine(), startsWith("\\_SubQueryAlias[test]"));
assertThat(in.readLine(), startsWith(" \\EsRelation[test][i{r}#"));
assertThat(in.readLine(), startsWith(" \\_EsRelation[test][i{r}#"));
assertEquals("", in.readLine());
command("EXPLAIN (PLAN OPTIMIZED) SELECT COUNT(*) FROM test");
assertThat(in.readLine(), containsString("plan"));
assertThat(in.readLine(), startsWith("----------"));
assertThat(in.readLine(), startsWith("Aggregate[[],[COUNT(1)#"));
assertThat(in.readLine(), startsWith("\\EsRelation[test][i{r}#"));
assertThat(in.readLine(), startsWith("\\_EsRelation[test][i{r}#"));
assertEquals("", in.readLine());
command("EXPLAIN (PLAN EXECUTABLE) SELECT COUNT(*) FROM test");

View File

@ -15,7 +15,7 @@ import java.nio.file.Path;
import java.util.List;
@TestLogging(JdbcTestUtils.SQL_TRACE)
public class DebugSqlSpec extends SqlSpecIT {
public abstract class DebugSqlSpec extends SqlSpecIT {
public static LocalH2 H2 = new LocalH2();
@ParametersFactory(argumentFormatting = PARAM_FORMATTING)

View File

@ -34,7 +34,7 @@ public class HitExtractorProcessor implements Processor {
@Override
public void writeTo(StreamOutput out) throws IOException {
extractor.writeTo(out);
out.writeNamedWriteable(extractor);
}
@Override