Update test dataset name

Original commit: elastic/x-pack-elasticsearch@49951836c1
This commit is contained in:
Costin Leau 2017-07-04 00:00:11 +03:00
parent 3eb1258b0d
commit 405b4a4166
12 changed files with 189 additions and 171 deletions

View File

@ -64,7 +64,7 @@ dependencies {
// watcher deps // watcher deps
compile 'com.googlecode.owasp-java-html-sanitizer:owasp-java-html-sanitizer:r239' compile 'com.googlecode.owasp-java-html-sanitizer:owasp-java-html-sanitizer:r239'
compile 'com.google.guava:guava:16.0.1' // needed by watcher for the html sanitizer and security tests for jimfs compile 'com.google.guava:guava:18.0' // needed by watcher for the html sanitizer and security tests for jimfs
compile 'com.sun.mail:javax.mail:1.5.6' compile 'com.sun.mail:javax.mail:1.5.6'
// HACK: java 9 removed javax.activation from the default modules, so instead of trying to add modules, which would have // HACK: java 9 removed javax.activation from the default modules, so instead of trying to add modules, which would have
// to be conditionalized for java 8/9, we pull in the classes directly // to be conditionalized for java 8/9, we pull in the classes directly

View File

@ -5,12 +5,12 @@
*/ */
package org.elasticsearch.xpack.sql.jdbc.csv; package org.elasticsearch.xpack.sql.jdbc.csv;
import com.carrotsearch.randomizedtesting.annotations.Name;
import com.carrotsearch.randomizedtesting.annotations.ParametersFactory; import com.carrotsearch.randomizedtesting.annotations.ParametersFactory;
import org.elasticsearch.common.CheckedSupplier; import org.elasticsearch.common.CheckedSupplier;
import org.elasticsearch.xpack.sql.jdbc.framework.CsvSpecTableReader; import org.elasticsearch.xpack.sql.jdbc.framework.CsvSpecTableReader;
import org.elasticsearch.xpack.sql.jdbc.framework.SpecBaseIntegrationTestCase; import org.elasticsearch.xpack.sql.jdbc.framework.SpecBaseIntegrationTestCase;
import org.elasticsearch.xpack.sql.jdbc.framework.SpecBaseIntegrationTestCase.Parser;
import org.elasticsearch.xpack.sql.util.CollectionUtils; import org.elasticsearch.xpack.sql.util.CollectionUtils;
import org.junit.AfterClass; import org.junit.AfterClass;
import org.junit.Test; import org.junit.Test;
@ -54,7 +54,7 @@ public class CsvSpecIntegrationTest extends SpecBaseIntegrationTestCase {
}; };
} }
@ParametersFactory(shuffle = false, argumentFormatting = "name=%1s") @ParametersFactory(shuffle = false, argumentFormatting = PARAM_FORMATTNG)
public static List<Object[]> readScriptSpec() throws Exception { public static List<Object[]> readScriptSpec() throws Exception {
CsvSpecParser parser = new CsvSpecParser(); CsvSpecParser parser = new CsvSpecParser();
return CollectionUtils.combine( return CollectionUtils.combine(
@ -63,7 +63,7 @@ public class CsvSpecIntegrationTest extends SpecBaseIntegrationTestCase {
} }
public CsvSpecIntegrationTest(String groupName, String testName, Integer lineNumber, Path source, CsvFragment fragment) { public CsvSpecIntegrationTest(String groupName, @Name("testName") String testName, Integer lineNumber, Path source, CsvFragment fragment) {
super(groupName, testName, lineNumber, source); super(groupName, testName, lineNumber, source);
this.fragment = fragment; this.fragment = fragment;
} }

View File

@ -18,6 +18,7 @@ import static org.junit.Assert.assertNotNull;
public class EsJdbcServer extends ExternalResource implements CheckedSupplier<Connection, SQLException> { public class EsJdbcServer extends ExternalResource implements CheckedSupplier<Connection, SQLException> {
private Client client;
private JdbcHttpServer server; private JdbcHttpServer server;
private String jdbcUrl; private String jdbcUrl;
private JdbcDriver driver; private JdbcDriver driver;
@ -36,7 +37,8 @@ public class EsJdbcServer extends ExternalResource implements CheckedSupplier<Co
@Override @Override
protected void before() throws Throwable { protected void before() throws Throwable {
server = new JdbcHttpServer(TestUtils.client()); client = TestUtils.client();
server = new JdbcHttpServer(client);
driver = new JdbcDriver(); driver = new JdbcDriver();
server.start(0); server.start(0);
@ -47,6 +49,8 @@ public class EsJdbcServer extends ExternalResource implements CheckedSupplier<Co
@Override @Override
protected void after() { protected void after() {
client.close();
client = null;
server.stop(); server.stop();
server = null; server = null;

View File

@ -12,6 +12,7 @@ import org.junit.rules.ExternalResource;
import java.sql.Connection; import java.sql.Connection;
import java.sql.SQLException; import java.sql.SQLException;
import java.util.Properties; import java.util.Properties;
import java.util.TimeZone;
public class LocalH2 extends ExternalResource implements CheckedSupplier<Connection, SQLException> { public class LocalH2 extends ExternalResource implements CheckedSupplier<Connection, SQLException> {
@ -33,14 +34,20 @@ public class LocalH2 extends ExternalResource implements CheckedSupplier<Connect
* for MySQL and, by default, H2. Our jdbc driver does it. * for MySQL and, by default, H2. Our jdbc driver does it.
*/ */
public LocalH2() { public LocalH2() {
this.url = "jdbc:H2:mem:essql;DATABASE_TO_UPPER=false;ALIAS_COLUMN_NAME=true"; this.url = "jdbc:h2:mem:essql;DATABASE_TO_UPPER=false;ALIAS_COLUMN_NAME=true";
} }
@Override @Override
protected void before() throws Throwable { protected void before() throws Throwable {
keepAlive = get(); keepAlive = get();
//NOCOMMIT: check timezone issue //NOCOMMIT: check timezone issue
keepAlive.createStatement().executeQuery("RUNSCRIPT FROM 'classpath:h2-setup.sql'"); TimeZone tz = TimeZone.getDefault();
try {
TimeZone.setDefault(TimeZone.getTimeZone("UTC"));
keepAlive.createStatement().execute("RUNSCRIPT FROM 'classpath:/h2-setup.sql'");
} finally {
TimeZone.setDefault(tz);
}
} }
@Override @Override

View File

@ -7,7 +7,6 @@ package org.elasticsearch.xpack.sql.jdbc.framework;
import org.elasticsearch.common.Strings; import org.elasticsearch.common.Strings;
import org.elasticsearch.test.ESTestCase; import org.elasticsearch.test.ESTestCase;
import org.elasticsearch.xpack.sql.jdbc.jdbc.JdbcDriver;
import org.junit.Assert; import org.junit.Assert;
import org.junit.ClassRule; import org.junit.ClassRule;
@ -24,10 +23,8 @@ import java.util.Map;
import static java.lang.String.format; import static java.lang.String.format;
public abstract class SpecBaseIntegrationTestCase extends ESTestCase { public abstract class SpecBaseIntegrationTestCase extends ESTestCase {
static {
// Initialize the jdbc driver protected static final String PARAM_FORMATTNG = "%0$s.test%2$s";
JdbcDriver.jdbcMajorVersion();
}
protected final String groupName; protected final String groupName;
protected final String testName; protected final String testName;
@ -37,6 +34,14 @@ public abstract class SpecBaseIntegrationTestCase extends ESTestCase {
@ClassRule @ClassRule
public static EsJdbcServer ES = new EsJdbcServer(); public static EsJdbcServer ES = new EsJdbcServer();
//
// This typically is uncommented when starting up a new instance of ES
//
// @BeforeClass
// public static void start() throws Exception {
// TestUtils.loadDatasetInEs(TestUtils.restClient("localhost", 9200));
// }
public SpecBaseIntegrationTestCase(String groupName, String testName, Integer lineNumber, Path source) { public SpecBaseIntegrationTestCase(String groupName, String testName, Integer lineNumber, Path source) {
this.groupName = groupName; this.groupName = groupName;
this.testName = testName; this.testName = testName;
@ -62,10 +67,12 @@ public abstract class SpecBaseIntegrationTestCase extends ESTestCase {
// spec reader // spec reader
// //
// returns testName, its line location, its source and the custom object (based on each test parser) // returns groupName, testName, its line location, its source and the custom object (based on each test parser)
protected static List<Object[]> readScriptSpec(String url, Parser parser) throws Exception { protected static List<Object[]> readScriptSpec(String url, Parser parser) throws Exception {
Path source = Paths.get(TestUtils.class.getResource(url).toURI()); Path source = Paths.get(TestUtils.class.getResource(url).toURI());
String groupName = source.getFileName().toString(); String fileName = source.getFileName().toString();
int dot = fileName.indexOf(".");
String groupName = dot > 0 ? fileName.substring(0, dot) : fileName;
List<String> lines = Files.readAllLines(source); List<String> lines = Files.readAllLines(source);

View File

@ -90,7 +90,7 @@ public abstract class TestUtils {
createIndex.endObject(); createIndex.endObject();
} }
createIndex.endObject().endObject(); createIndex.endObject().endObject();
client.performRequest("PUT", "/emp", emptyMap(), new StringEntity(createIndex.string(), ContentType.APPLICATION_JSON)); client.performRequest("PUT", "/test_emp", emptyMap(), new StringEntity(createIndex.string(), ContentType.APPLICATION_JSON));
StringBuilder bulk = new StringBuilder(); StringBuilder bulk = new StringBuilder();
csvToLines("employees", (titles, fields) -> { csvToLines("employees", (titles, fields) -> {
@ -104,7 +104,7 @@ public abstract class TestUtils {
} }
bulk.append("}\n"); bulk.append("}\n");
}); });
client.performRequest("POST", "/emp/emp/_bulk", singletonMap("refresh", "true"), new StringEntity(bulk.toString(), ContentType.APPLICATION_JSON)); client.performRequest("POST", "/test_emp/emp/_bulk", singletonMap("refresh", "true"), new StringEntity(bulk.toString(), ContentType.APPLICATION_JSON));
} }
/** /**

View File

@ -10,7 +10,6 @@ import com.carrotsearch.randomizedtesting.annotations.ParametersFactory;
import org.elasticsearch.xpack.sql.jdbc.framework.LocalH2; import org.elasticsearch.xpack.sql.jdbc.framework.LocalH2;
import org.elasticsearch.xpack.sql.jdbc.framework.SpecBaseIntegrationTestCase; import org.elasticsearch.xpack.sql.jdbc.framework.SpecBaseIntegrationTestCase;
import org.elasticsearch.xpack.sql.jdbc.framework.SpecBaseIntegrationTestCase.Parser;
import org.elasticsearch.xpack.sql.util.CollectionUtils; import org.elasticsearch.xpack.sql.util.CollectionUtils;
import org.junit.ClassRule; import org.junit.ClassRule;
import org.junit.Test; import org.junit.Test;
@ -32,7 +31,7 @@ public class SqlSpecIntegrationTest extends SpecBaseIntegrationTestCase {
@ClassRule @ClassRule
public static LocalH2 H2 = new LocalH2(); public static LocalH2 H2 = new LocalH2();
@ParametersFactory(shuffle = false, argumentFormatting = "name=%1s") @ParametersFactory(shuffle = false, argumentFormatting = PARAM_FORMATTNG)
public static List<Object[]> readScriptSpec() throws Exception { public static List<Object[]> readScriptSpec() throws Exception {
SqlSpecParser parser = new SqlSpecParser(); SqlSpecParser parser = new SqlSpecParser();
return CollectionUtils.combine( return CollectionUtils.combine(
@ -61,6 +60,7 @@ public class SqlSpecIntegrationTest extends SpecBaseIntegrationTestCase {
@Test @Test
public void testQuery() throws Throwable { public void testQuery() throws Throwable {
System.out.println("Executing query " + query);
// H2 resultset // H2 resultset
try (Connection h2 = h2Con(); try (Connection h2 = h2Con();
Connection es = esCon()) { Connection es = esCon()) {

View File

@ -3,33 +3,33 @@
// //
groupByOnText groupByOnText
SELECT gender g FROM "emp.emp" GROUP BY gender; SELECT gender g FROM "test_emp.emp" GROUP BY gender;
groupByOnTextWithWhereClause groupByOnTextWithWhereClause
SELECT gender g FROM "emp.emp" WHERE emp_no < 10020 GROUP BY gender; SELECT gender g FROM "test_emp.emp" WHERE emp_no < 10020 GROUP BY gender;
groupByOnTextWithWhereAndLimit groupByOnTextWithWhereAndLimit
SELECT gender g FROM "emp.emp" WHERE emp_no < 10020 GROUP BY gender LIMIT 1; SELECT gender g FROM "test_emp.emp" WHERE emp_no < 10020 GROUP BY gender LIMIT 1;
groupByOnTextOnAlias groupByOnTextOnAlias
SELECT gender g FROM "emp.emp" WHERE emp_no < 10020 GROUP BY g; SELECT gender g FROM "test_emp.emp" WHERE emp_no < 10020 GROUP BY g;
groupByOnTextOnAliasOrderDesc groupByOnTextOnAliasOrderDesc
SELECT gender g FROM "emp.emp" WHERE emp_no < 10020 GROUP BY g ORDER BY g DESC; SELECT gender g FROM "test_emp.emp" WHERE emp_no < 10020 GROUP BY g ORDER BY g DESC;
groupByOnDate groupByOnDate
SELECT birth_date b FROM "emp.emp" GROUP BY birth_date ORDER BY birth_date DESC; SELECT birth_date b FROM "test_emp.emp" GROUP BY birth_date ORDER BY birth_date DESC;
groupByOnDateWithWhereClause groupByOnDateWithWhereClause
SELECT birth_date b FROM "emp.emp" WHERE emp_no < 10020 GROUP BY birth_date ORDER BY birth_date DESC; SELECT birth_date b FROM "test_emp.emp" WHERE emp_no < 10020 GROUP BY birth_date ORDER BY birth_date DESC;
groupByOnDateWithWhereAndLimit groupByOnDateWithWhereAndLimit
SELECT birth_date b FROM "emp.emp" WHERE emp_no < 10020 GROUP BY birth_date ORDER BY birth_date DESC LIMIT 1; SELECT birth_date b FROM "test_emp.emp" WHERE emp_no < 10020 GROUP BY birth_date ORDER BY birth_date DESC LIMIT 1;
groupByOnDateOnAlias groupByOnDateOnAlias
SELECT birth_date b FROM "emp.emp" WHERE emp_no < 10020 GROUP BY b ORDER BY birth_date DESC; SELECT birth_date b FROM "test_emp.emp" WHERE emp_no < 10020 GROUP BY b ORDER BY birth_date DESC;
groupByOnNumber groupByOnNumber
SELECT emp_no e FROM "emp.emp" GROUP BY emp_no ORDER BY emp_no DESC; SELECT emp_no e FROM "test_emp.emp" GROUP BY emp_no ORDER BY emp_no DESC;
groupByOnNumberWithWhereClause groupByOnNumberWithWhereClause
SELECT emp_no e FROM "emp.emp" WHERE emp_no < 10020 GROUP BY emp_no ORDER BY emp_no DESC; SELECT emp_no e FROM "test_emp.emp" WHERE emp_no < 10020 GROUP BY emp_no ORDER BY emp_no DESC;
groupByOnNumberWithWhereAndLimit groupByOnNumberWithWhereAndLimit
SELECT emp_no e FROM "emp.emp" WHERE emp_no < 10020 GROUP BY emp_no ORDER BY emp_no DESC LIMIT 1; SELECT emp_no e FROM "test_emp.emp" WHERE emp_no < 10020 GROUP BY emp_no ORDER BY emp_no DESC LIMIT 1;
groupByOnNumberOnAlias groupByOnNumberOnAlias
SELECT emp_no e FROM "emp.emp" WHERE emp_no < 10020 GROUP BY e ORDER BY emp_no DESC; SELECT emp_no e FROM "test_emp.emp" WHERE emp_no < 10020 GROUP BY e ORDER BY emp_no DESC;
// //
// Aggregate Functions // Aggregate Functions
@ -37,160 +37,160 @@ SELECT emp_no e FROM "emp.emp" WHERE emp_no < 10020 GROUP BY e ORDER BY emp_no D
// COUNT // COUNT
aggCountImplicit aggCountImplicit
SELECT COUNT(*) c FROM "emp.emp"; SELECT COUNT(*) c FROM "test_emp.emp";
aggCountImplicitWithCast aggCountImplicitWithCast
SELECT CAST(COUNT(*) AS INT) c FROM "emp.emp"; SELECT CAST(COUNT(*) AS INT) c FROM "test_emp.emp";
aggCountImplicitWithConstant aggCountImplicitWithConstant
SELECT COUNT(1) FROM "emp.emp"; SELECT COUNT(1) FROM "test_emp.emp";
aggCountImplicitWithConstantAndFilter aggCountImplicitWithConstantAndFilter
SELECT COUNT(1) FROM "emp.emp" WHERE emp_no < 10010; SELECT COUNT(1) FROM "test_emp.emp" WHERE emp_no < 10010;
aggCountAliasAndWhereClause aggCountAliasAndWhereClause
SELECT gender g, COUNT(*) c FROM "emp.emp" WHERE emp_no < 10020 GROUP BY gender; SELECT gender g, COUNT(*) c FROM "test_emp.emp" WHERE emp_no < 10020 GROUP BY gender;
aggCountAliasAndWhereClauseAndLimit aggCountAliasAndWhereClauseAndLimit
SELECT gender g, COUNT(*) c FROM "emp.emp" WHERE emp_no < 10020 GROUP BY gender LIMIT 1; SELECT gender g, COUNT(*) c FROM "test_emp.emp" WHERE emp_no < 10020 GROUP BY gender LIMIT 1;
aggCountAliasWithCastAndFilter aggCountAliasWithCastAndFilter
SELECT gender g, CAST(COUNT(*) AS INT) c FROM "emp.emp" WHERE emp_no < 10020 GROUP BY gender; SELECT gender g, CAST(COUNT(*) AS INT) c FROM "test_emp.emp" WHERE emp_no < 10020 GROUP BY gender;
aggCountWithAlias aggCountWithAlias
SELECT gender g, COUNT(*) c FROM "emp.emp" GROUP BY g; SELECT gender g, COUNT(*) c FROM "test_emp.emp" GROUP BY g;
// Conditional COUNT // Conditional COUNT
aggCountAndHaving aggCountAndHaving
SELECT gender g, COUNT(*) c FROM "emp.emp" GROUP BY g HAVING COUNT(*) > 10; SELECT gender g, COUNT(*) c FROM "test_emp.emp" GROUP BY g HAVING COUNT(*) > 10;
aggCountOnColumnAndHaving aggCountOnColumnAndHaving
SELECT gender g, COUNT(gender) c FROM "emp.emp" GROUP BY g HAVING COUNT(gender) > 10; SELECT gender g, COUNT(gender) c FROM "test_emp.emp" GROUP BY g HAVING COUNT(gender) > 10;
// NOT supported yet since Having introduces a new agg // NOT supported yet since Having introduces a new agg
//aggCountOnColumnAndWildcardAndHaving //aggCountOnColumnAndWildcardAndHaving
//SELECT gender g, COUNT(*) c FROM "emp.emp" GROUP BY g HAVING COUNT(gender) > 10; //SELECT gender g, COUNT(*) c FROM "test_emp.emp" GROUP BY g HAVING COUNT(gender) > 10;
aggCountAndHavingOnAlias aggCountAndHavingOnAlias
SELECT gender g, COUNT(*) c FROM "emp.emp" GROUP BY g HAVING c > 10; SELECT gender g, COUNT(*) c FROM "test_emp.emp" GROUP BY g HAVING c > 10;
aggCountOnColumnAndHavingOnAlias aggCountOnColumnAndHavingOnAlias
SELECT gender g, COUNT(gender) c FROM "emp.emp" GROUP BY g HAVING c > 10; SELECT gender g, COUNT(gender) c FROM "test_emp.emp" GROUP BY g HAVING c > 10;
aggCountOnColumnAndMultipleHaving aggCountOnColumnAndMultipleHaving
SELECT gender g, COUNT(gender) c FROM "emp.emp" GROUP BY g HAVING c > 10 AND c < 70; SELECT gender g, COUNT(gender) c FROM "test_emp.emp" GROUP BY g HAVING c > 10 AND c < 70;
aggCountOnColumnAndMultipleHavingWithLimit aggCountOnColumnAndMultipleHavingWithLimit
SELECT gender g, COUNT(gender) c FROM "emp.emp" GROUP BY g HAVING c > 10 AND c < 70 LIMIT 1; SELECT gender g, COUNT(gender) c FROM "test_emp.emp" GROUP BY g HAVING c > 10 AND c < 70 LIMIT 1;
aggCountOnColumnAndHavingOnAliasAndFunction aggCountOnColumnAndHavingOnAliasAndFunction
SELECT gender g, COUNT(gender) c FROM "emp.emp" GROUP BY g HAVING c > 10 AND COUNT(gender) < 70; SELECT gender g, COUNT(gender) c FROM "test_emp.emp" GROUP BY g HAVING c > 10 AND COUNT(gender) < 70;
// NOT supported yet since Having introduces a new agg // NOT supported yet since Having introduces a new agg
//aggCountOnColumnAndHavingOnAliasAndFunctionWildcard -> COUNT(*/1) vs COUNT(gender) //aggCountOnColumnAndHavingOnAliasAndFunctionWildcard -> COUNT(*/1) vs COUNT(gender)
//SELECT gender g, COUNT(gender) c FROM "emp.emp" GROUP BY g HAVING c > 10 AND COUNT(*) < 70; //SELECT gender g, COUNT(gender) c FROM "test_emp.emp" GROUP BY g HAVING c > 10 AND COUNT(*) < 70;
//aggCountOnColumnAndHavingOnAliasAndFunctionConstant //aggCountOnColumnAndHavingOnAliasAndFunctionConstant
//SELECT gender g, COUNT(gender) c FROM "emp.emp" GROUP BY g HAVING c > 10 AND COUNT(1) < 70; //SELECT gender g, COUNT(gender) c FROM "test_emp.emp" GROUP BY g HAVING c > 10 AND COUNT(1) < 70;
// MIN // MIN
aggMinImplicit aggMinImplicit
SELECT MIN(emp_no) m FROM "emp.emp"; SELECT MIN(emp_no) m FROM "test_emp.emp";
aggMinImplicitWithCast aggMinImplicitWithCast
SELECT CAST(MIN(emp_no) AS SMALLINT) m FROM "emp.emp"; SELECT CAST(MIN(emp_no) AS SMALLINT) m FROM "test_emp.emp";
aggMin aggMin
SELECT gender g, MIN(emp_no) m FROM "emp.emp" GROUP BY gender; SELECT gender g, MIN(emp_no) m FROM "test_emp.emp" GROUP BY gender;
aggMinWithCast aggMinWithCast
SELECT CAST(MIN(emp_no) AS SMALLINT) m FROM "emp.emp" GROUP BY gender; SELECT CAST(MIN(emp_no) AS SMALLINT) m FROM "test_emp.emp" GROUP BY gender;
aggMinAndCount aggMinAndCount
SELECT MIN(emp_no) m, COUNT(1) c FROM "emp.emp" GROUP BY gender; SELECT MIN(emp_no) m, COUNT(1) c FROM "test_emp.emp" GROUP BY gender;
aggMinAndCountWithFilter aggMinAndCountWithFilter
SELECT MIN(emp_no) m, COUNT(1) c FROM "emp.emp" WHERE emp_no < 10020 GROUP BY gender ; SELECT MIN(emp_no) m, COUNT(1) c FROM "test_emp.emp" WHERE emp_no < 10020 GROUP BY gender ;
aggMinAndCountWithFilterAndLimit aggMinAndCountWithFilterAndLimit
SELECT MIN(emp_no) m, COUNT(1) c FROM "emp.emp" WHERE emp_no < 10020 GROUP BY gender LIMIT 1; SELECT MIN(emp_no) m, COUNT(1) c FROM "test_emp.emp" WHERE emp_no < 10020 GROUP BY gender LIMIT 1;
aggMinWithCastAndFilter aggMinWithCastAndFilter
SELECT gender g, CAST(MIN(emp_no) AS SMALLINT) m, COUNT(1) c FROM "emp.emp" WHERE emp_no < 10020 GROUP BY gender; SELECT gender g, CAST(MIN(emp_no) AS SMALLINT) m, COUNT(1) c FROM "test_emp.emp" WHERE emp_no < 10020 GROUP BY gender;
aggMinWithAlias aggMinWithAlias
SELECT gender g, MIN(emp_no) m FROM "emp.emp" GROUP BY g; SELECT gender g, MIN(emp_no) m FROM "test_emp.emp" GROUP BY g;
// Conditional MIN // Conditional MIN
aggMinWithHaving aggMinWithHaving
SELECT gender g, MIN(emp_no) m FROM "emp.emp" GROUP BY g HAVING MIN(emp_no) > 10; SELECT gender g, MIN(emp_no) m FROM "test_emp.emp" GROUP BY g HAVING MIN(emp_no) > 10;
aggMinWithHavingOnAlias aggMinWithHavingOnAlias
SELECT gender g, MIN(emp_no) m FROM "emp.emp" GROUP BY g HAVING m > 10; SELECT gender g, MIN(emp_no) m FROM "test_emp.emp" GROUP BY g HAVING m > 10;
aggMinWithMultipleHaving aggMinWithMultipleHaving
SELECT gender g, MIN(emp_no) m FROM "emp.emp" GROUP BY g HAVING m > 10 AND m < 99999; SELECT gender g, MIN(emp_no) m FROM "test_emp.emp" GROUP BY g HAVING m > 10 AND m < 99999;
aggMinWithMultipleHavingWithLimit aggMinWithMultipleHavingWithLimit
SELECT gender g, MIN(emp_no) m FROM "emp.emp" GROUP BY g HAVING m > 10 AND m < 99999 LIMIT 1; SELECT gender g, MIN(emp_no) m FROM "test_emp.emp" GROUP BY g HAVING m > 10 AND m < 99999 LIMIT 1;
aggMinWithMultipleHavingOnAliasAndFunction aggMinWithMultipleHavingOnAliasAndFunction
SELECT gender g, MIN(emp_no) m FROM "emp.emp" GROUP BY g HAVING m > 10 AND MIN(emp_no) < 99999; SELECT gender g, MIN(emp_no) m FROM "test_emp.emp" GROUP BY g HAVING m > 10 AND MIN(emp_no) < 99999;
// MAX // MAX
aggMaxImplicit aggMaxImplicit
SELECT MAX(emp_no) c FROM "emp.emp"; SELECT MAX(emp_no) c FROM "test_emp.emp";
aggMaxImplicitWithCast aggMaxImplicitWithCast
SELECT CAST(MAX(emp_no) AS SMALLINT) c FROM "emp.emp"; SELECT CAST(MAX(emp_no) AS SMALLINT) c FROM "test_emp.emp";
aggMax aggMax
SELECT gender g, MAX(emp_no) m FROM "emp.emp" GROUP BY gender ; SELECT gender g, MAX(emp_no) m FROM "test_emp.emp" GROUP BY gender ;
aggMaxWithCast aggMaxWithCast
SELECT gender g, CAST(MAX(emp_no) AS SMALLINT) m FROM "emp.emp" GROUP BY gender ; SELECT gender g, CAST(MAX(emp_no) AS SMALLINT) m FROM "test_emp.emp" GROUP BY gender ;
aggMaxAndCount aggMaxAndCount
SELECT MAX(emp_no) m, COUNT(1) c FROM "emp.emp" GROUP BY gender; SELECT MAX(emp_no) m, COUNT(1) c FROM "test_emp.emp" GROUP BY gender;
aggMaxAndCountWithFilter aggMaxAndCountWithFilter
SELECT gender g, MAX(emp_no) m, COUNT(1) c FROM "emp.emp" WHERE emp_no > 10000 GROUP BY gender; SELECT gender g, MAX(emp_no) m, COUNT(1) c FROM "test_emp.emp" WHERE emp_no > 10000 GROUP BY gender;
aggMaxAndCountWithFilterAndLimit aggMaxAndCountWithFilterAndLimit
SELECT gender g, MAX(emp_no) m, COUNT(1) c FROM "emp.emp" WHERE emp_no > 10000 GROUP BY gender LIMIT 1; SELECT gender g, MAX(emp_no) m, COUNT(1) c FROM "test_emp.emp" WHERE emp_no > 10000 GROUP BY gender LIMIT 1;
aggMaxWithAlias aggMaxWithAlias
SELECT gender g, MAX(emp_no) m FROM "emp.emp" GROUP BY g; SELECT gender g, MAX(emp_no) m FROM "test_emp.emp" GROUP BY g;
// Conditional MAX // Conditional MAX
aggMaxWithHaving aggMaxWithHaving
SELECT gender g, MAX(emp_no) m FROM "emp.emp" GROUP BY g HAVING MAX(emp_no) > 10; SELECT gender g, MAX(emp_no) m FROM "test_emp.emp" GROUP BY g HAVING MAX(emp_no) > 10;
aggMaxWithHavingOnAlias aggMaxWithHavingOnAlias
SELECT gender g, MAX(emp_no) m FROM "emp.emp" GROUP BY g HAVING m > 10; SELECT gender g, MAX(emp_no) m FROM "test_emp.emp" GROUP BY g HAVING m > 10;
aggMaxWithMultipleHaving aggMaxWithMultipleHaving
SELECT gender g, MAX(emp_no) m FROM "emp.emp" GROUP BY g HAVING m > 10 AND m < 99999; SELECT gender g, MAX(emp_no) m FROM "test_emp.emp" GROUP BY g HAVING m > 10 AND m < 99999;
aggMaxWithMultipleHavingWithLimit aggMaxWithMultipleHavingWithLimit
SELECT gender g, MAX(emp_no) m FROM "emp.emp" GROUP BY g HAVING m > 10 AND m < 99999 LIMIT 1; SELECT gender g, MAX(emp_no) m FROM "test_emp.emp" GROUP BY g HAVING m > 10 AND m < 99999 LIMIT 1;
aggMaxWithMultipleHavingOnAliasAndFunction aggMaxWithMultipleHavingOnAliasAndFunction
SELECT gender g, MAX(emp_no) m FROM "emp.emp" GROUP BY g HAVING m > 10 AND MAX(emp_no) < 99999; SELECT gender g, MAX(emp_no) m FROM "test_emp.emp" GROUP BY g HAVING m > 10 AND MAX(emp_no) < 99999;
// SUM // SUM
aggSumImplicitWithCast aggSumImplicitWithCast
SELECT CAST(SUM(emp_no) AS BIGINT) s FROM "emp.emp"; SELECT CAST(SUM(emp_no) AS BIGINT) s FROM "test_emp.emp";
aggSumWithCast aggSumWithCast
SELECT gender g, CAST(SUM(emp_no) AS BIGINT) s FROM "emp.emp" GROUP BY gender; SELECT gender g, CAST(SUM(emp_no) AS BIGINT) s FROM "test_emp.emp" GROUP BY gender;
aggSumWithCastAndCount aggSumWithCastAndCount
SELECT gender g, CAST(SUM(emp_no) AS BIGINT) s, COUNT(1) c FROM "emp.emp" GROUP BY gender; SELECT gender g, CAST(SUM(emp_no) AS BIGINT) s, COUNT(1) c FROM "test_emp.emp" GROUP BY gender;
aggSumWithCastAndCountWithFilter aggSumWithCastAndCountWithFilter
SELECT gender g, CAST(SUM(emp_no) AS BIGINT) s, COUNT(1) c FROM "emp.emp" WHERE emp_no > 10000 GROUP BY gender; SELECT gender g, CAST(SUM(emp_no) AS BIGINT) s, COUNT(1) c FROM "test_emp.emp" WHERE emp_no > 10000 GROUP BY gender;
aggSumWithCastAndCountWithFilterAndLimit aggSumWithCastAndCountWithFilterAndLimit
SELECT gender g, CAST(SUM(emp_no) AS BIGINT) s, COUNT(1) c FROM "emp.emp" WHERE emp_no > 10000 GROUP BY gender LIMIT 1; SELECT gender g, CAST(SUM(emp_no) AS BIGINT) s, COUNT(1) c FROM "test_emp.emp" WHERE emp_no > 10000 GROUP BY gender LIMIT 1;
aggSumWithAlias aggSumWithAlias
SELECT gender g, CAST(SUM(emp_no) AS BIGINT) s FROM "emp.emp" GROUP BY g; SELECT gender g, CAST(SUM(emp_no) AS BIGINT) s FROM "test_emp.emp" GROUP BY g;
// Conditional SUM // Conditional SUM
aggSumWithHaving aggSumWithHaving
SELECT gender g, CAST(SUM(emp_no) AS INT) s FROM "emp.emp" GROUP BY g HAVING SUM(emp_no) > 10; SELECT gender g, CAST(SUM(emp_no) AS INT) s FROM "test_emp.emp" GROUP BY g HAVING SUM(emp_no) > 10;
aggSumWithHavingOnAlias aggSumWithHavingOnAlias
SELECT gender g, CAST(SUM(emp_no) AS INT) s FROM "emp.emp" GROUP BY g HAVING s > 10; SELECT gender g, CAST(SUM(emp_no) AS INT) s FROM "test_emp.emp" GROUP BY g HAVING s > 10;
aggSumWithMultipleHaving aggSumWithMultipleHaving
SELECT gender g, CAST(SUM(emp_no) AS INT) s FROM "emp.emp" GROUP BY g HAVING s > 10 AND s < 10000000; SELECT gender g, CAST(SUM(emp_no) AS INT) s FROM "test_emp.emp" GROUP BY g HAVING s > 10 AND s < 10000000;
aggSumWithMultipleHavingWithLimit aggSumWithMultipleHavingWithLimit
SELECT gender g, CAST(SUM(emp_no) AS INT) s FROM "emp.emp" GROUP BY g HAVING s > 10 AND s < 10000000 LIMIT 1; SELECT gender g, CAST(SUM(emp_no) AS INT) s FROM "test_emp.emp" GROUP BY g HAVING s > 10 AND s < 10000000 LIMIT 1;
aggSumWithMultipleHavingOnAliasAndFunction aggSumWithMultipleHavingOnAliasAndFunction
SELECT gender g, CAST(SUM(emp_no) AS INT) s FROM "emp.emp" GROUP BY g HAVING s > 10 AND SUM(emp_no) > 10000000; SELECT gender g, CAST(SUM(emp_no) AS INT) s FROM "test_emp.emp" GROUP BY g HAVING s > 10 AND SUM(emp_no) > 10000000;
// AVG // AVG
aggAvgImplicitWithCast aggAvgImplicitWithCast
SELECT CAST(AVG(emp_no) AS FLOAT) a FROM "emp.emp"; SELECT CAST(AVG(emp_no) AS FLOAT) a FROM "test_emp.emp";
aggAvgWithCastToFloat aggAvgWithCastToFloat
SELECT gender g, CAST(AVG(emp_no) AS FLOAT) a FROM "emp.emp" GROUP BY gender; SELECT gender g, CAST(AVG(emp_no) AS FLOAT) a FROM "test_emp.emp" GROUP BY gender;
// casting to an exact type - varchar, bigint, etc... will likely fail due to rounding error // casting to an exact type - varchar, bigint, etc... will likely fail due to rounding error
aggAvgWithCastToDouble aggAvgWithCastToDouble
SELECT gender g, CAST(AVG(emp_no) AS DOUBLE) a FROM "emp.emp" GROUP BY gender; SELECT gender g, CAST(AVG(emp_no) AS DOUBLE) a FROM "test_emp.emp" GROUP BY gender;
aggAvgWithCastAndCount aggAvgWithCastAndCount
SELECT gender g, CAST(AVG(emp_no) AS FLOAT) a, COUNT(1) c FROM "emp.emp" GROUP BY gender; SELECT gender g, CAST(AVG(emp_no) AS FLOAT) a, COUNT(1) c FROM "test_emp.emp" GROUP BY gender;
aggAvgWithCastAndCountWithFilter aggAvgWithCastAndCountWithFilter
SELECT gender g, CAST(AVG(emp_no) AS FLOAT) a, COUNT(1) c FROM "emp.emp" WHERE emp_no > 10000 GROUP BY gender ; SELECT gender g, CAST(AVG(emp_no) AS FLOAT) a, COUNT(1) c FROM "test_emp.emp" WHERE emp_no > 10000 GROUP BY gender ;
aggAvgWithCastAndCountWithFilterAndLimit aggAvgWithCastAndCountWithFilterAndLimit
SELECT gender g, CAST(AVG(emp_no) AS FLOAT) a, COUNT(1) c FROM "emp.emp" WHERE emp_no > 10000 GROUP BY gender LIMIT 1; SELECT gender g, CAST(AVG(emp_no) AS FLOAT) a, COUNT(1) c FROM "test_emp.emp" WHERE emp_no > 10000 GROUP BY gender LIMIT 1;
aggAvgWithAlias aggAvgWithAlias
SELECT gender g, CAST(AVG(emp_no) AS FLOAT) a FROM "emp.emp" GROUP BY g; SELECT gender g, CAST(AVG(emp_no) AS FLOAT) a FROM "test_emp.emp" GROUP BY g;
// Conditional AVG // Conditional AVG
aggAvgWithHaving aggAvgWithHaving
SELECT gender g, CAST(AVG(emp_no) AS FLOAT) a FROM "emp.emp" GROUP BY g HAVING AVG(emp_no) > 10; SELECT gender g, CAST(AVG(emp_no) AS FLOAT) a FROM "test_emp.emp" GROUP BY g HAVING AVG(emp_no) > 10;
aggAvgWithHavingOnAlias aggAvgWithHavingOnAlias
SELECT gender g, CAST(AVG(emp_no) AS FLOAT) a FROM "emp.emp" GROUP BY g HAVING a > 10; SELECT gender g, CAST(AVG(emp_no) AS FLOAT) a FROM "test_emp.emp" GROUP BY g HAVING a > 10;
aggAvgWithMultipleHaving aggAvgWithMultipleHaving
SELECT gender g, CAST(AVG(emp_no) AS FLOAT) a FROM "emp.emp" GROUP BY g HAVING a > 10 AND a < 10000000; SELECT gender g, CAST(AVG(emp_no) AS FLOAT) a FROM "test_emp.emp" GROUP BY g HAVING a > 10 AND a < 10000000;
aggAvgWithMultipleHavingWithLimit aggAvgWithMultipleHavingWithLimit
SELECT gender g, CAST(AVG(emp_no) AS FLOAT) a FROM "emp.emp" GROUP BY g HAVING a > 10 AND a < 10000000 LIMIT 1; SELECT gender g, CAST(AVG(emp_no) AS FLOAT) a FROM "test_emp.emp" GROUP BY g HAVING a > 10 AND a < 10000000 LIMIT 1;
aggAvgWithMultipleHavingOnAliasAndFunction aggAvgWithMultipleHavingOnAliasAndFunction
SELECT gender g, CAST(AVG(emp_no) AS FLOAT) a FROM "emp.emp" GROUP BY g HAVING a > 10 AND AVG(emp_no) > 10000000; SELECT gender g, CAST(AVG(emp_no) AS FLOAT) a FROM "test_emp.emp" GROUP BY g HAVING a > 10 AND AVG(emp_no) > 10000000;

View File

@ -6,11 +6,11 @@
// Time // Time
// //
dateTimeSecond dateTimeSecond
SELECT SECOND(birth_date) d, last_name l FROM "emp.emp" WHERE emp_no < 10010 ORDER BY emp_no; SELECT SECOND(birth_date) d, last_name l FROM "test_emp.emp" WHERE emp_no < 10010 ORDER BY emp_no;
dateTimeMinute dateTimeMinute
SELECT MINUTE(birth_date) d, last_name l FROM "emp.emp" WHERE emp_no < 10010 ORDER BY emp_no; SELECT MINUTE(birth_date) d, last_name l FROM "test_emp.emp" WHERE emp_no < 10010 ORDER BY emp_no;
dateTimeHour dateTimeHour
SELECT HOUR(birth_date) d, last_name l FROM "emp.emp" WHERE emp_no < 10010 ORDER BY emp_no; SELECT HOUR(birth_date) d, last_name l FROM "test_emp.emp" WHERE emp_no < 10010 ORDER BY emp_no;
// //
@ -18,17 +18,17 @@ SELECT HOUR(birth_date) d, last_name l FROM "emp.emp" WHERE emp_no < 10010 ORDER
// //
dateTimeDay dateTimeDay
SELECT DAY(birth_date) d, last_name l FROM "emp.emp" WHERE emp_no < 10010 ORDER BY emp_no; SELECT DAY(birth_date) d, last_name l FROM "test_emp.emp" WHERE emp_no < 10010 ORDER BY emp_no;
dateTimeDayOfMonth dateTimeDayOfMonth
SELECT DAY_OF_MONTH(birth_date) d, last_name l FROM "emp.emp" WHERE emp_no < 10010 ORDER BY emp_no; SELECT DAY_OF_MONTH(birth_date) d, last_name l FROM "test_emp.emp" WHERE emp_no < 10010 ORDER BY emp_no;
// dateTimeDayOfWeek - disable since it starts at 0 not 1 // dateTimeDayOfWeek - disable since it starts at 0 not 1
// SELECT DAY_OF_WEEK(birth_date) d, last_name l FROM "emp.emp" WHERE emp_no < 10010 ORDER BY emp_no; // SELECT DAY_OF_WEEK(birth_date) d, last_name l FROM "test_emp.emp" WHERE emp_no < 10010 ORDER BY emp_no;
dateTimeDayOfYear dateTimeDayOfYear
SELECT DAY_OF_YEAR(birth_date) d, last_name l FROM "emp.emp" WHERE emp_no < 10010 ORDER BY emp_no; SELECT DAY_OF_YEAR(birth_date) d, last_name l FROM "test_emp.emp" WHERE emp_no < 10010 ORDER BY emp_no;
dateTimeMonth dateTimeMonth
SELECT MONTH(birth_date) d, last_name l FROM "emp.emp" WHERE emp_no < 10010 ORDER BY emp_no; SELECT MONTH(birth_date) d, last_name l FROM "test_emp.emp" WHERE emp_no < 10010 ORDER BY emp_no;
dateTimeYear dateTimeYear
SELECT YEAR(birth_date) d, last_name l FROM "emp.emp" WHERE emp_no < 10010 ORDER BY emp_no; SELECT YEAR(birth_date) d, last_name l FROM "test_emp.emp" WHERE emp_no < 10010 ORDER BY emp_no;
// NOCOMMIT figure out a way to test the aliases that are unsupported by h2 but are supported by us because they are like PostgreSQL // NOCOMMIT figure out a way to test the aliases that are unsupported by h2 but are supported by us because they are like PostgreSQL
@ -37,19 +37,19 @@ SELECT YEAR(birth_date) d, last_name l FROM "emp.emp" WHERE emp_no < 10010 ORDER
// Filter // Filter
// //
dateTimeFilterDayOfMonth dateTimeFilterDayOfMonth
SELECT DAY_OF_MONTH(birth_date) AS d, last_name l FROM "emp.emp" WHERE DAY_OF_MONTH(birth_date) <= 10 ORDER BY emp_no LIMIT 5; SELECT DAY_OF_MONTH(birth_date) AS d, last_name l FROM "test_emp.emp" WHERE DAY_OF_MONTH(birth_date) <= 10 ORDER BY emp_no LIMIT 5;
dateTimeFilterMonth dateTimeFilterMonth
SELECT MONTH(birth_date) AS d, last_name l FROM "emp.emp" WHERE MONTH(birth_date) <= 5 ORDER BY emp_no LIMIT 5; SELECT MONTH(birth_date) AS d, last_name l FROM "test_emp.emp" WHERE MONTH(birth_date) <= 5 ORDER BY emp_no LIMIT 5;
dateTimeFilterYear dateTimeFilterYear
SELECT YEAR(birth_date) AS d, last_name l FROM "emp.emp" WHERE YEAR(birth_date) <= 1960 ORDER BY emp_no LIMIT 5; SELECT YEAR(birth_date) AS d, last_name l FROM "test_emp.emp" WHERE YEAR(birth_date) <= 1960 ORDER BY emp_no LIMIT 5;
// //
// Aggregate // Aggregate
// //
dateTimeAggByYear dateTimeAggByYear
SELECT YEAR(birth_date) AS d, CAST(SUM(emp_no) AS INT) s FROM "emp.emp" GROUP BY YEAR(birth_date) ORDER BY YEAR(birth_date) LIMIT 5; SELECT YEAR(birth_date) AS d, CAST(SUM(emp_no) AS INT) s FROM "test_emp.emp" GROUP BY YEAR(birth_date) ORDER BY YEAR(birth_date) LIMIT 5;
// NOCOMMIT Elasticsearch doesn't line up // NOCOMMIT Elasticsearch doesn't line up
// dateTimeAggByMonth // dateTimeAggByMonth
// SELECT MONTH(birth_date) AS d, CAST(SUM(emp_no) AS INT) s FROM "emp.emp" GROUP BY MONTH(birth_date) ORDER BY MONTH(birth_date) LIMIT 5; // SELECT MONTH(birth_date) AS d, CAST(SUM(emp_no) AS INT) s FROM "test_emp.emp" GROUP BY MONTH(birth_date) ORDER BY MONTH(birth_date) LIMIT 5;
// dateTimeAggByDayOfMonth // dateTimeAggByDayOfMonth
// SELECT DAY_OF_MONTH(birth_date) AS d, CAST(SUM(emp_no) AS INT) s FROM "emp.emp" GROUP BY DAY_OF_MONTH(birth_date) ORDER BY DAY_OF_MONTH(birth_date) DESC; // SELECT DAY_OF_MONTH(birth_date) AS d, CAST(SUM(emp_no) AS INT) s FROM "test_emp.emp" GROUP BY DAY_OF_MONTH(birth_date) ORDER BY DAY_OF_MONTH(birth_date) DESC;

View File

@ -3,18 +3,18 @@
// //
whereFieldQuality whereFieldQuality
SELECT last_name l FROM "emp.emp" WHERE emp_no = 10000 LIMIT 5; SELECT last_name l FROM "test_emp.emp" WHERE emp_no = 10000 LIMIT 5;
whereFieldLessThan whereFieldLessThan
SELECT last_name l FROM "emp.emp" WHERE emp_no < 10003 ORDER BY emp_no LIMIT 5; SELECT last_name l FROM "test_emp.emp" WHERE emp_no < 10003 ORDER BY emp_no LIMIT 5;
whereFieldAndComparison whereFieldAndComparison
SELECT last_name l FROM "emp.emp" WHERE emp_no > 10000 AND emp_no < 10005 ORDER BY emp_no LIMIT 5; SELECT last_name l FROM "test_emp.emp" WHERE emp_no > 10000 AND emp_no < 10005 ORDER BY emp_no LIMIT 5;
whereFieldOrComparison whereFieldOrComparison
SELECT last_name l FROM "emp.emp" WHERE emp_no < 10003 OR emp_no = 10005 ORDER BY emp_no LIMIT 5; SELECT last_name l FROM "test_emp.emp" WHERE emp_no < 10003 OR emp_no = 10005 ORDER BY emp_no LIMIT 5;
whereFieldWithOrder whereFieldWithOrder
SELECT last_name l FROM "emp.emp" WHERE emp_no < 10003 ORDER BY emp_no; SELECT last_name l FROM "test_emp.emp" WHERE emp_no < 10003 ORDER BY emp_no;
whereFieldWithExactMatchOnString whereFieldWithExactMatchOnString
SELECT last_name l FROM "emp.emp" WHERE emp_no < 10003 AND gender = 'M'; SELECT last_name l FROM "test_emp.emp" WHERE emp_no < 10003 AND gender = 'M';
whereFieldWithLikeMatch whereFieldWithLikeMatch
SELECT last_name l FROM "emp.emp" WHERE emp_no < 10003 AND last_name LIKE 'K%'; SELECT last_name l FROM "test_emp.emp" WHERE emp_no < 10003 AND last_name LIKE 'K%';
whereFieldOnMatchWithAndAndOr whereFieldOnMatchWithAndAndOr
SELECT last_name l FROM "emp.emp" WHERE emp_no < 10003 AND (gender = 'M' AND NOT FALSE OR last_name LIKE 'K%') ORDER BY emp_no; SELECT last_name l FROM "test_emp.emp" WHERE emp_no < 10003 AND (gender = 'M' AND NOT FALSE OR last_name LIKE 'K%') ORDER BY emp_no;

View File

@ -3,73 +3,73 @@
// //
mathAbs mathAbs
SELECT ABS(emp_no) m, first_name FROM "emp.emp" WHERE emp_no < 10010 ORDER BY emp_no; SELECT ABS(emp_no) m, first_name FROM "test_emp.emp" WHERE emp_no < 10010 ORDER BY emp_no;
mathACos mathACos
SELECT ACOS(emp_no) m, first_name FROM "emp.emp" WHERE emp_no < 10010 ORDER BY emp_no; SELECT ACOS(emp_no) m, first_name FROM "test_emp.emp" WHERE emp_no < 10010 ORDER BY emp_no;
mathASin mathASin
SELECT ASIN(emp_no) m, first_name FROM "emp.emp" WHERE emp_no < 10010 ORDER BY emp_no; SELECT ASIN(emp_no) m, first_name FROM "test_emp.emp" WHERE emp_no < 10010 ORDER BY emp_no;
mathATan mathATan
SELECT ATAN(emp_no) m, first_name FROM "emp.emp" WHERE emp_no < 10010 ORDER BY emp_no; SELECT ATAN(emp_no) m, first_name FROM "test_emp.emp" WHERE emp_no < 10010 ORDER BY emp_no;
//mathCbrt //mathCbrt
//SELECT CBRT(emp_no) m, first_name FROM "emp.emp" WHERE emp_no < 10010 ORDER BY emp_no; //SELECT CBRT(emp_no) m, first_name FROM "test_emp.emp" WHERE emp_no < 10010 ORDER BY emp_no;
mathCeil mathCeil
SELECT CEIL(emp_no) m, first_name FROM "emp.emp" WHERE emp_no < 10010 ORDER BY emp_no; SELECT CEIL(emp_no) m, first_name FROM "test_emp.emp" WHERE emp_no < 10010 ORDER BY emp_no;
mathCos mathCos
SELECT COS(emp_no) m, first_name FROM "emp.emp" WHERE emp_no < 10010 ORDER BY emp_no; SELECT COS(emp_no) m, first_name FROM "test_emp.emp" WHERE emp_no < 10010 ORDER BY emp_no;
mathCosh mathCosh
SELECT COSH(emp_no) m, first_name FROM "emp.emp" WHERE emp_no < 10010 ORDER BY emp_no; SELECT COSH(emp_no) m, first_name FROM "test_emp.emp" WHERE emp_no < 10010 ORDER BY emp_no;
mathDegrees mathDegrees
SELECT DEGREES(emp_no) m, first_name FROM "emp.emp" WHERE emp_no < 10010 ORDER BY emp_no; SELECT DEGREES(emp_no) m, first_name FROM "test_emp.emp" WHERE emp_no < 10010 ORDER BY emp_no;
mathFloor mathFloor
SELECT CAST(FLOOR(emp_no) AS INT) m, first_name FROM "emp.emp" WHERE emp_no < 10010 ORDER BY emp_no; SELECT CAST(FLOOR(emp_no) AS INT) m, first_name FROM "test_emp.emp" WHERE emp_no < 10010 ORDER BY emp_no;
mathLog mathLog
SELECT LOG(emp_no) m, first_name FROM "emp.emp" WHERE emp_no < 10010 ORDER BY emp_no; SELECT LOG(emp_no) m, first_name FROM "test_emp.emp" WHERE emp_no < 10010 ORDER BY emp_no;
mathLog10 mathLog10
SELECT LOG10(emp_no) m, first_name FROM "emp.emp" WHERE emp_no < 10010 ORDER BY emp_no; SELECT LOG10(emp_no) m, first_name FROM "test_emp.emp" WHERE emp_no < 10010 ORDER BY emp_no;
mathRadians mathRadians
SELECT RADIANS(emp_no) m, first_name FROM "emp.emp" WHERE emp_no < 10010 ORDER BY emp_no; SELECT RADIANS(emp_no) m, first_name FROM "test_emp.emp" WHERE emp_no < 10010 ORDER BY emp_no;
mathRound mathRound
SELECT CAST(ROUND(emp_no) AS INT) m, first_name FROM "emp.emp" WHERE emp_no < 10010 ORDER BY emp_no; SELECT CAST(ROUND(emp_no) AS INT) m, first_name FROM "test_emp.emp" WHERE emp_no < 10010 ORDER BY emp_no;
mathSin mathSin
SELECT SIN(emp_no) m, first_name FROM "emp.emp" WHERE emp_no < 10010 ORDER BY emp_no; SELECT SIN(emp_no) m, first_name FROM "test_emp.emp" WHERE emp_no < 10010 ORDER BY emp_no;
mathSinH mathSinH
SELECT SINH(emp_no) m, first_name FROM "emp.emp" WHERE emp_no < 10010 ORDER BY emp_no; SELECT SINH(emp_no) m, first_name FROM "test_emp.emp" WHERE emp_no < 10010 ORDER BY emp_no;
mathSqrt mathSqrt
SELECT SQRT(emp_no) m, first_name FROM "emp.emp" WHERE emp_no < 10010 ORDER BY emp_no; SELECT SQRT(emp_no) m, first_name FROM "test_emp.emp" WHERE emp_no < 10010 ORDER BY emp_no;
mathTan mathTan
SELECT TAN(emp_no) m, first_name FROM "emp.emp" WHERE emp_no < 10010 ORDER BY emp_no; SELECT TAN(emp_no) m, first_name FROM "test_emp.emp" WHERE emp_no < 10010 ORDER BY emp_no;
// //
// Combined methods // Combined methods
// //
mathAbsOfSin mathAbsOfSin
SELECT ABS(SIN(emp_no)) m, first_name FROM "emp.emp" WHERE emp_no < 10010 ORDER BY emp_no; SELECT ABS(SIN(emp_no)) m, first_name FROM "test_emp.emp" WHERE emp_no < 10010 ORDER BY emp_no;
mathAbsOfCeilOfSin mathAbsOfCeilOfSin
SELECT EXP(ABS(CEIL(SIN(DEGREES(emp_no))))) m, first_name FROM "emp.emp" WHERE emp_no < 10010 ORDER BY emp_no; SELECT EXP(ABS(CEIL(SIN(DEGREES(emp_no))))) m, first_name FROM "test_emp.emp" WHERE emp_no < 10010 ORDER BY emp_no;
mathAbsOfCeilOfSinWithFilter mathAbsOfCeilOfSinWithFilter
SELECT EXP(ABS(CEIL(SIN(DEGREES(emp_no))))) m, first_name FROM "emp.emp" WHERE EXP(ABS(CEIL(SIN(DEGREES(emp_no))))) < 10 ORDER BY emp_no; SELECT EXP(ABS(CEIL(SIN(DEGREES(emp_no))))) m, first_name FROM "test_emp.emp" WHERE EXP(ABS(CEIL(SIN(DEGREES(emp_no))))) < 10 ORDER BY emp_no;
// //
// Filter by Scalar // Filter by Scalar
// //
mathAbsFilterAndOrder mathAbsFilterAndOrder
SELECT emp_no, ABS(emp_no) m, first_name FROM "emp.emp" WHERE ABS(emp_no) < 10010 ORDER BY ABS(emp_no); SELECT emp_no, ABS(emp_no) m, first_name FROM "test_emp.emp" WHERE ABS(emp_no) < 10010 ORDER BY ABS(emp_no);
mathACosFilterAndOrder mathACosFilterAndOrder
SELECT emp_no, ACOS(emp_no) m, first_name FROM "emp.emp" WHERE ACOS(emp_no) < 10010 ORDER BY ACOS(emp_no); SELECT emp_no, ACOS(emp_no) m, first_name FROM "test_emp.emp" WHERE ACOS(emp_no) < 10010 ORDER BY ACOS(emp_no);
mathASinFilterAndOrder mathASinFilterAndOrder
SELECT emp_no, ASIN(emp_no) m, first_name FROM "emp.emp" WHERE ASIN(emp_no) < 10010 ORDER BY ASIN(emp_no); SELECT emp_no, ASIN(emp_no) m, first_name FROM "test_emp.emp" WHERE ASIN(emp_no) < 10010 ORDER BY ASIN(emp_no);
//mathATanFilterAndOrder //mathATanFilterAndOrder
//SELECT emp_no, ATAN(emp_no) m, first_name FROM "emp.emp" WHERE ATAN(emp_no) < 10010 ORDER BY ATAN(emp_no); //SELECT emp_no, ATAN(emp_no) m, first_name FROM "test_emp.emp" WHERE ATAN(emp_no) < 10010 ORDER BY ATAN(emp_no);
mathCeilFilterAndOrder mathCeilFilterAndOrder
SELECT emp_no, CEIL(emp_no) m, first_name FROM "emp.emp" WHERE CEIL(emp_no) < 10010 ORDER BY CEIL(emp_no); SELECT emp_no, CEIL(emp_no) m, first_name FROM "test_emp.emp" WHERE CEIL(emp_no) < 10010 ORDER BY CEIL(emp_no);
//mathCosFilterAndOrder //mathCosFilterAndOrder
//SELECT emp_no, COS(emp_no) m, first_name FROM "emp.emp" WHERE COS(emp_no) < 10010 ORDER BY COS(emp_no); //SELECT emp_no, COS(emp_no) m, first_name FROM "test_emp.emp" WHERE COS(emp_no) < 10010 ORDER BY COS(emp_no);
//mathCoshFilterAndOrder //mathCoshFilterAndOrder
//SELECT emp_no, COSH(emp_no) m, first_name FROM "emp.emp" WHERE COSH(emp_no) < 10010 ORDER BY COSH(emp_no); //SELECT emp_no, COSH(emp_no) m, first_name FROM "test_emp.emp" WHERE COSH(emp_no) < 10010 ORDER BY COSH(emp_no);
// //
// constants - added when folding will be supported // constants - added when folding will be supported
// //
//mathConstantPI //mathConstantPI
//SELECT ABS(emp_no) m, PI(), first_name FROM "emp.emp" WHERE emp_no < 10010 ORDER BY emp_no; //SELECT ABS(emp_no) m, PI(), first_name FROM "test_emp.emp" WHERE emp_no < 10010 ORDER BY emp_no;

View File

@ -3,36 +3,36 @@
// //
wildcardWithOrder wildcardWithOrder
SELECT * FROM "emp.emp" ORDER BY emp_no; SELECT * FROM "test_emp.emp" ORDER BY emp_no;
column column
SELECT last_name FROM "emp.emp" ORDER BY emp_no; SELECT last_name FROM "test_emp.emp" ORDER BY emp_no;
columnWithAlias columnWithAlias
SELECT last_name AS l FROM "emp.emp" ORDER BY emp_no; SELECT last_name AS l FROM "test_emp.emp" ORDER BY emp_no;
columnWithAliasNoAs columnWithAliasNoAs
SELECT last_name l FROM "emp.emp" ORDER BY emp_no; SELECT last_name l FROM "test_emp.emp" ORDER BY emp_no;
multipleColumnsNoAlias multipleColumnsNoAlias
SELECT first_name, last_name FROM "emp.emp" ORDER BY emp_no; SELECT first_name, last_name FROM "test_emp.emp" ORDER BY emp_no;
multipleColumnWithAliasWithAndWithoutAs multipleColumnWithAliasWithAndWithoutAs
SELECT first_name f, last_name AS l FROM "emp.emp" ORDER BY emp_no; SELECT first_name f, last_name AS l FROM "test_emp.emp" ORDER BY emp_no;
// //
// SELECT with LIMIT // SELECT with LIMIT
// //
wildcardWithLimit wildcardWithLimit
SELECT * FROM "emp.emp" ORDER BY emp_no LIMIT 5; SELECT * FROM "test_emp.emp" ORDER BY emp_no LIMIT 5;
wildcardWithOrderWithLimit wildcardWithOrderWithLimit
SELECT * FROM "emp.emp" ORDER BY emp_no LIMIT 5; SELECT * FROM "test_emp.emp" ORDER BY emp_no LIMIT 5;
columnWithLimit columnWithLimit
SELECT last_name FROM "emp.emp" ORDER BY emp_no LIMIT 5; SELECT last_name FROM "test_emp.emp" ORDER BY emp_no LIMIT 5;
columnWithAliasWithLimit columnWithAliasWithLimit
SELECT last_name AS l FROM "emp.emp" ORDER BY emp_no LIMIT 5; SELECT last_name AS l FROM "test_emp.emp" ORDER BY emp_no LIMIT 5;
columnWithAliasNoAsWithLimit columnWithAliasNoAsWithLimit
SELECT last_name l FROM "emp.emp" ORDER BY emp_no LIMIT 5; SELECT last_name l FROM "test_emp.emp" ORDER BY emp_no LIMIT 5;
multipleColumnsNoAliasWithLimit multipleColumnsNoAliasWithLimit
SELECT first_name, last_name FROM "emp.emp" ORDER BY emp_no LIMIT 5; SELECT first_name, last_name FROM "test_emp.emp" ORDER BY emp_no LIMIT 5;
multipleColumnWithAliasWithAndWithoutAsWithLimit multipleColumnWithAliasWithAndWithoutAsWithLimit
SELECT first_name f, last_name AS l FROM "emp.emp" ORDER BY emp_no LIMIT 5; SELECT first_name f, last_name AS l FROM "test_emp.emp" ORDER BY emp_no LIMIT 5;
// //
@ -41,16 +41,16 @@ SELECT first_name f, last_name AS l FROM "emp.emp" ORDER BY emp_no LIMIT 5;
//castWithLiteralToInt //castWithLiteralToInt
//SELECT CAST(1 AS INT); //SELECT CAST(1 AS INT);
castOnColumnNumberToVarchar castOnColumnNumberToVarchar
SELECT CAST(emp_no AS VARCHAR) AS emp_no_cast FROM "emp.emp" ORDER BY emp_no LIMIT 5; SELECT CAST(emp_no AS VARCHAR) AS emp_no_cast FROM "test_emp.emp" ORDER BY emp_no LIMIT 5;
castOnColumnNumberToLong castOnColumnNumberToLong
SELECT CAST(emp_no AS BIGINT) AS emp_no_cast FROM "emp.emp" ORDER BY emp_no LIMIT 5; SELECT CAST(emp_no AS BIGINT) AS emp_no_cast FROM "test_emp.emp" ORDER BY emp_no LIMIT 5;
castOnColumnNumberToSmallint castOnColumnNumberToSmallint
SELECT CAST(emp_no AS SMALLINT) AS emp_no_cast FROM "emp.emp" ORDER BY emp_no LIMIT 5; SELECT CAST(emp_no AS SMALLINT) AS emp_no_cast FROM "test_emp.emp" ORDER BY emp_no LIMIT 5;
castOnColumnNumberWithAliasToInt castOnColumnNumberWithAliasToInt
SELECT CAST(emp_no AS INT) AS emp_no_cast FROM "emp.emp" ORDER BY emp_no LIMIT 5; SELECT CAST(emp_no AS INT) AS emp_no_cast FROM "test_emp.emp" ORDER BY emp_no LIMIT 5;
castOnColumnNumberToReal castOnColumnNumberToReal
SELECT CAST(emp_no AS REAL) AS emp_no_cast FROM "emp.emp" ORDER BY emp_no LIMIT 5; SELECT CAST(emp_no AS REAL) AS emp_no_cast FROM "test_emp.emp" ORDER BY emp_no LIMIT 5;
castOnColumnNumberToDouble castOnColumnNumberToDouble
SELECT CAST(emp_no AS DOUBLE) AS emp_no_cast FROM "emp.emp" ORDER BY emp_no LIMIT 5; SELECT CAST(emp_no AS DOUBLE) AS emp_no_cast FROM "test_emp.emp" ORDER BY emp_no LIMIT 5;
castOnColumnNumberToBoolean castOnColumnNumberToBoolean
SELECT CAST(emp_no AS BOOL) AS emp_no_cast FROM "emp.emp" ORDER BY emp_no LIMIT 5; SELECT CAST(emp_no AS BOOL) AS emp_no_cast FROM "test_emp.emp" ORDER BY emp_no LIMIT 5;