Update constructor for NumericAggregate classes

Original commit: elastic/x-pack-elasticsearch@732742083b
This commit is contained in:
Costin Leau 2017-08-17 16:20:44 +03:00
parent a4bd077913
commit 1471c8ab7f
13 changed files with 39 additions and 29 deletions

View File

@ -91,6 +91,10 @@ public class CsvSpecIT extends SpecBaseIntegrationTestCase {
} }
} }
protected void assertResults(ResultSet expected, ResultSet actual) throws SQLException {
assertResultSets(expected, actual);
}
private ResultSet executeJdbcQuery(Connection con, String query) throws SQLException { private ResultSet executeJdbcQuery(Connection con, String query) throws SQLException {
Statement statement = con.createStatement(); Statement statement = con.createStatement();
//statement.setFetchSize(randomInt(10)); //statement.setFetchSize(randomInt(10));

View File

@ -7,16 +7,20 @@ package org.elasticsearch.xpack.sql.jdbc;
import com.carrotsearch.randomizedtesting.annotations.ParametersFactory; import com.carrotsearch.randomizedtesting.annotations.ParametersFactory;
import org.elasticsearch.test.junit.annotations.TestLogging;
import org.elasticsearch.xpack.sql.jdbc.framework.JdbcTestUtils; import org.elasticsearch.xpack.sql.jdbc.framework.JdbcTestUtils;
import java.nio.file.Path; import java.nio.file.Path;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.List; import java.util.List;
public abstract class DebugCsvSpec extends CsvSpecIT { @TestLogging("org.elasticsearch.xpack.sql:TRACE")
public class DebugCsvSpec extends CsvSpecIT {
@ParametersFactory(shuffle = false, argumentFormatting = SqlSpecIT.PARAM_FORMATTING) // NOCOMMIT are we sure?! @ParametersFactory(shuffle = false, argumentFormatting = SqlSpecIT.PARAM_FORMATTING) // NOCOMMIT are we sure?!
public static List<Object[]> readScriptSpec() throws Exception { public static List<Object[]> readScriptSpec() throws Exception {
JdbcTestUtils.sqlLogging(); //JdbcTestUtils.sqlLogging();
CsvSpecParser parser = new CsvSpecParser(); CsvSpecParser parser = new CsvSpecParser();
return readScriptSpec("/debug.csv-spec", parser); return readScriptSpec("/debug.csv-spec", parser);
@ -26,11 +30,8 @@ public abstract class DebugCsvSpec extends CsvSpecIT {
super(groupName, testName, lineNumber, source, testCase); super(groupName, testName, lineNumber, source, testCase);
} }
// @Override @Override
// public void assertResults(ResultSet expected, ResultSet actual) throws SQLException { public void assertResults(ResultSet expected, ResultSet actual) throws SQLException {
// Logger logger = Loggers.getLogger("org.elasticsearch.xpack.sql.test"); JdbcTestUtils.resultSetToLogger(logger, actual);
// Loggers.setLevel(logger, "INFO"); }
//
// JdbcTestUtils.resultSetToLogger(logger, actual);
// }
} }

View File

@ -10,8 +10,8 @@ import org.elasticsearch.xpack.sql.tree.Location;
public class Avg extends NumericAggregate implements EnclosedAgg { public class Avg extends NumericAggregate implements EnclosedAgg {
public Avg(Location location, Expression argument) { public Avg(Location location, Expression field) {
super(location, argument); super(location, field);
} }
@Override @Override

View File

@ -25,6 +25,11 @@ public class Count extends NumericAggregate implements DistinctAware {
return distinct; return distinct;
} }
@Override
protected TypeResolution resolveType() {
return TypeResolution.TYPE_RESOLVED;
}
@Override @Override
public DataType dataType() { public DataType dataType() {
return DataTypes.LONG; return DataTypes.LONG;

View File

@ -10,8 +10,8 @@ import org.elasticsearch.xpack.sql.tree.Location;
public class Kurtosis extends NumericAggregate implements MatrixStatsEnclosed { public class Kurtosis extends NumericAggregate implements MatrixStatsEnclosed {
public Kurtosis(Location location, Expression argument) { public Kurtosis(Location location, Expression field) {
super(location, argument); super(location, field);
} }
@Override @Override

View File

@ -11,8 +11,8 @@ import org.elasticsearch.xpack.sql.type.DataType;
public class Max extends NumericAggregate implements EnclosedAgg { public class Max extends NumericAggregate implements EnclosedAgg {
public Max(Location location, Expression argument) { public Max(Location location, Expression field) {
super(location, argument); super(location, field);
} }
@Override @Override

View File

@ -12,8 +12,8 @@ import org.elasticsearch.xpack.sql.type.DataTypes;
public class Mean extends NumericAggregate implements MatrixStatsEnclosed { public class Mean extends NumericAggregate implements MatrixStatsEnclosed {
public Mean(Location location, Expression argument) { public Mean(Location location, Expression field) {
super(location, argument); super(location, field);
} }
@Override @Override

View File

@ -11,8 +11,8 @@ import org.elasticsearch.xpack.sql.type.DataType;
public class Min extends NumericAggregate implements EnclosedAgg { public class Min extends NumericAggregate implements EnclosedAgg {
public Min(Location location, Expression argument) { public Min(Location location, Expression field) {
super(location, argument); super(location, field);
} }
@Override @Override

View File

@ -10,8 +10,8 @@ import org.elasticsearch.xpack.sql.tree.Location;
public class Skewness extends NumericAggregate implements MatrixStatsEnclosed { public class Skewness extends NumericAggregate implements MatrixStatsEnclosed {
public Skewness(Location location, Expression argument) { public Skewness(Location location, Expression field) {
super(location, argument); super(location, field);
} }
@Override @Override

View File

@ -10,8 +10,8 @@ import org.elasticsearch.xpack.sql.tree.Location;
public class StddevPop extends NumericAggregate implements ExtendedStatsEnclosed { public class StddevPop extends NumericAggregate implements ExtendedStatsEnclosed {
public StddevPop(Location location, Expression argument) { public StddevPop(Location location, Expression field) {
super(location, argument); super(location, field);
} }
@Override @Override

View File

@ -11,8 +11,8 @@ import org.elasticsearch.xpack.sql.type.DataType;
public class Sum extends NumericAggregate implements EnclosedAgg { public class Sum extends NumericAggregate implements EnclosedAgg {
public Sum(Location location, Expression argument) { public Sum(Location location, Expression field) {
super(location, argument); super(location, field);
} }
@Override @Override

View File

@ -10,8 +10,8 @@ import org.elasticsearch.xpack.sql.tree.Location;
public class SumOfSquares extends NumericAggregate implements ExtendedStatsEnclosed { public class SumOfSquares extends NumericAggregate implements ExtendedStatsEnclosed {
public SumOfSquares(Location location, Expression argument) { public SumOfSquares(Location location, Expression field) {
super(location, argument); super(location, field);
} }
@Override @Override

View File

@ -10,8 +10,8 @@ import org.elasticsearch.xpack.sql.tree.Location;
public class VarPop extends NumericAggregate implements ExtendedStatsEnclosed { public class VarPop extends NumericAggregate implements ExtendedStatsEnclosed {
public VarPop(Location location, Expression argument) { public VarPop(Location location, Expression field) {
super(location, argument); super(location, field);
} }
@Override @Override