getLiteralCapabilities() {
- return literalCaps;
- }
-}
diff --git a/jdbc-adapter/virtualschema-common/src/main/java/com/exasol/adapter/capabilities/LiteralCapability.java b/jdbc-adapter/virtualschema-common/src/main/java/com/exasol/adapter/capabilities/LiteralCapability.java
deleted file mode 100644
index 12946acf3..000000000
--- a/jdbc-adapter/virtualschema-common/src/main/java/com/exasol/adapter/capabilities/LiteralCapability.java
+++ /dev/null
@@ -1,65 +0,0 @@
-package com.exasol.adapter.capabilities;
-
-/**
- * This is an enumeration of the capabilities for literals supported by the EXASOL Virtual Schema Framework.
- *
- * E.g. to execute a system "SELECT * FROM t WHERE username='alice'" your data source needs the {@link #STRING} capability.
- */
-public enum LiteralCapability {
-
- /**
- * The literal for null values.
- * Example in EXASOL syntax: NULL
- */
- NULL,
-
- /**
- * The literal for boolean values.
- * Example in EXASOL syntax: TRUE
- */
- BOOL,
-
- /**
- * The literal for date values.
- * Example in EXASOL syntax: DATE '2000-01-28'
- */
- DATE,
-
- /**
- * The literal for timestamp values.
- * Example in EXASOL syntax: TIMESTAMP '2000-01-28 12:30:01.001'
- */
- TIMESTAMP,
-
- /**
- * The literal for timestamp values. There is no direct literal for timestamps, but it can be created via casting.
- *
- * Example in EXASOL syntax: CAST(TIMESTAMP '2000-01-28 12:30:01.001' AS TIMESTAMP WITH LOCAL TIME ZONE)
- */
- TIMESTAMP_UTC,
-
- /**
- * The literal for double values.
- * Example in EXASOL syntax: 100.23
- */
- DOUBLE,
-
- /**
- * The literal for exact numeric values.
- * Example in EXASOL syntax: 123
- */
- EXACTNUMERIC,
-
- /**
- * The literal for string values.
- * Example in EXASOL syntax: 'alice'
- */
- STRING,
-
- /**
- * The literal for interval values.
- * Example in EXASOL syntax: INTERVAL '5' MONTH
- */
- INTERVAL
-
-}
diff --git a/jdbc-adapter/virtualschema-common/src/main/java/com/exasol/adapter/capabilities/MainCapability.java b/jdbc-adapter/virtualschema-common/src/main/java/com/exasol/adapter/capabilities/MainCapability.java
deleted file mode 100644
index 2c72ad1d6..000000000
--- a/jdbc-adapter/virtualschema-common/src/main/java/com/exasol/adapter/capabilities/MainCapability.java
+++ /dev/null
@@ -1,103 +0,0 @@
-package com.exasol.adapter.capabilities;
-
-/**
- * This is an enumeration of the main capabilities supported by the EXASOL Virtual Schema Framework.
- */
-public enum MainCapability {
-
- /**
- * Support projections, i.e. request only a subset of all columns of the
- * table.
- *
- * Example: SELECT a FROM t;
- */
- SELECTLIST_PROJECTION,
-
- /**
- * Support expressions in the select list;
- * Additional capabilities are required depending on the expression.
- *
- * Example: SELECT a+1, ucase(b) FROM t;
- */
- SELECTLIST_EXPRESSIONS,
-
- /**
- * Support filter expressions. Additional capabilities are required
- * depending on the expression.
- *
- * Example: SELECT * FROM t WHERE a>2
- */
- FILTER_EXPRESSIONS,
-
- /**
- * Support aggregations with a single group. This happens when an
- * aggregation-function is used without a group by clause.
- *
- * Example: SELECT min(a) FROM t;
- */
- AGGREGATE_SINGLE_GROUP,
-
- /**
- * Support aggregations with a group by clause consisting of columns.
- *
- * Example: SELECT a, b, min(c) FROM t GROUP BY a, b;
- */
- AGGREGATE_GROUP_BY_COLUMN,
-
- /**
- * Support aggregations with a group by clause that contains expressions.
- *
- * Example: SELECT a+1, min(b) FROM t GROUP BY a+1;
- */
- AGGREGATE_GROUP_BY_EXPRESSION,
-
- /**
- * Support aggregations with a group by clause with multiple group by
- * columns or expressions.
- * Note that you might additionally require AGGREGATE_GROUP_BY_EXPRESSION or
- * AGGREGATE_GROUP_BY_COLUMN.
- *
- * Example: SELECT a, b, min(c) FROM t GROUP BY a, b;
- */
- AGGREGATE_GROUP_BY_TUPLE,
-
- /**
- * Support aggregations with a having clause. Additional capabilities might
- * be required depending on the expression.
- *
- * Example: SELECT a, min(b) FROM t GROUP BY a HAVING min(b) > 10;
- */
- AGGREGATE_HAVING,
-
- /**
- * Support to order the result by columns.
- *
- * Attention: This includes the capability to specify NULLS FIRST/LAST and ASC/DESC.
- *
- * Example: SELECT a, b FROM t ORDER BY a, b DESC NULLS FIRST;
- */
- ORDER_BY_COLUMN,
-
- /**
- * Support to order the result by expressions.
- *
- * Attention: This includes the capability to specify NULLS FIRST/LAST and ASC/DESC
- *
- * Example: SELECT a FROM t ORDER BY abs(a) ASC NULLS LAST;
- */
- ORDER_BY_EXPRESSION,
-
- /**
- * Support to limit the number of result rows. Often used together with ordering.
- *
- * Example: SELECT * FROM t 0
- */
- LIMIT,
-
- /**
- * Support to limit the number of result rows including an offset.
- *
- * Example: SELECT * FROM t LIMIT 100 OFFSET 10;
- */
- LIMIT_WITH_OFFSET
-}
diff --git a/jdbc-adapter/virtualschema-common/src/main/java/com/exasol/adapter/capabilities/PredicateCapability.java b/jdbc-adapter/virtualschema-common/src/main/java/com/exasol/adapter/capabilities/PredicateCapability.java
deleted file mode 100644
index 7e0863f4e..000000000
--- a/jdbc-adapter/virtualschema-common/src/main/java/com/exasol/adapter/capabilities/PredicateCapability.java
+++ /dev/null
@@ -1,38 +0,0 @@
-package com.exasol.adapter.capabilities;
-
-import com.exasol.adapter.sql.Predicate;
-
-/**
- * List of all Predicates (scalar functions returning bool) supported by EXASOL.
- */
-public enum PredicateCapability {
- AND,
- OR,
- NOT,
- EQUAL,
- NOTEQUAL,
- LESS,
- LESSEQUAL,
- LIKE,
- LIKE_ESCAPE (Predicate.LIKE), // the LIKE predicate with the optional escape character defined
- REGEXP_LIKE,
- BETWEEN,
- IN_CONSTLIST,
- IS_NULL,
- IS_NOT_NULL;
-
- private Predicate predicate;
-
- PredicateCapability() {
- this.predicate = Predicate.valueOf(name());
- }
-
- PredicateCapability(Predicate predicate) {
- this.predicate = predicate;
- }
-
- public Predicate getPredicate() {
- return predicate;
- }
-}
-
diff --git a/jdbc-adapter/virtualschema-common/src/main/java/com/exasol/adapter/capabilities/ScalarFunctionCapability.java b/jdbc-adapter/virtualschema-common/src/main/java/com/exasol/adapter/capabilities/ScalarFunctionCapability.java
deleted file mode 100644
index 62ad5ebfa..000000000
--- a/jdbc-adapter/virtualschema-common/src/main/java/com/exasol/adapter/capabilities/ScalarFunctionCapability.java
+++ /dev/null
@@ -1,221 +0,0 @@
-package com.exasol.adapter.capabilities;
-
-import com.exasol.adapter.sql.ScalarFunction;
-
-/**
- * List of all scalar functions supported by EXASOL. Note that predicates are handled separately in {@link PredicateCapability}.
- */
-public enum ScalarFunctionCapability {
-
- // Standard Arithmetic Operators
- ADD,
- SUB,
- MULT,
- FLOAT_DIV,
-
- // Unary prefix operators
- NEG,
-
- // Numeric functions
- ABS,
- ACOS,
- ASIN,
- ATAN,
- ATAN2,
- CEIL,
- COS,
- COSH,
- COT,
- DEGREES,
- DIV,
- EXP,
- FLOOR,
- GREATEST,
- LEAST,
- LN,
- LOG,
- MOD,
- POWER,
- RADIANS,
- RAND,
- ROUND,
- SIGN,
- SIN,
- SINH,
- SQRT,
- TAN,
- TANH,
- TRUNC,
- // Aliases:
- // LOG10 and LOG2 via LN
-
- // String Functions
- ASCII,
- BIT_LENGTH,
- CHR,
- COLOGNE_PHONETIC,
- CONCAT,
- DUMP,
- EDIT_DISTANCE,
- INSERT,
- INSTR,
- LENGTH,
- LOCATE,
- LOWER,
- LPAD,
- LTRIM,
- OCTET_LENGTH,
- REGEXP_INSTR,
- REGEXP_REPLACE,
- REGEXP_SUBSTR,
- REPEAT,
- REPLACE,
- REVERSE,
- RIGHT,
- RPAD,
- RTRIM,
- SOUNDEX,
- SPACE,
- SUBSTR,
- TRANSLATE,
- TRIM,
- UNICODE,
- UNICODECHR,
- UPPER,
- // Aliases:
- // POSITION via INSTR or LOCATE
- // LCASE via LCASE
- // MID via SUBSTR
- // LEFT via SUBSTR?
- // UCASE via UPPER
- // CHARACTER_LENGTH via LENGTH?
-
- // Date/Time Functions
- ADD_DAYS,
- ADD_HOURS,
- ADD_MINUTES,
- ADD_MONTHS,
- ADD_SECONDS,
- ADD_WEEKS,
- ADD_YEARS,
- CONVERT_TZ,
- CURRENT_DATE,
- CURRENT_TIMESTAMP,
- DATE_TRUNC,
- DAY,
- DAYS_BETWEEN,
- DBTIMEZONE,
- EXTRACT,
- HOURS_BETWEEN,
- LOCALTIMESTAMP,
- MINUTE,
- MINUTES_BETWEEN,
- MONTH,
- MONTHS_BETWEEN,
- NUMTODSINTERVAL,
- NUMTOYMINTERVAL,
- POSIX_TIME,
- SECOND,
- SECONDS_BETWEEN,
- SESSIONTIMEZONE,
- SYSDATE,
- SYSTIMESTAMP,
- WEEK,
- YEAR,
- YEARS_BETWEEN,
-
- // Geospatial
- // - Point Functions
- ST_X,
- ST_Y,
- // - (Multi-)LineString Functions
- ST_ENDPOINT,
- ST_ISCLOSED,
- ST_ISRING,
- ST_LENGTH,
- ST_NUMPOINTS,
- ST_POINTN,
- ST_STARTPOINT,
- // - (Multi-)Polygon Functions
- ST_AREA,
- ST_EXTERIORRING,
- ST_INTERIORRINGN,
- ST_NUMINTERIORRINGS,
- // - GeometryCollection Functions
- ST_GEOMETRYN,
- ST_NUMGEOMETRIES,
- // - General Functions
- ST_BOUNDARY,
- ST_BUFFER,
- ST_CENTROID,
- ST_CONTAINS,
- ST_CONVEXHULL,
- ST_CROSSES,
- ST_DIFFERENCE,
- ST_DIMENSION,
- ST_DISJOINT,
- ST_DISTANCE,
- ST_ENVELOPE,
- ST_EQUALS,
- ST_FORCE2D,
- ST_GEOMETRYTYPE,
- ST_INTERSECTION,
- ST_INTERSECTS,
- ST_ISEMPTY,
- ST_ISSIMPLE,
- ST_OVERLAPS,
- ST_SETSRID,
- ST_SYMDIFFERENCE,
- ST_TOUCHES,
- ST_TRANSFORM,
- ST_UNION,
- ST_WITHIN,
-
- // Conversion functions
- CAST, // Has alias CONVERT
- IS_NUMBER,
- IS_BOOLEAN,
- IS_DATE,
- IS_DSINTERVAL,
- IS_YMINTERVAL,
- IS_TIMESTAMP,
- TO_CHAR,
- TO_DATE,
- TO_DSINTERVAL,
- TO_YMINTERVAL,
- TO_NUMBER,
- TO_TIMESTAMP,
-
- // Bitwise functions
- BIT_AND,
- BIT_CHECK,
- BIT_NOT,
- BIT_OR,
- BIT_SET,
- BIT_TO_NUM,
- BIT_XOR,
-
- // Other functions
- CASE,
- CURRENT_SCHEMA,
- CURRENT_SESSION,
- CURRENT_STATEMENT,
- CURRENT_USER,
- HASH_MD5,
- HASH_SHA,
- HASH_SHA1,
- HASH_TIGER,
- NULLIFZERO,
- SYS_GUID,
- ZEROIFNULL
-
- // Skipped: Connect-By Functions
- ;
-
- public ScalarFunction getFunction() {
- // The set of capabilites and functions should be completely equal.
- return ScalarFunction.valueOf(name());
- }
-
-}
-
diff --git a/jdbc-adapter/virtualschema-common/src/main/java/com/exasol/adapter/json/RequestJsonParser.java b/jdbc-adapter/virtualschema-common/src/main/java/com/exasol/adapter/json/RequestJsonParser.java
deleted file mode 100644
index 5c998a227..000000000
--- a/jdbc-adapter/virtualschema-common/src/main/java/com/exasol/adapter/json/RequestJsonParser.java
+++ /dev/null
@@ -1,576 +0,0 @@
-package com.exasol.adapter.json;
-
-import com.exasol.adapter.metadata.*;
-import com.exasol.adapter.metadata.DataType.ExaCharset;
-import com.exasol.adapter.metadata.DataType.IntervalType;
-import com.exasol.adapter.request.*;
-import com.exasol.adapter.sql.*;
-import com.exasol.utils.JsonHelper;
-
-import javax.json.JsonArray;
-import javax.json.JsonObject;
-import javax.json.JsonString;
-import javax.json.JsonValue;
-import javax.json.JsonValue.ValueType;
-import java.math.BigDecimal;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-public class RequestJsonParser {
-
- private List involvedTablesMetadata;
-
- public AdapterRequest parseRequest(String json) throws Exception {
- JsonObject root = JsonHelper.getJsonObject(json);
- String requestType = root.getString("type","");
- SchemaMetadataInfo meta = parseMetadataInfo(root);
- if (requestType.equals("createVirtualSchema")) {
- return new CreateVirtualSchemaRequest(meta);
- } else if (requestType.equals("dropVirtualSchema")) {
- return new DropVirtualSchemaRequest(meta);
- } else if (requestType.equals("refresh")) {
- if (root.containsKey("requestedTables")) {
- List tables = new ArrayList<>();
- for (JsonString table : root.getJsonArray("requestedTables").getValuesAs(JsonString.class)) {
- tables.add(table.getString());
- }
- return new RefreshRequest(meta, tables);
- } else {
- return new RefreshRequest(meta);
- }
- } else if (requestType.equals("setProperties")) {
- Map properties = new HashMap();
- assert(root.containsKey("properties") && root.get("properties").getValueType() == ValueType.OBJECT);
- for (Map.Entry entry : root.getJsonObject("properties").entrySet()) {
- String key = entry.getKey();
- // Null values represent properties which are deleted by the user (might also have never existed actually)
- if (root.getJsonObject("properties").isNull(key)) {
- properties.put(key.toUpperCase(), null);
- } else {
- properties.put(key.toUpperCase(), root.getJsonObject("properties").getString(key));
- }
- }
- return new SetPropertiesRequest(meta, properties);
- } else if (requestType.equals("getCapabilities")) {
- return new GetCapabilitiesRequest(meta);
- } else if (requestType.equals("pushdown")) {
- assert(root.containsKey("involvedTables") && root.get("involvedTables").getValueType() == ValueType.ARRAY);
- involvedTablesMetadata = parseInvolvedTableMetadata(root.getJsonArray("involvedTables"));
- JsonObject pushdownExp;
- if (root.containsKey("pushdownRequest")) {
- pushdownExp = root.getJsonObject("pushdownRequest");
- } else {
- pushdownExp = root.getJsonObject("pushdownInquiry"); // This is outdated, remove when old versions are no longer used
- }
- SqlNode select = parseExpression(pushdownExp);
- assert(select.getType() == SqlNodeType.SELECT);
- return new PushdownRequest(meta, (SqlStatementSelect)select, involvedTablesMetadata);
- } else {
- throw new RuntimeException("Request Type not supported: " + requestType);
- }
- }
-
- private List parseInvolvedTableMetadata(JsonArray involvedTables) throws MetadataException {
- List tables = new ArrayList<>();
- for (JsonObject table : involvedTables.getValuesAs(JsonObject.class)) {
- String tableName = table.getString("name","");
- String tableAdapterNotes = readAdapterNotes(table);
- String tableComment = table.getString("comment", "");
- List columns = new ArrayList<>();
- for (JsonObject column : table.getJsonArray("columns").getValuesAs(JsonObject.class)) {
- columns.add(parseColumnMetadata(column));
- }
- tables.add(new TableMetadata(tableName, tableAdapterNotes, columns, tableComment));
- }
- return tables;
- }
-
- private ColumnMetadata parseColumnMetadata(JsonObject column) throws MetadataException {
- String columnName = column.getString("name");
- String adapterNotes = readAdapterNotes(column);
- String comment = column.getString("comment", "");
- String defaultValue = column.getString("default", "");
- boolean isNullable = true;
- if (column.containsKey("isNullable")) {
- isNullable = column.getBoolean("isNullable");
- }
- boolean isIdentity = true;
- if (column.containsKey("isIdentity")) {
- isIdentity = column.getBoolean("isIdentity");
- }
- JsonObject dataType = column.getJsonObject("dataType");
- DataType type = getDataType(dataType);
- return new ColumnMetadata(columnName, adapterNotes, type, isNullable, isIdentity, defaultValue, comment);
- }
-
- private DataType getDataType(JsonObject dataType) throws MetadataException {
- String typeName = dataType.getString("type").toUpperCase();
- DataType type = null;
- if (typeName.equals("DECIMAL")) {
- type = DataType.createDecimal(dataType.getInt("precision"), dataType.getInt("scale"));
- } else if (typeName.equals("DOUBLE")) {
- type = DataType.createDouble();
- } else if (typeName.equals("VARCHAR")) {
- String charSet = dataType.getString("characterSet", "UTF8");
- type = DataType.createVarChar(dataType.getInt("size"), charSetFromString(charSet));
- } else if (typeName.equals("CHAR")) {
- String charSet = dataType.getString("characterSet", "UTF8");
- type = DataType.createChar(dataType.getInt("size"), charSetFromString(charSet));
- } else if (typeName.equals("BOOLEAN")) {
- type = DataType.createBool();
- } else if (typeName.equals("DATE")) {
- type = DataType.createDate();
- } else if (typeName.equals("TIMESTAMP")) {
- boolean withLocalTimezone = dataType.getBoolean("withLocalTimeZone", false);
- type = DataType.createTimestamp(withLocalTimezone);
- } else if (typeName.equals("INTERVAL")) {
- int precision = dataType.getInt("precision", 2); // has a default in EXASOL
- IntervalType intervalType = intervalTypeFromString(dataType.getString("fromTo"));
- if (intervalType == IntervalType.DAY_TO_SECOND) {
- int fraction = dataType.getInt("fraction", 3); // has a default in EXASOL
- type = DataType.createIntervalDaySecond(precision, fraction);
- } else {
- assert(intervalType == IntervalType.YEAR_TO_MONTH);
- type = DataType.createIntervalYearMonth(precision);
- }
- } else if (typeName.equals("GEOMETRY")) {
- int srid = dataType.getInt("srid");
- type = DataType.createGeometry(srid);
- } else {
- throw new MetadataException("Unsupported data type encountered: " + typeName);
- }
- return type;
- }
-
- private static IntervalType intervalTypeFromString(String intervalType) throws MetadataException {
- if (intervalType.equals("DAY TO SECONDS")) {
- return IntervalType.DAY_TO_SECOND;
- } else if (intervalType.equals("YEAR TO MONTH")) {
- return IntervalType.YEAR_TO_MONTH;
- } else {
- throw new MetadataException("Unsupported interval data type encountered: " + intervalType);
- }
- }
-
- private static ExaCharset charSetFromString(String charset) throws MetadataException {
- if (charset.equals("UTF8")) {
- return ExaCharset.UTF8;
- } else if (charset.equals("ASCII")) {
- return ExaCharset.ASCII;
- } else {
- throw new MetadataException("Unsupported charset encountered: " + charset);
- }
- }
-
- private SqlStatementSelect parseSelect(JsonObject select) throws MetadataException {
- // FROM clause
- SqlNode table = parseExpression(select.getJsonObject("from"));
- assert(table.getType() == SqlNodeType.TABLE || table.getType() == SqlNodeType.JOIN);
- // SELECT list
- SqlSelectList selectList = parseSelectList(select.getJsonArray("selectList"));
- // GROUP BY
-// boolean hasAggregation = false;
-// boolean hasGroupBy = false;
-// if (select.containsKey("aggregationType")) {
-// hasAggregation = true;
-// hasGroupBy = select.getString("aggregationType").equals("group_by");
-// }
- SqlExpressionList groupByClause = parseGroupBy(select.getJsonArray("groupBy"));
-
- // WHERE clause
- SqlNode whereClause = null;
- if (select.containsKey("filter")) {
- whereClause = parseExpression(select.getJsonObject("filter"));
- }
- SqlNode having = null;
- if (select.containsKey("having")) {
- having = parseExpression(select.getJsonObject("having"));
- }
- SqlOrderBy orderBy = null;
- if (select.containsKey("orderBy")) {
- orderBy = parseOrderBy(select.getJsonArray("orderBy"));
- }
- SqlLimit limit = null;
- if (select.containsKey("limit")) {
- limit = parseLimit(select.getJsonObject("limit"));
- }
- return new SqlStatementSelect(table, selectList, whereClause, groupByClause, having, orderBy, limit);
- }
-
- private List parseExpressionList(JsonArray array) throws MetadataException {
- assert(array != null);
- List sqlNodes = new ArrayList<>();
- for (JsonObject expr : array.getValuesAs(JsonObject.class)) {
- SqlNode node = parseExpression(expr);
- sqlNodes.add(node);
- }
- return sqlNodes;
- }
-
- private SqlGroupBy parseGroupBy(JsonArray groupBy) throws MetadataException {
- if (groupBy == null) {
- return null;
- }
- List groupByElements = parseExpressionList(groupBy);
- return new SqlGroupBy(groupByElements);
- }
-
- private SqlSelectList parseSelectList(JsonArray selectList) throws MetadataException {
- if (selectList == null) {
- // this is like SELECT *
- return SqlSelectList.createSelectStarSelectList();
- }
- List selectListElements = parseExpressionList(selectList);
- if (selectListElements.size() == 0) {
- return SqlSelectList.createAnyValueSelectList();
- } else {
- return SqlSelectList.createRegularSelectList(selectListElements);
- }
- }
-
- private SqlOrderBy parseOrderBy(JsonArray orderByList) throws MetadataException {
- List orderByExpressions = new ArrayList<>();
- List isAsc = new ArrayList<>();
- List nullsLast = new ArrayList<>();
- for (int i=0; i properties = new HashMap();
- if (meta.getJsonObject("properties") != null) {
- for (Map.Entry entry : meta.getJsonObject("properties").entrySet()) {
- String key = entry.getKey();
- properties.put(key.toUpperCase(), meta.getJsonObject("properties").getString(key));
- }
- }
- return new SchemaMetadataInfo(schemaName, schemaAdapterNotes, properties);
- }
-
- private static String readAdapterNotes(JsonObject root) {
- if (root.containsKey("adapterNotes")) {
- JsonValue notes = root.get("adapterNotes");
- if (notes.getValueType() == ValueType.STRING) {
- // Return unquoted string
- return ((JsonString)notes).getString();
- } else {
- return notes.toString();
- }
- }
- return "";
- }
-
- private SqlNode parseExpression(JsonObject exp) throws MetadataException {
- String typeName = exp.getString("type", "");
- SqlNodeType type = fromTypeName(typeName);
- switch (type) {
- case SELECT:
- return parseSelect(exp);
- case TABLE: {
- String tableName = exp.getString("name");
- TableMetadata tableMetadata = findInvolvedTableMetadata(tableName);
- if (exp.containsKey("alias")) {
- String tableAlias = exp.getString("alias");
- return new SqlTable(tableName, tableAlias, tableMetadata);
- } else {
- return new SqlTable(tableName, tableMetadata);
- }
- }
- case JOIN: {
- SqlNode left = parseExpression(exp.getJsonObject("left"));
- SqlNode right = parseExpression(exp.getJsonObject("right"));
- SqlNode condition = parseExpression(exp.getJsonObject("condition"));
- JoinType joinType = fromJoinTypeName(exp.getString("join_type"));
- return new SqlJoin(left, right, condition, joinType);
- }
- case COLUMN: {
- int columnId = exp.getInt("columnNr");
- String columnName = exp.getString("name");
- String tableName = exp.getString("tableName");
- ColumnMetadata columnMetadata = findColumnMetadata(tableName, columnName);
- return new SqlColumn(columnId, columnMetadata, tableName);
- }
- case LITERAL_NULL: {
- return new SqlLiteralNull();
- }
- case LITERAL_BOOL: {
- boolean boolVal = exp.getBoolean("value");
- return new SqlLiteralBool(boolVal);
- }
- case LITERAL_DATE: {
- String date = exp.getString("value");
- return new SqlLiteralDate(date);
- }
- case LITERAL_TIMESTAMP: {
- String timestamp = exp.getString("value");
- return new SqlLiteralTimestamp(timestamp);
- }
- case LITERAL_TIMESTAMPUTC: {
- String timestampUtc = exp.getString("value");
- return new SqlLiteralTimestampUtc(timestampUtc);
- }
- case LITERAL_DOUBLE: {
- String doubleString = exp.getString("value");
- return new SqlLiteralDouble(Double.parseDouble(doubleString));
- }
- case LITERAL_EXACTNUMERIC: {
- BigDecimal exactVal = new BigDecimal( exp.getString("value"));
- return new SqlLiteralExactnumeric(exactVal);
- }
- case LITERAL_STRING: {
- String stringVal = exp.getString("value");
- return new SqlLiteralString(stringVal);
- }
- case LITERAL_INTERVAL: {
- String intervalVal = exp.getString("value");
- DataType intervalType = getDataType(exp.getJsonObject("dataType"));
- return new SqlLiteralInterval(intervalVal, intervalType);
- }
- case PREDICATE_AND: {
- List andedPredicates = new ArrayList<>();
- for (JsonObject pred : exp.getJsonArray("expressions").getValuesAs(JsonObject.class)) {
- andedPredicates.add(parseExpression(pred));
- }
- return new SqlPredicateAnd(andedPredicates);
- }
- case PREDICATE_OR: {
- List orPredicates = new ArrayList<>();
- for (JsonObject pred : exp.getJsonArray("expressions").getValuesAs(JsonObject.class)) {
- orPredicates.add(parseExpression(pred));
- }
- return new SqlPredicateOr(orPredicates);
- }
- case PREDICATE_NOT: {
- SqlNode notExp = parseExpression(exp.getJsonObject("expression"));
- return new SqlPredicateNot(notExp);
- }
- case PREDICATE_EQUAL: {
- SqlNode equalLeft = parseExpression(exp.getJsonObject("left"));
- SqlNode equalRight = parseExpression(exp.getJsonObject("right"));
- return new SqlPredicateEqual(equalLeft, equalRight);
- }
- case PREDICATE_NOTEQUAL: {
- SqlNode notEqualLeft = parseExpression(exp.getJsonObject("left"));
- SqlNode notEqualRight = parseExpression(exp.getJsonObject("right"));
- return new SqlPredicateNotEqual(notEqualLeft, notEqualRight);
- }
- case PREDICATE_LESS: {
- SqlNode lessLeft = parseExpression(exp.getJsonObject("left"));
- SqlNode lessRight = parseExpression(exp.getJsonObject("right"));
- return new SqlPredicateLess(lessLeft, lessRight);
- }
- case PREDICATE_LESSEQUAL: {
- SqlNode lessEqLeft = parseExpression(exp.getJsonObject("left"));
- SqlNode lessEqRight = parseExpression(exp.getJsonObject("right"));
- return new SqlPredicateLessEqual(lessEqLeft, lessEqRight);
- }
- case PREDICATE_LIKE: {
- SqlNode likeLeft = parseExpression(exp.getJsonObject("expression"));
- SqlNode likePattern = parseExpression(exp.getJsonObject("pattern"));
- if (exp.containsKey("escapeChar")) {
- SqlNode escapeChar = parseExpression(exp.getJsonObject("escapeChar"));
- return new SqlPredicateLike(likeLeft, likePattern, escapeChar);
- }
- return new SqlPredicateLike(likeLeft, likePattern);
- }
- case PREDICATE_LIKE_REGEXP: {
- SqlNode likeRegexpLeft = parseExpression(exp.getJsonObject("expression"));
- SqlNode likeRegexpPattern = parseExpression(exp.getJsonObject("pattern"));
- return new SqlPredicateLikeRegexp(likeRegexpLeft, likeRegexpPattern);
- }
- case PREDICATE_BETWEEN: {
- SqlNode betweenExp = parseExpression(exp.getJsonObject("expression"));
- SqlNode betweenLeft = parseExpression(exp.getJsonObject("left"));
- SqlNode betweenRight = parseExpression(exp.getJsonObject("right"));
- return new SqlPredicateBetween(betweenExp, betweenLeft, betweenRight);
- }
- case PREDICATE_IN_CONSTLIST: {
- SqlNode inExp = parseExpression(exp.getJsonObject("expression"));
- List inArguments = new ArrayList<>();
- for (JsonObject pred : exp.getJsonArray("arguments").getValuesAs(JsonObject.class)) {
- inArguments.add(parseExpression(pred));
- }
- return new SqlPredicateInConstList(inExp, inArguments);
- }
- case PREDICATE_IS_NULL: {
- SqlNode isnullExp = parseExpression(exp.getJsonObject("expression"));
- return new SqlPredicateIsNull(isnullExp);
- }
- case PREDICATE_IS_NOT_NULL: {
- SqlNode isNotnullExp = parseExpression(exp.getJsonObject("expression"));
- return new SqlPredicateIsNotNull(isNotnullExp);
- }
- case FUNCTION_SCALAR: {
- String functionName = exp.getString("name");
- boolean hasVariableInputArgs = false;
- int numArgs;
- if (exp.containsKey("variableInputArgs")) {
- hasVariableInputArgs = exp.getBoolean("variableInputArgs");
- }
- List arguments = new ArrayList<>();
- for (JsonObject argument : exp.getJsonArray("arguments").getValuesAs(JsonObject.class)) {
- arguments.add(parseExpression(argument));
- }
- if (!hasVariableInputArgs) {
- numArgs = exp.getInt("numArgs"); // this is the expected number of arguments for this scalar function
- assert (numArgs == arguments.size());
- }
- boolean isInfix = false;
- if (exp.containsKey("infix")) {
- isInfix = exp.getBoolean("infix");
- }
- boolean isPrefix = false;
- if (exp.containsKey("prefix")) {
- assert (!isPrefix);
- isPrefix = exp.getBoolean("prefix");
- }
- return new SqlFunctionScalar(fromScalarFunctionName(functionName), arguments, isInfix, isPrefix);
- }
- case FUNCTION_SCALAR_EXTRACT: {
- String toExtract = exp.getString("toExtract");
- List extractArguments = new ArrayList<>();
- if (exp.containsKey("arguments")) {
- for (JsonObject argument : exp.getJsonArray("arguments").getValuesAs(JsonObject.class)) {
- extractArguments.add(parseExpression(argument));
- }
- }
- return new SqlFunctionScalarExtract(toExtract, extractArguments);
- }
- case FUNCTION_SCALAR_CASE: {
- List caseArguments = new ArrayList<>();
- List caseResults = new ArrayList<>();
- SqlNode caseBasis = null;
- if (exp.containsKey("arguments")) {
- for (JsonObject argument : exp.getJsonArray("arguments").getValuesAs(JsonObject.class)) {
- caseArguments.add(parseExpression(argument));
- }
- }
- if (exp.containsKey("results")) {
- for (JsonObject argument : exp.getJsonArray("results").getValuesAs(JsonObject.class)) {
- caseResults.add(parseExpression(argument));
- }
- }
- if (exp.containsKey("basis")) {
- caseBasis = parseExpression(exp.getJsonObject("basis"));
- }
- return new SqlFunctionScalarCase(caseArguments, caseResults, caseBasis);
- }
- case FUNCTION_SCALAR_CAST: {
- DataType castDataType = getDataType(exp.getJsonObject("dataType"));
- List castArguments = new ArrayList<>();
- if (exp.containsKey("arguments")) {
- for (JsonObject argument : exp.getJsonArray("arguments").getValuesAs(JsonObject.class)) {
- castArguments.add(parseExpression(argument));
- }
- }
- return new SqlFunctionScalarCast(castDataType, castArguments);
- }
- case FUNCTION_AGGREGATE: {
- String setFunctionName = exp.getString("name");
- List setArguments = new ArrayList<>();
- boolean distinct = false;
- if (exp.containsKey("distinct")) {
- distinct = exp.getBoolean("distinct");
- }
- if (exp.containsKey("arguments")) {
- for (JsonObject argument : exp.getJsonArray("arguments").getValuesAs(JsonObject.class)) {
- setArguments.add(parseExpression(argument));
- }
- }
- return new SqlFunctionAggregate(fromAggregationFunctionName(setFunctionName), setArguments, distinct);
- }
- case FUNCTION_AGGREGATE_GROUP_CONCAT: {
- String functionName = exp.getString("name");
- List setArguments = new ArrayList<>();
- boolean distinct = false;
- if (exp.containsKey("distinct")) {
- distinct = exp.getBoolean("distinct");
- }
- if (exp.containsKey("arguments")) {
- for (JsonObject argument : exp.getJsonArray("arguments").getValuesAs(JsonObject.class)) {
- setArguments.add(parseExpression(argument));
- }
- }
- SqlOrderBy orderBy = null;
- if (exp.containsKey("orderBy")) {
- orderBy = parseOrderBy(exp.getJsonArray("orderBy"));
- }
- String separator = null;
- if (exp.containsKey("separator")) {
- separator = exp.getString("separator");
- }
- return new SqlFunctionAggregateGroupConcat(fromAggregationFunctionName(functionName),
- setArguments, orderBy, distinct, separator);
- }
- default:
- throw new RuntimeException("Unknown node type: " + typeName);
- }
- }
-
- /**
- * Mapping from join type name (as in json api) to enum
- */
- private static JoinType fromJoinTypeName(String typeName) {
- return Enum.valueOf(JoinType.class, typeName.toUpperCase());
- }
-
- /**
- * Mapping from scalar function name (as in json api) to enum
- */
- private static ScalarFunction fromScalarFunctionName(String functionName) {
- return Enum.valueOf(ScalarFunction.class, functionName.toUpperCase());
- }
-
- /**
- * Mapping from aggregate function name (as in json api) to enum
- */
- private static AggregateFunction fromAggregationFunctionName(String functionName) {
- return Enum.valueOf(AggregateFunction.class, functionName.toUpperCase());
- }
-
- /**
- * Mapping from type name (as in json api) to enum
- */
- private static SqlNodeType fromTypeName(String typeName) {
- return Enum.valueOf(SqlNodeType.class, typeName.toUpperCase());
- }
-
- private TableMetadata findInvolvedTableMetadata(String tableName) throws MetadataException {
- assert(involvedTablesMetadata != null);
- for (TableMetadata tableMetadata : involvedTablesMetadata) {
- if (tableMetadata.getName().equals(tableName)) {
- return tableMetadata;
- }
- }
- throw new MetadataException("Could not find table metadata for involved table " + tableName + ". All involved tables: " + involvedTablesMetadata.toString());
- }
-
- private ColumnMetadata findColumnMetadata(String tableName, String columnName) throws MetadataException {
- TableMetadata tableMetadata = findInvolvedTableMetadata(tableName);
- for (ColumnMetadata columnMetadata : tableMetadata.getColumns()) {
- if (columnMetadata.getName().equals(columnName)) {
- return columnMetadata;
- }
- }
- throw new MetadataException("Could not find column metadata for involved table " + tableName + " and column + " + columnName + ". All involved tables: " + involvedTablesMetadata.toString());
- }
-}
diff --git a/jdbc-adapter/virtualschema-common/src/main/java/com/exasol/adapter/json/ResponseJsonSerializer.java b/jdbc-adapter/virtualschema-common/src/main/java/com/exasol/adapter/json/ResponseJsonSerializer.java
deleted file mode 100644
index 7646a8636..000000000
--- a/jdbc-adapter/virtualschema-common/src/main/java/com/exasol/adapter/json/ResponseJsonSerializer.java
+++ /dev/null
@@ -1,90 +0,0 @@
-package com.exasol.adapter.json;
-
-import javax.json.Json;
-import javax.json.JsonArrayBuilder;
-import javax.json.JsonBuilderFactory;
-import javax.json.JsonObject;
-import javax.json.JsonObjectBuilder;
-
-import com.exasol.adapter.capabilities.*;
-import com.exasol.adapter.metadata.SchemaMetadata;
-import com.exasol.utils.JsonHelper;
-
-public class ResponseJsonSerializer {
-
- public static final String SCALAR_FUNCTION_PREFIX = "FN_";
- public static final String PREDICATE_PREFIX = "FN_PRED_";
- public static final String AGGREGATE_FUNCTION_PREFIX = "FN_AGG_";
- public static final String LITERAL_PREFIX = "LITERAL_";
-
- public static String makeCreateVirtualSchemaResponse(SchemaMetadata remoteMeta) {
- JsonObject res = Json.createObjectBuilder()
- .add("type", "createVirtualSchema")
- .add("schemaMetadata", SchemaMetadataSerializer.serialize(remoteMeta))
- .build();
- return res.toString();
- }
-
- public static String makeDropVirtualSchemaResponse() {
- JsonBuilderFactory factory = JsonHelper.getBuilderFactory();
- JsonObject res = factory.createObjectBuilder()
- .add("type", "dropVirtualSchema")
- .build();
- return res.toString();
- }
-
- public static String makeGetCapabilitiesResponse(Capabilities capabilities) {
- JsonBuilderFactory factory = JsonHelper.getBuilderFactory();
- JsonObjectBuilder builder = factory.createObjectBuilder()
- .add("type", "getCapabilities");
- JsonArrayBuilder arrayBuilder = factory.createArrayBuilder();
- for (MainCapability capability : capabilities.getMainCapabilities()) {
- String capName = capability.name();
- arrayBuilder.add(capName);
- }
- for (ScalarFunctionCapability function : capabilities.getScalarFunctionCapabilities()) {
- String capName = SCALAR_FUNCTION_PREFIX + function.name();
- arrayBuilder.add(capName);
- }
- for (PredicateCapability predicate : capabilities.getPredicateCapabilities()) {
- String capName = PREDICATE_PREFIX + predicate.name();
- arrayBuilder.add(capName);
- }
- for (AggregateFunctionCapability function : capabilities.getAggregateFunctionCapabilities()) {
- String capName = AGGREGATE_FUNCTION_PREFIX + function.name();
- arrayBuilder.add(capName);
- }
- for (LiteralCapability literal : capabilities.getLiteralCapabilities()) {
- String capName = LITERAL_PREFIX + literal.name();
- arrayBuilder.add(capName);
- }
- builder.add("capabilities", arrayBuilder);
- return builder.build().toString();
- }
-
- public static String makePushdownResponse(String pushdownSql) {
- JsonBuilderFactory factory = JsonHelper.getBuilderFactory();
- JsonObject res = factory.createObjectBuilder()
- .add("type", "pushdown")
- .add("sql", pushdownSql)
- .build();
- return res.toString();
- }
-
- public static String makeSetPropertiesResponse(SchemaMetadata remoteMeta) {
- JsonObjectBuilder builder = Json.createObjectBuilder();
- builder.add("type", "setProperties");
- if (remoteMeta != null) {
- builder.add("schemaMetadata", SchemaMetadataSerializer.serialize(remoteMeta));
- }
- return builder.build().toString();
- }
-
- public static String makeRefreshResponse(SchemaMetadata remoteMeta) {
- JsonObjectBuilder builder = Json.createObjectBuilder();
- builder.add("type", "refresh");
- builder.add("schemaMetadata", SchemaMetadataSerializer.serialize(remoteMeta));
- return builder.build().toString();
- }
-
-}
diff --git a/jdbc-adapter/virtualschema-common/src/main/java/com/exasol/adapter/json/SchemaMetadataSerializer.java b/jdbc-adapter/virtualschema-common/src/main/java/com/exasol/adapter/json/SchemaMetadataSerializer.java
deleted file mode 100644
index a6690f862..000000000
--- a/jdbc-adapter/virtualschema-common/src/main/java/com/exasol/adapter/json/SchemaMetadataSerializer.java
+++ /dev/null
@@ -1,61 +0,0 @@
-package com.exasol.adapter.json;
-
-import javax.json.Json;
-import javax.json.JsonArrayBuilder;
-import javax.json.JsonBuilderFactory;
-import javax.json.JsonObjectBuilder;
-
-import com.exasol.adapter.metadata.ColumnMetadata;
-import com.exasol.adapter.metadata.SchemaMetadata;
-import com.exasol.adapter.metadata.TableMetadata;
-import com.exasol.utils.JsonHelper;
-
-public class SchemaMetadataSerializer {
-
- public static JsonObjectBuilder serialize(SchemaMetadata schema) {
- JsonBuilderFactory factory = JsonHelper.getBuilderFactory();
- JsonObjectBuilder root = factory.createObjectBuilder();
- JsonArrayBuilder tablesBuilder = factory.createArrayBuilder();
- for (TableMetadata table : schema.getTables()) {
- tablesBuilder.add(serializeTableMetadata(table, factory.createObjectBuilder()));
- }
- root.add("tables", tablesBuilder);
- root.add("adapterNotes", schema.getAdapterNotes());
- return root;
- }
-
- private static JsonObjectBuilder serializeTableMetadata(TableMetadata table, JsonObjectBuilder tableBuilder) {
- tableBuilder.add("type", "table");
- tableBuilder.add("name", table.getName());
- JsonArrayBuilder columnsBuilder = Json.createArrayBuilder();
- for (ColumnMetadata column : table.getColumns()) {
- columnsBuilder.add(serializeColumnMetadata(column, Json.createObjectBuilder()));
- }
- tableBuilder.add("adapterNotes", table.getAdapterNotes());
- if (table.hasComment()) {
- tableBuilder.add("comment", table.getComment());
- }
- tableBuilder.add("columns", columnsBuilder);
- return tableBuilder;
- }
-
- private static JsonObjectBuilder serializeColumnMetadata(ColumnMetadata column, JsonObjectBuilder columnBuilder) {
- columnBuilder.add("name", column.getName());
- columnBuilder.add("adapterNotes", column.getAdapterNotes());
- columnBuilder.add("dataType", SqlDataTypeJsonSerializer.serialize(column.getType()));
- if (!column.isNullable()) {
- columnBuilder.add("isNullable", false);
- }
- if (column.isIdentity()) {
- columnBuilder.add("isIdentity", true);
- }
- if (column.hasDefault()) {
- columnBuilder.add("default", column.getDefaultValue());
- }
- if (column.hasComment()) {
- columnBuilder.add("comment", column.getComment());
- }
- return columnBuilder;
- }
-
-}
diff --git a/jdbc-adapter/virtualschema-common/src/main/java/com/exasol/adapter/json/SqlDataTypeJsonSerializer.java b/jdbc-adapter/virtualschema-common/src/main/java/com/exasol/adapter/json/SqlDataTypeJsonSerializer.java
deleted file mode 100644
index 1f8865f7b..000000000
--- a/jdbc-adapter/virtualschema-common/src/main/java/com/exasol/adapter/json/SqlDataTypeJsonSerializer.java
+++ /dev/null
@@ -1,107 +0,0 @@
-package com.exasol.adapter.json;
-
-import javax.json.Json;
-import javax.json.JsonObjectBuilder;
-
-import com.exasol.adapter.metadata.DataType;
-import com.exasol.adapter.metadata.DataType.ExaCharset;
-import com.exasol.adapter.metadata.DataType.ExaDataType;
-import com.exasol.adapter.metadata.DataType.IntervalType;
-
-public class SqlDataTypeJsonSerializer {
-
- public static JsonObjectBuilder serialize(DataType dataType) {
- JsonObjectBuilder root = Json.createObjectBuilder()
- .add("type", exaTypeAsString(dataType.getExaDataType()));
-
- switch (dataType.getExaDataType()) {
- case UNSUPPORTED:
- throw new RuntimeException("Unsupported Data Type, should never happen");
- case DECIMAL:
- root.add("precision", dataType.getPrecision());
- root.add("scale", dataType.getScale());
- break;
- case DOUBLE:
- break;
- case VARCHAR:
- root.add("size", dataType.getSize());
- root.add("characterSet", exaCharSetAsString(dataType.getCharset()));
- break;
- case CHAR:
- root.add("size", dataType.getSize());
- root.add("characterSet", exaCharSetAsString(dataType.getCharset()));
- break;
- case DATE:
- break;
- case TIMESTAMP:
- root.add("withLocalTimeZone", dataType.isWithLocalTimezone());
- break;
- case BOOLEAN:
- break;
- case GEOMETRY:
- root.add("srid", dataType.getGeometrySrid());
- break;
- case INTERVAL:
- root.add("fromTo", intervalTypeAsString(dataType.getIntervalType()));
- root.add("precision", dataType.getPrecision());
- if (dataType.getIntervalType() == IntervalType.DAY_TO_SECOND) {
- root.add("fraction", dataType.getIntervalFraction());
- }
- break;
- default:
- throw new RuntimeException("Unexpected Data Type: " + dataType.getExaDataType());
- }
-
- return root;
- }
-
- private static String exaTypeAsString(ExaDataType dataType) {
- switch (dataType) {
- case UNSUPPORTED:
- return "unsupported";
- case DECIMAL:
- return "decimal";
- case DOUBLE:
- return "double";
- case VARCHAR:
- return "varchar";
- case CHAR:
- return "char";
- case DATE:
- return "date";
- case TIMESTAMP:
- return "timestamp";
- case BOOLEAN:
- return "boolean";
- case GEOMETRY:
- return "geometry";
- case INTERVAL:
- return "interval";
- default:
- return "unknown";
- }
- }
-
- private static String exaCharSetAsString(ExaCharset charset) {
- switch (charset) {
- case UTF8:
- return "UTF8";
- case ASCII:
- return "ASCII";
- default:
- throw new RuntimeException("Unexpected Charset: " + charset);
- }
- }
-
- private static String intervalTypeAsString(IntervalType intervalType) {
- switch (intervalType) {
- case DAY_TO_SECOND:
- return "DAY TO SECONDS";
- case YEAR_TO_MONTH:
- return "YEAR TO MONTH";
- default:
- throw new RuntimeException("Unexpected IntervalType: " + intervalType);
- }
- }
-
-}
diff --git a/jdbc-adapter/virtualschema-common/src/main/java/com/exasol/adapter/metadata/ColumnMetadata.java b/jdbc-adapter/virtualschema-common/src/main/java/com/exasol/adapter/metadata/ColumnMetadata.java
deleted file mode 100644
index a79a47172..000000000
--- a/jdbc-adapter/virtualschema-common/src/main/java/com/exasol/adapter/metadata/ColumnMetadata.java
+++ /dev/null
@@ -1,64 +0,0 @@
-package com.exasol.adapter.metadata;
-
-
-/**
- * Represents the metadata of an EXASOL table column.
- */
-public class ColumnMetadata {
-
- private String name;
- private String adapterNotes;
- private DataType type;
- private boolean isNullable; // has a third state "unknown" in jdbc, which has to be mapped by the adapter to yes or no
- private boolean isIdentity; // auto increment in the sense of jdbc. However, jdbc has a third state ("empty", i.e. could not determine) which is mapped to false here.
- private String defaultValue; // special case: "NULL" means SQL's NULL.
- private String comment; // comes from "REMARKS" field in jdbc
- // Primary Keys?!?! => Index, Cardinality = num rows
-
- public ColumnMetadata(String name, String adapterNotes, DataType type, boolean nullable, boolean isIdentity, String defaultValue, String comment) {
- this.name = name;
- this.adapterNotes = adapterNotes;
- this.type = type;
- this.isNullable = nullable;
- this.isIdentity = isIdentity;
- this.defaultValue = defaultValue;
- this.comment = comment;
- }
-
- public String getName() {
- return name;
- }
-
- public String getAdapterNotes() {
- return adapterNotes;
- }
-
- public DataType getType() {
- return type;
- }
-
- public boolean isNullable() {
- return isNullable;
- }
-
- public boolean isIdentity() {
- return isIdentity;
- }
-
- public boolean hasDefault() {
- return !defaultValue.isEmpty();
- }
-
- public String getDefaultValue() {
- return defaultValue;
- }
-
- public boolean hasComment() {
- return !comment.isEmpty();
- }
-
- public String getComment() {
- return comment;
- }
-
-}
diff --git a/jdbc-adapter/virtualschema-common/src/main/java/com/exasol/adapter/metadata/DataType.java b/jdbc-adapter/virtualschema-common/src/main/java/com/exasol/adapter/metadata/DataType.java
deleted file mode 100644
index 529153744..000000000
--- a/jdbc-adapter/virtualschema-common/src/main/java/com/exasol/adapter/metadata/DataType.java
+++ /dev/null
@@ -1,227 +0,0 @@
-package com.exasol.adapter.metadata;
-
-
-/**
- * Represents an EXASOL datatype.
- */
-public class DataType {
-
- public static int maxExasolCharSize = 2000;
- public static int maxExasolVarcharSize = 2000000;
- public static int maxExasolDecimalPrecision = 36;
-
- private ExaDataType exaDataType;
- private int precision;
- private int scale;
- private int size;
- private ExaCharset charset;
- private boolean withLocalTimezone;
- private int geometrySrid;
- private IntervalType intervalType;
- private int intervalFraction;
-
- public enum ExaDataType {
- UNSUPPORTED,
- DECIMAL,
- DOUBLE,
- VARCHAR,
- CHAR,
- DATE,
- TIMESTAMP,
- BOOLEAN,
- GEOMETRY,
- INTERVAL
- }
-
- public enum ExaCharset {
- UTF8,
- ASCII
- }
-
- public enum IntervalType {
- DAY_TO_SECOND,
- YEAR_TO_MONTH
- }
-
- private DataType() {
- }
-
- public static DataType createVarChar(int size, ExaCharset charset) {
- DataType type = new DataType();
- type.exaDataType = ExaDataType.VARCHAR;
- type.size = size;
- type.charset = charset;
- return type;
- }
-
- public static DataType createChar(int size, ExaCharset charset) {
- DataType type = new DataType();
- type.exaDataType = ExaDataType.CHAR;
- type.size = size;
- type.charset = charset;
- return type;
- }
-
- public static DataType createDecimal(int precision, int scale) {
- DataType type = new DataType();
- type.exaDataType = ExaDataType.DECIMAL;
- type.precision = precision;
- type.scale = scale;
- return type;
- }
-
- public static DataType createDouble() {
- DataType type = new DataType();
- type.exaDataType = ExaDataType.DOUBLE;
- return type;
- }
-
- public static DataType createDate() {
- DataType type = new DataType();
- type.exaDataType = ExaDataType.DATE;
- return type;
- }
-
- public static DataType createTimestamp(boolean withLocalTimezone) {
- DataType type = new DataType();
- type.exaDataType = ExaDataType.TIMESTAMP;
- type.withLocalTimezone = withLocalTimezone;
- return type;
- }
-
- public static DataType createBool() {
- DataType type = new DataType();
- type.exaDataType = ExaDataType.BOOLEAN;
- return type;
- }
-
- public static DataType createGeometry(int srid) {
- DataType type = new DataType();
- type.exaDataType = ExaDataType.GEOMETRY;
- type.geometrySrid = srid;
- return type;
- }
-
- public static DataType createIntervalDaySecond(int precision, int fraction) {
- DataType type = new DataType();
- type.exaDataType = ExaDataType.INTERVAL;
- type.intervalType = IntervalType.DAY_TO_SECOND;
- type.precision = precision;
- type.intervalFraction = fraction;
- return type;
- }
-
- public static DataType createIntervalYearMonth(int precision) {
- DataType type = new DataType();
- type.exaDataType = ExaDataType.INTERVAL;
- type.intervalType = IntervalType.YEAR_TO_MONTH;
- type.precision = precision;
- return type;
- }
-
- public ExaDataType getExaDataType() {
- return exaDataType;
- }
-
- public int getPrecision() {
- return precision;
- }
-
- public int getScale() {
- return scale;
- }
-
- public int getSize() {
- return size;
- }
-
- public ExaCharset getCharset() {
- return charset;
- }
-
- public boolean isWithLocalTimezone() {
- return withLocalTimezone;
- }
-
- public int getGeometrySrid() {
- return geometrySrid;
- }
-
- public IntervalType getIntervalType() {
- return intervalType;
- }
-
- public int getIntervalFraction() {
- return intervalFraction;
- }
-
- @Override
- public String toString() {
- StringBuilder builder = new StringBuilder();
- switch (exaDataType) {
- case UNSUPPORTED:
- builder.append("UNSUPPORTED");
- break;
- case DECIMAL:
- builder.append("DECIMAL(");
- builder.append(precision);
- builder.append(", ");
- builder.append(scale);
- builder.append(")");
- break;
- case DOUBLE:
- builder.append("DOUBLE");
- break;
- case VARCHAR:
- builder.append("VARCHAR(");
- builder.append(size);
- builder.append(") ");
- builder.append(charset.toString());
- break;
- case CHAR:
- builder.append("CHAR(");
- builder.append(size);
- builder.append(") ");
- builder.append(charset.toString());
- break;
- case DATE:
- builder.append("DATE");
- break;
- case TIMESTAMP:
- builder.append("TIMESTAMP");
- if (withLocalTimezone) {
- builder.append(" WITH LOCAL TIME ZONE");
- }
- break;
- case BOOLEAN:
- builder.append("BOOLEAN");
- break;
- case GEOMETRY:
- builder.append("GEOMETRY");
- builder.append("(");
- builder.append(geometrySrid);
- builder.append(")");
- break;
- case INTERVAL:
- builder.append("INTERVAL ");
- if (intervalType == IntervalType.YEAR_TO_MONTH) {
- builder.append("YEAR");
- builder.append(" (");
- builder.append(precision);
- builder.append(")");
- builder.append(" TO MONTH");
- } else {
- builder.append("DAY");
- builder.append(" (");
- builder.append(precision);
- builder.append(")");
- builder.append(" TO SECOND");
- builder.append(" (");
- builder.append(intervalFraction);
- builder.append(")");
- }
- break;
- }
- return builder.toString();
- }
-}
diff --git a/jdbc-adapter/virtualschema-common/src/main/java/com/exasol/adapter/metadata/MetadataException.java b/jdbc-adapter/virtualschema-common/src/main/java/com/exasol/adapter/metadata/MetadataException.java
deleted file mode 100644
index 4531aaeec..000000000
--- a/jdbc-adapter/virtualschema-common/src/main/java/com/exasol/adapter/metadata/MetadataException.java
+++ /dev/null
@@ -1,10 +0,0 @@
-package com.exasol.adapter.metadata;
-
-import com.exasol.adapter.AdapterException;
-
-public class MetadataException extends AdapterException{
-
- public MetadataException(String message) {
- super(message);
- }
-}
diff --git a/jdbc-adapter/virtualschema-common/src/main/java/com/exasol/adapter/metadata/SchemaMetadata.java b/jdbc-adapter/virtualschema-common/src/main/java/com/exasol/adapter/metadata/SchemaMetadata.java
deleted file mode 100644
index 20e8b07e8..000000000
--- a/jdbc-adapter/virtualschema-common/src/main/java/com/exasol/adapter/metadata/SchemaMetadata.java
+++ /dev/null
@@ -1,28 +0,0 @@
-package com.exasol.adapter.metadata;
-
-import java.util.List;
-
-/**
- * Represents the metadata of an EXASOL Virtual Schema, including tables and columns.
- * These metadata are are returned by the Adapter when creating a virtual schema or
- * when the adapter updates the metadata (during refresh or set property).
- */
-public class SchemaMetadata {
-
- private String adapterNotes;
- private List tables;
-
- public SchemaMetadata(String adapterNotes, List tables) {
- this.adapterNotes = adapterNotes;
- this.tables = tables;
- }
-
- public String getAdapterNotes() {
- return adapterNotes;
- }
-
- public List getTables() {
- return tables;
- }
-
-}
diff --git a/jdbc-adapter/virtualschema-common/src/main/java/com/exasol/adapter/metadata/SchemaMetadataInfo.java b/jdbc-adapter/virtualschema-common/src/main/java/com/exasol/adapter/metadata/SchemaMetadataInfo.java
deleted file mode 100644
index a97dc47cc..000000000
--- a/jdbc-adapter/virtualschema-common/src/main/java/com/exasol/adapter/metadata/SchemaMetadataInfo.java
+++ /dev/null
@@ -1,47 +0,0 @@
-package com.exasol.adapter.metadata;
-
-import java.util.Map;
-
-import com.google.common.base.MoreObjects;
-
-/**
- * Represents the metadata of an EXASOL Virtual Schema which are sent with each request.
- * The metadata are just "for information" for the adapter. These metadata don't contain the table metadata.
- */
-public class SchemaMetadataInfo {
-
- private String schemaName;
- private String adapterNotes;
- private Map properties;
-
- public SchemaMetadataInfo(String schemaName, String adapterNotes, Map properties) {
- this.schemaName = schemaName;
- this.adapterNotes = adapterNotes;
- this.properties = properties;
- }
-
- @Override
- public String toString() {
- return MoreObjects.toStringHelper(this)
- .add("schemaName", schemaName)
- .add("adapterNotes", adapterNotes)
- .add("properties", properties)
- .toString();
- }
-
- public String getSchemaName() {
- return schemaName;
- }
-
- public String getAdapterNotes() {
- return adapterNotes;
- }
-
- /**
- * \note Keys are case-insensitive and stored upper case
- */
- public Map getProperties() {
- return properties;
- }
-
-}
diff --git a/jdbc-adapter/virtualschema-common/src/main/java/com/exasol/adapter/metadata/TableMetadata.java b/jdbc-adapter/virtualschema-common/src/main/java/com/exasol/adapter/metadata/TableMetadata.java
deleted file mode 100644
index 8b222e664..000000000
--- a/jdbc-adapter/virtualschema-common/src/main/java/com/exasol/adapter/metadata/TableMetadata.java
+++ /dev/null
@@ -1,58 +0,0 @@
-package com.exasol.adapter.metadata;
-
-import com.google.common.base.MoreObjects;
-
-import java.util.List;
-
-/**
- * Represents the metadata of an EXASOL table.
- */
-public class TableMetadata {
-
- private String name;
- private String adapterNotes;
- private List columns;
- private String comment;
-
- public TableMetadata(String name, String adapterNotes, List columns, String comment) throws MetadataException {
- this.name = name;
- this.adapterNotes = adapterNotes;
- this.columns = columns;
- this.comment = comment;
- if (this.columns.isEmpty()) {
- throw new MetadataException("A table without columns was encountered: " + this.name + ". This is not supported." +
- " Please check if this table has columns. If the table does have columns, the dialect probably does not properly handle the data types of the columns.");
- }
- }
-
- @Override
- public String toString() {
- return MoreObjects.toStringHelper(this)
- .add("name", name)
- .add("adapterNotes", adapterNotes)
- .add("columns", columns)
- .add("comment", comment)
- .toString();
- }
-
- public String getName() {
- return name;
- }
-
- public String getAdapterNotes() {
- return adapterNotes;
- }
-
- public List getColumns() {
- return columns;
- }
-
- public boolean hasComment() {
- return !comment.isEmpty();
- }
-
- public String getComment() {
- return comment;
- }
-
-}
diff --git a/jdbc-adapter/virtualschema-common/src/main/java/com/exasol/adapter/request/AdapterRequest.java b/jdbc-adapter/virtualschema-common/src/main/java/com/exasol/adapter/request/AdapterRequest.java
deleted file mode 100644
index 0fbffe36d..000000000
--- a/jdbc-adapter/virtualschema-common/src/main/java/com/exasol/adapter/request/AdapterRequest.java
+++ /dev/null
@@ -1,31 +0,0 @@
-package com.exasol.adapter.request;
-
-import com.exasol.adapter.metadata.SchemaMetadataInfo;
-
-public class AdapterRequest {
-
- public enum AdapterRequestType {
- CREATE_VIRTUAL_SCHEMA,
- DROP_VIRTUAL_SCHEMA,
- REFRESH,
- SET_PROPERTIES,
- GET_CAPABILITIES,
- PUSHDOWN
- }
-
- private SchemaMetadataInfo schemaMetadataInfo;
- private AdapterRequestType type;
-
- AdapterRequest(SchemaMetadataInfo schemaMetadataInfo, AdapterRequestType type) {
- this.schemaMetadataInfo = schemaMetadataInfo;
- this.type = type;
- }
-
- public SchemaMetadataInfo getSchemaMetadataInfo() {
- return schemaMetadataInfo;
- }
-
- public AdapterRequestType getType() {
- return type;
- }
-}
diff --git a/jdbc-adapter/virtualschema-common/src/main/java/com/exasol/adapter/request/CreateVirtualSchemaRequest.java b/jdbc-adapter/virtualschema-common/src/main/java/com/exasol/adapter/request/CreateVirtualSchemaRequest.java
deleted file mode 100644
index 2f9746596..000000000
--- a/jdbc-adapter/virtualschema-common/src/main/java/com/exasol/adapter/request/CreateVirtualSchemaRequest.java
+++ /dev/null
@@ -1,10 +0,0 @@
-package com.exasol.adapter.request;
-
-import com.exasol.adapter.metadata.SchemaMetadataInfo;
-
-public class CreateVirtualSchemaRequest extends AdapterRequest {
-
- public CreateVirtualSchemaRequest(SchemaMetadataInfo schemaMetadataInfo) {
- super(schemaMetadataInfo, AdapterRequestType.CREATE_VIRTUAL_SCHEMA);
- }
-}
diff --git a/jdbc-adapter/virtualschema-common/src/main/java/com/exasol/adapter/request/DropVirtualSchemaRequest.java b/jdbc-adapter/virtualschema-common/src/main/java/com/exasol/adapter/request/DropVirtualSchemaRequest.java
deleted file mode 100644
index 8edf202f6..000000000
--- a/jdbc-adapter/virtualschema-common/src/main/java/com/exasol/adapter/request/DropVirtualSchemaRequest.java
+++ /dev/null
@@ -1,10 +0,0 @@
-package com.exasol.adapter.request;
-
-import com.exasol.adapter.metadata.SchemaMetadataInfo;
-
-public class DropVirtualSchemaRequest extends AdapterRequest {
-
- public DropVirtualSchemaRequest(SchemaMetadataInfo schemaMetadataInfo) {
- super(schemaMetadataInfo, AdapterRequestType.DROP_VIRTUAL_SCHEMA);
- }
-}
diff --git a/jdbc-adapter/virtualschema-common/src/main/java/com/exasol/adapter/request/GetCapabilitiesRequest.java b/jdbc-adapter/virtualschema-common/src/main/java/com/exasol/adapter/request/GetCapabilitiesRequest.java
deleted file mode 100644
index a7f538614..000000000
--- a/jdbc-adapter/virtualschema-common/src/main/java/com/exasol/adapter/request/GetCapabilitiesRequest.java
+++ /dev/null
@@ -1,10 +0,0 @@
-package com.exasol.adapter.request;
-
-import com.exasol.adapter.metadata.SchemaMetadataInfo;
-
-public class GetCapabilitiesRequest extends AdapterRequest {
-
- public GetCapabilitiesRequest(SchemaMetadataInfo schemaMetadataInfo) {
- super(schemaMetadataInfo, AdapterRequestType.GET_CAPABILITIES);
- }
-}
diff --git a/jdbc-adapter/virtualschema-common/src/main/java/com/exasol/adapter/request/PushdownRequest.java b/jdbc-adapter/virtualschema-common/src/main/java/com/exasol/adapter/request/PushdownRequest.java
deleted file mode 100644
index f8fe781db..000000000
--- a/jdbc-adapter/virtualschema-common/src/main/java/com/exasol/adapter/request/PushdownRequest.java
+++ /dev/null
@@ -1,27 +0,0 @@
-package com.exasol.adapter.request;
-
-import java.util.List;
-
-import com.exasol.adapter.metadata.SchemaMetadataInfo;
-import com.exasol.adapter.metadata.TableMetadata;
-import com.exasol.adapter.sql.SqlStatement;
-
-public class PushdownRequest extends AdapterRequest {
-
- private SqlStatement select;
- private List involvedTablesMetadata;
-
- public PushdownRequest(SchemaMetadataInfo schemaMetadataInfo, SqlStatement select, List involvedTablesMetadata) {
- super(schemaMetadataInfo, AdapterRequestType.PUSHDOWN);
- this.select = select;
- this.involvedTablesMetadata = involvedTablesMetadata;
- }
-
- public SqlStatement getSelect() {
- return select;
- }
-
- public List getInvolvedTablesMetadata() {
- return involvedTablesMetadata;
- }
-}
diff --git a/jdbc-adapter/virtualschema-common/src/main/java/com/exasol/adapter/request/RefreshRequest.java b/jdbc-adapter/virtualschema-common/src/main/java/com/exasol/adapter/request/RefreshRequest.java
deleted file mode 100644
index 1b57a7219..000000000
--- a/jdbc-adapter/virtualschema-common/src/main/java/com/exasol/adapter/request/RefreshRequest.java
+++ /dev/null
@@ -1,32 +0,0 @@
-package com.exasol.adapter.request;
-
-import java.util.List;
-
-import com.exasol.adapter.metadata.SchemaMetadataInfo;
-
-public class RefreshRequest extends AdapterRequest {
-
- private boolean isRefreshForTables;
- private List tables;
-
- public RefreshRequest(SchemaMetadataInfo schemaMetadataInfo) {
- super(schemaMetadataInfo, AdapterRequestType.REFRESH);
- isRefreshForTables = false;
- }
-
- public RefreshRequest(SchemaMetadataInfo schemaMetadataInfo, List tables) {
- super(schemaMetadataInfo, AdapterRequestType.REFRESH);
- assert(tables != null && !tables.isEmpty());
- isRefreshForTables = true;
- this.tables = tables;
- }
-
- public List getTables() {
- return tables;
- }
-
- public boolean isRefreshForTables() {
- return isRefreshForTables;
- }
-
-}
diff --git a/jdbc-adapter/virtualschema-common/src/main/java/com/exasol/adapter/request/SetPropertiesRequest.java b/jdbc-adapter/virtualschema-common/src/main/java/com/exasol/adapter/request/SetPropertiesRequest.java
deleted file mode 100644
index 26ad513ad..000000000
--- a/jdbc-adapter/virtualschema-common/src/main/java/com/exasol/adapter/request/SetPropertiesRequest.java
+++ /dev/null
@@ -1,19 +0,0 @@
-package com.exasol.adapter.request;
-
-import java.util.Map;
-
-import com.exasol.adapter.metadata.SchemaMetadataInfo;
-
-public class SetPropertiesRequest extends AdapterRequest {
-
- private Map properties;
-
- public SetPropertiesRequest(SchemaMetadataInfo schemaMetadataInfo, Map properties) {
- super(schemaMetadataInfo, AdapterRequestType.SET_PROPERTIES);
- this.properties = properties;
- }
-
- public Map getProperties() {
- return properties;
- }
-}
diff --git a/jdbc-adapter/virtualschema-common/src/main/java/com/exasol/adapter/sql/AggregateFunction.java b/jdbc-adapter/virtualschema-common/src/main/java/com/exasol/adapter/sql/AggregateFunction.java
deleted file mode 100644
index 5313db911..000000000
--- a/jdbc-adapter/virtualschema-common/src/main/java/com/exasol/adapter/sql/AggregateFunction.java
+++ /dev/null
@@ -1,50 +0,0 @@
-package com.exasol.adapter.sql;
-
-/**
- * List of all aggregation functions supported by EXASOL
- */
-public enum AggregateFunction {
- COUNT,
- SUM,
- MIN,
- MAX,
- AVG,
-
- MEDIAN,
-
- FIRST_VALUE,
- LAST_VALUE,
-
- STDDEV,
- STDDEV_POP,
- STDDEV_SAMP,
-
- VARIANCE,
- VAR_POP,
- VAR_SAMP,
-
- GROUP_CONCAT(false),
-
- APPROXIMATE_COUNT_DISTINCT,
-
- GEO_INTERSECTION_AGGREGATE,
- GEO_UNION_AGGREGATE;
-
- private boolean isSimple;
-
- /**
- * True if the function is simple, i.e. is handled by {@link SqlFunctionAggregate}, and false if it has it's own implementation.
- */
- public boolean isSimple() {
- return isSimple;
- }
-
- AggregateFunction() {
- this.isSimple = true;
- }
-
- AggregateFunction(boolean isSimple) {
- this.isSimple = isSimple;
- }
-
-}
diff --git a/jdbc-adapter/virtualschema-common/src/main/java/com/exasol/adapter/sql/JoinType.java b/jdbc-adapter/virtualschema-common/src/main/java/com/exasol/adapter/sql/JoinType.java
deleted file mode 100644
index 3ddd5106a..000000000
--- a/jdbc-adapter/virtualschema-common/src/main/java/com/exasol/adapter/sql/JoinType.java
+++ /dev/null
@@ -1,11 +0,0 @@
-package com.exasol.adapter.sql;
-
-/**
- * List of all join types supported by EXASOL.
- */
-public enum JoinType {
- INNER,
- LEFT_OUTER,
- RIGHT_OUTER,
- FULL_OUTER
-}
\ No newline at end of file
diff --git a/jdbc-adapter/virtualschema-common/src/main/java/com/exasol/adapter/sql/Predicate.java b/jdbc-adapter/virtualschema-common/src/main/java/com/exasol/adapter/sql/Predicate.java
deleted file mode 100644
index 0087d9304..000000000
--- a/jdbc-adapter/virtualschema-common/src/main/java/com/exasol/adapter/sql/Predicate.java
+++ /dev/null
@@ -1,20 +0,0 @@
-package com.exasol.adapter.sql;
-
-/**
- * List of all predicates (scalar functions returning bool) supported by EXASOL.
- */
-public enum Predicate {
- AND,
- OR,
- NOT,
- EQUAL,
- NOTEQUAL,
- LESS,
- LESSEQUAL,
- LIKE,
- REGEXP_LIKE,
- BETWEEN,
- IN_CONSTLIST,
- IS_NULL,
- IS_NOT_NULL
-}
diff --git a/jdbc-adapter/virtualschema-common/src/main/java/com/exasol/adapter/sql/ScalarFunction.java b/jdbc-adapter/virtualschema-common/src/main/java/com/exasol/adapter/sql/ScalarFunction.java
deleted file mode 100644
index 4c905ddff..000000000
--- a/jdbc-adapter/virtualschema-common/src/main/java/com/exasol/adapter/sql/ScalarFunction.java
+++ /dev/null
@@ -1,212 +0,0 @@
-package com.exasol.adapter.sql;
-
-/**
- * List of all scalar functions supported by EXASOL. Note that predicates are defined separately in {@link Predicate}.
- */
-public enum ScalarFunction {
-
- // Standard Arithmetic Operators
- ADD,
- SUB,
- MULT,
- FLOAT_DIV,
-
- // Unary prefix operators
- NEG,
-
- // Numeric
- ABS,
- ACOS,
- ASIN,
- ATAN,
- ATAN2,
- CEIL,
- COS,
- COSH,
- COT,
- DEGREES,
- DIV,
- EXP,
- FLOOR,
- GREATEST,
- LEAST,
- LN,
- LOG,
- MOD,
- POWER,
- RADIANS,
- RAND,
- ROUND,
- SIGN,
- SIN,
- SINH,
- SQRT,
- TAN,
- TANH,
- TRUNC,
-
- // String Functions
- ASCII,
- BIT_LENGTH,
- CHR,
- COLOGNE_PHONETIC,
- CONCAT,
- DUMP,
- EDIT_DISTANCE,
- INSERT,
- INSTR,
- LENGTH,
- LOCATE,
- LOWER,
- LPAD,
- LTRIM,
- OCTET_LENGTH,
- REGEXP_INSTR,
- REGEXP_REPLACE,
- REGEXP_SUBSTR,
- REPEAT,
- REPLACE,
- REVERSE,
- RIGHT,
- RPAD,
- RTRIM,
- SOUNDEX,
- SPACE,
- SUBSTR,
- TRANSLATE,
- TRIM,
- UNICODE,
- UNICODECHR,
- UPPER,
-
- // Date/Time Functions
- ADD_DAYS,
- ADD_HOURS,
- ADD_MINUTES,
- ADD_MONTHS,
- ADD_SECONDS,
- ADD_WEEKS,
- ADD_YEARS,
- CONVERT_TZ,
- CURRENT_DATE,
- CURRENT_TIMESTAMP,
- DATE_TRUNC,
- DAY,
- DAYS_BETWEEN,
- DBTIMEZONE,
- EXTRACT(false),
- HOURS_BETWEEN,
- LOCALTIMESTAMP,
- MINUTE,
- MINUTES_BETWEEN,
- MONTH,
- MONTHS_BETWEEN,
- NUMTODSINTERVAL,
- NUMTOYMINTERVAL,
- POSIX_TIME,
- SECOND,
- SECONDS_BETWEEN,
- SESSIONTIMEZONE,
- SYSDATE,
- SYSTIMESTAMP,
- WEEK,
- YEAR,
- YEARS_BETWEEN,
-
- // Geospatial
- ST_X,
- ST_Y,
- ST_ENDPOINT,
- ST_ISCLOSED,
- ST_ISRING,
- ST_LENGTH,
- ST_NUMPOINTS,
- ST_POINTN,
- ST_STARTPOINT,
- ST_AREA,
- ST_EXTERIORRING,
- ST_INTERIORRINGN,
- ST_NUMINTERIORRINGS,
- ST_GEOMETRYN,
- ST_NUMGEOMETRIES,
- ST_BOUNDARY,
- ST_BUFFER,
- ST_CENTROID,
- ST_CONTAINS,
- ST_CONVEXHULL,
- ST_CROSSES,
- ST_DIFFERENCE,
- ST_DIMENSION,
- ST_DISJOINT,
- ST_DISTANCE,
- ST_ENVELOPE,
- ST_EQUALS,
- ST_FORCE2D,
- ST_GEOMETRYTYPE,
- ST_INTERSECTION,
- ST_INTERSECTS,
- ST_ISEMPTY,
- ST_ISSIMPLE,
- ST_OVERLAPS,
- ST_SETSRID,
- ST_SYMDIFFERENCE,
- ST_TOUCHES,
- ST_TRANSFORM,
- ST_UNION,
- ST_WITHIN,
-
- // Conversion functions
- CAST(false),
- IS_NUMBER,
- IS_BOOLEAN,
- IS_DATE,
- IS_DSINTERVAL,
- IS_YMINTERVAL,
- IS_TIMESTAMP,
- TO_CHAR,
- TO_DATE,
- TO_DSINTERVAL,
- TO_YMINTERVAL,
- TO_NUMBER,
- TO_TIMESTAMP,
-
- // Bitwise functions
- BIT_AND,
- BIT_CHECK,
- BIT_NOT,
- BIT_OR,
- BIT_SET,
- BIT_TO_NUM,
- BIT_XOR,
-
- // Other Functions
- CASE(false),
- CURRENT_SCHEMA,
- CURRENT_SESSION,
- CURRENT_STATEMENT,
- CURRENT_USER,
- HASH_MD5,
- HASH_SHA,
- HASH_SHA1,
- HASH_TIGER,
- NULLIFZERO,
- SYS_GUID,
- ZEROIFNULL;
-
- private boolean isSimple;
-
- /**
- * True if the function is simple, i.e. is handled by {@link SqlFunctionScalar}, and false if it has it's own implementation.
- */
- public boolean isSimple() {
- return isSimple;
- }
-
- ScalarFunction() {
- this.isSimple = true;
- }
-
- ScalarFunction(boolean isSimple) {
- this.isSimple = isSimple;
- }
-}
diff --git a/jdbc-adapter/virtualschema-common/src/main/java/com/exasol/adapter/sql/SqlColumn.java b/jdbc-adapter/virtualschema-common/src/main/java/com/exasol/adapter/sql/SqlColumn.java
deleted file mode 100644
index aacafbc6a..000000000
--- a/jdbc-adapter/virtualschema-common/src/main/java/com/exasol/adapter/sql/SqlColumn.java
+++ /dev/null
@@ -1,54 +0,0 @@
-package com.exasol.adapter.sql;
-
-import com.exasol.adapter.AdapterException;
-import com.exasol.adapter.metadata.ColumnMetadata;
-
-public class SqlColumn extends SqlNode {
-
- private int id;
- private ColumnMetadata metadata;
- private String tableName;
-
- public SqlColumn(int id, ColumnMetadata metadata) {
- this.id = id;
- this.metadata = metadata;
- }
-
- public SqlColumn(int id, ColumnMetadata metadata, String tableName) {
- this.id = id;
- this.metadata = metadata;
- this.tableName = tableName;
- }
-
- public int getId() {
- return id;
- }
-
- public ColumnMetadata getMetadata() {
- return metadata;
- }
-
- public String getName() {
- return metadata.getName();
- }
-
- public String getTableName() {
- return tableName;
- }
-
- @Override
- public String toSimpleSql() {
- return "\"" + metadata.getName().replace("\"", "\"\"") + "\"";
- }
-
- @Override
- public SqlNodeType getType() {
- return SqlNodeType.COLUMN;
- }
-
- @Override
- public R accept(SqlNodeVisitor visitor) throws AdapterException {
- return visitor.visit(this);
- }
-
-}
diff --git a/jdbc-adapter/virtualschema-common/src/main/java/com/exasol/adapter/sql/SqlExpressionList.java b/jdbc-adapter/virtualschema-common/src/main/java/com/exasol/adapter/sql/SqlExpressionList.java
deleted file mode 100644
index c12ebecfc..000000000
--- a/jdbc-adapter/virtualschema-common/src/main/java/com/exasol/adapter/sql/SqlExpressionList.java
+++ /dev/null
@@ -1,27 +0,0 @@
-package com.exasol.adapter.sql;
-
-import java.util.Collections;
-import java.util.List;
-
-public abstract class SqlExpressionList extends SqlNode {
-
- private List expressions;
-
- public SqlExpressionList(List expressions) {
- this.expressions = expressions;
- if (this.expressions != null) {
- for (SqlNode node : this.expressions) {
- node.setParent(this);
- }
- }
- }
-
- public List getExpressions() {
- if (expressions == null) {
- return null;
- } else {
- return Collections.unmodifiableList(expressions);
- }
- }
-
-}
diff --git a/jdbc-adapter/virtualschema-common/src/main/java/com/exasol/adapter/sql/SqlFunctionAggregate.java b/jdbc-adapter/virtualschema-common/src/main/java/com/exasol/adapter/sql/SqlFunctionAggregate.java
deleted file mode 100644
index bb7a04931..000000000
--- a/jdbc-adapter/virtualschema-common/src/main/java/com/exasol/adapter/sql/SqlFunctionAggregate.java
+++ /dev/null
@@ -1,81 +0,0 @@
-package com.exasol.adapter.sql;
-
-import com.exasol.adapter.AdapterException;
-import com.google.common.base.Joiner;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-
-/**
- * A simple aggregate function with a name and zero or more arguments. Distinct is also allowed.
- *
- * Aggregate functions that are more complex, like GroupConcat, are defined in separate classes.
- *
- */
-public class SqlFunctionAggregate extends SqlNode {
-
- private AggregateFunction function;
- private boolean distinct;
- private List arguments;
-
- public SqlFunctionAggregate(AggregateFunction function, List arguments, boolean distinct) {
- this.arguments = arguments;
- this.function = function;
- this.distinct = distinct;
- if (this.arguments != null) {
- for (SqlNode node : this.arguments) {
- node.setParent(this);
- }
- }
- }
-
- public List getArguments() {
- if (arguments == null) {
- return null;
- } else {
- return Collections.unmodifiableList(arguments);
- }
- }
-
-
- public AggregateFunction getFunction() {
- return function;
- }
-
- public String getFunctionName() {
- return function.name();
- }
-
- public boolean hasDistinct() {
- return distinct;
- }
-
- @Override
- public String toSimpleSql() {
- List argumentsSql = new ArrayList<>();
- for (SqlNode node : arguments) {
- argumentsSql.add(node.toSimpleSql());
- }
- if (argumentsSql.size() == 0) {
- assert(getFunctionName().equalsIgnoreCase("count"));
- argumentsSql.add("*");
- }
- String distinctSql = "";
- if (distinct) {
- distinctSql = "DISTINCT ";
- }
- return getFunctionName() + "(" + distinctSql + Joiner.on(", ").join(argumentsSql) + ")";
- }
-
- @Override
- public SqlNodeType getType() {
- return SqlNodeType.FUNCTION_AGGREGATE;
- }
-
- @Override
- public R accept(SqlNodeVisitor visitor) throws AdapterException {
- return visitor.visit(this);
- }
-
-}
diff --git a/jdbc-adapter/virtualschema-common/src/main/java/com/exasol/adapter/sql/SqlFunctionAggregateGroupConcat.java b/jdbc-adapter/virtualschema-common/src/main/java/com/exasol/adapter/sql/SqlFunctionAggregateGroupConcat.java
deleted file mode 100644
index 576a3e4d1..000000000
--- a/jdbc-adapter/virtualschema-common/src/main/java/com/exasol/adapter/sql/SqlFunctionAggregateGroupConcat.java
+++ /dev/null
@@ -1,108 +0,0 @@
-package com.exasol.adapter.sql;
-
-import com.exasol.adapter.AdapterException;
-
-import java.util.Collections;
-import java.util.List;
-
-
-public class SqlFunctionAggregateGroupConcat extends SqlNode {
-
- private AggregateFunction function;
- private boolean distinct;
- private List arguments;
- private String separator;
- private SqlOrderBy orderBy;
-
-
-
- public SqlFunctionAggregateGroupConcat(AggregateFunction function, List arguments,
- SqlOrderBy orderBy, boolean distinct,
- String separator) {
- assert(arguments != null); // currently the adapter supports only one expression as argument
- assert(arguments.size() == 1 && arguments.get(0) != null);
- this.function = function;
- this.distinct = distinct;
- this.arguments = arguments;
- this.orderBy = orderBy;
- this.separator = separator;
- if (this.arguments != null) {
- for (SqlNode node : this.arguments) {
- node.setParent(this);
- }
- }
- if (orderBy != null) {
- orderBy.setParent(this);
- }
- }
-
- public AggregateFunction getFunction() {
- return function;
- }
-
- public List getArguments() {
- if (arguments == null) {
- return null;
- } else {
- return Collections.unmodifiableList(arguments);
- }
- }
-
- public boolean hasOrderBy() {
- return orderBy != null && orderBy.getExpressions() != null && orderBy.getExpressions().size() > 0;
- }
-
- public SqlOrderBy getOrderBy() {
- return orderBy;
- }
-
- public String getFunctionName() {
- return function.name();
- }
-
- public String getSeparator() {
- return separator;
- }
-
- public boolean hasDistinct() {
- return distinct;
- }
-
- @Override
- public String toSimpleSql() {
- String distinctSql = "";
- if (distinct) {
- distinctSql = "DISTINCT ";
- }
- StringBuilder builder = new StringBuilder();
- builder.append(getFunctionName());
- builder.append("(");
- builder.append(distinctSql);
- assert(arguments != null);
- assert(arguments.size() == 1 && arguments.get(0) != null);
- builder.append(arguments.get(0).toSimpleSql());
- if (orderBy != null) {
- builder.append(" ");
- builder.append(orderBy.toSimpleSql());
- }
- if (separator != null) {
- builder.append(" SEPARATOR ");
- builder.append("'");
- builder.append(separator);
- builder.append("'");
- }
- builder.append(")");
- return builder.toString();
- }
-
- @Override
- public SqlNodeType getType() {
- return SqlNodeType.FUNCTION_AGGREGATE;
- }
-
- @Override
- public R accept(SqlNodeVisitor visitor) throws AdapterException {
- return visitor.visit(this);
- }
-
-}
diff --git a/jdbc-adapter/virtualschema-common/src/main/java/com/exasol/adapter/sql/SqlFunctionScalar.java b/jdbc-adapter/virtualschema-common/src/main/java/com/exasol/adapter/sql/SqlFunctionScalar.java
deleted file mode 100644
index 9faf8f586..000000000
--- a/jdbc-adapter/virtualschema-common/src/main/java/com/exasol/adapter/sql/SqlFunctionScalar.java
+++ /dev/null
@@ -1,103 +0,0 @@
-package com.exasol.adapter.sql;
-
-import com.exasol.adapter.AdapterException;
-import com.google.common.base.Joiner;
-
-import java.util.*;
-
-/**
- * A simple scalar function with a name and zero or more arguments.
- *
- * Scalar functions that are more complex, like CASE or CAST, are defined in separate classes.
- *
- */
-public class SqlFunctionScalar extends SqlNode {
-
- private List arguments;
- private ScalarFunction function;
- private boolean isInfix;
- private boolean isPrefix;
-
- public SqlFunctionScalar(ScalarFunction function, List arguments, boolean isInfix, boolean isPrefix) {
- this.arguments = arguments;
- this.function = function;
- this.isInfix = isInfix;
- this.isPrefix = isPrefix;
- if (this.arguments != null) {
- for (SqlNode node : this.arguments) {
- node.setParent(this);
- }
- }
- }
-
- public List getArguments() {
- if (arguments == null) {
- return null;
- } else {
- return Collections.unmodifiableList(arguments);
- }
- }
-
- public ScalarFunction getFunction() {
- return function;
- }
-
- public String getFunctionName() {
- return function.name();
- }
-
- public int getNumArgs() {
- return getArguments().size();
- }
-
- public boolean isInfix() {
- return isInfix;
- }
-
- public boolean isPrefix() {
- return isPrefix;
- }
-
-
- @Override
- public String toSimpleSql() {
- List argumentsSql = new ArrayList<>();
- for (SqlNode node : arguments) {
- argumentsSql.add(node.toSimpleSql());
- }
- if (isInfix) {
- assert(argumentsSql.size()==2);
- Map functionAliases = new HashMap();
- functionAliases.put("ADD", "+");
- functionAliases.put("SUB", "-");
- functionAliases.put("MULT", "*");
- functionAliases.put("FLOAT_DIV", "/");
- String realFunctionName = getFunctionName();
- if (functionAliases.containsKey(getFunctionName())) {
- realFunctionName = functionAliases.get(getFunctionName());
- }
- return "(" + argumentsSql.get(0) + " " + realFunctionName + " " + argumentsSql.get(1) + ")";
- } else if (isPrefix) {
- assert(argumentsSql.size()==1);
- Map functionAliases = new HashMap();
- functionAliases.put("NEG", "-");
- String realFunctionName = getFunctionName();
- if (functionAliases.containsKey(getFunctionName())) {
- realFunctionName = functionAliases.get(getFunctionName());
- }
- return "(" + realFunctionName + argumentsSql.get(1) + ")";
- }
- return getFunctionName() + "(" + Joiner.on(", ").join(argumentsSql) + ")";
- }
-
- @Override
- public SqlNodeType getType() {
- return SqlNodeType.FUNCTION_SCALAR;
- }
-
- @Override
- public R accept(SqlNodeVisitor visitor) throws AdapterException {
- return visitor.visit(this);
- }
-
-}
diff --git a/jdbc-adapter/virtualschema-common/src/main/java/com/exasol/adapter/sql/SqlFunctionScalarCase.java b/jdbc-adapter/virtualschema-common/src/main/java/com/exasol/adapter/sql/SqlFunctionScalarCase.java
deleted file mode 100644
index 524a2d750..000000000
--- a/jdbc-adapter/virtualschema-common/src/main/java/com/exasol/adapter/sql/SqlFunctionScalarCase.java
+++ /dev/null
@@ -1,75 +0,0 @@
-package com.exasol.adapter.sql;
-
-
-import com.exasol.adapter.AdapterException;
-
-import java.util.Collections;
-import java.util.List;
-
-public class SqlFunctionScalarCase extends SqlNode {
- private List arguments;
- private List results;
- private SqlNode basis;
-
- public SqlFunctionScalarCase(List arguments, List results, SqlNode basis) {
- this.arguments = arguments;
- this.results = results;
- this.basis = basis;
- if (this.arguments != null) {
- for (SqlNode node : this.arguments) {
- node.setParent(this);
- }
- }
- if (this.results != null) {
- for (SqlNode node : this.results) {
- node.setParent(this);
- }
- }
- if (basis != null) {
- basis.setParent(this);
- }
- }
-
- public List getArguments() {
- if (arguments == null) {
- return null;
- } else {
- return Collections.unmodifiableList(arguments);
- }
- }
-
- public List getResults() {
- if (results == null) {
- return null;
- } else {
- return Collections.unmodifiableList(results);
- }
- }
-
- public SqlNode getBasis() {
- return basis;
- }
-
- @Override
- public String toSimpleSql() {
- return "CASE";
- }
-
- @Override
- public SqlNodeType getType() {
- return SqlNodeType.FUNCTION_SCALAR_CASE;
- }
-
- @Override
- public R accept(SqlNodeVisitor visitor) throws AdapterException {
- return visitor.visit(this);
- }
-
- public String getFunctionName() {
- return "CASE";
- }
-
- public ScalarFunction getFunction() {
- return ScalarFunction.CASE;
- }
-}
diff --git a/jdbc-adapter/virtualschema-common/src/main/java/com/exasol/adapter/sql/SqlFunctionScalarCast.java b/jdbc-adapter/virtualschema-common/src/main/java/com/exasol/adapter/sql/SqlFunctionScalarCast.java
deleted file mode 100644
index 0aaf23580..000000000
--- a/jdbc-adapter/virtualschema-common/src/main/java/com/exasol/adapter/sql/SqlFunctionScalarCast.java
+++ /dev/null
@@ -1,63 +0,0 @@
-package com.exasol.adapter.sql;
-
-import com.exasol.adapter.AdapterException;
-import com.exasol.adapter.metadata.DataType;
-
-import java.util.Collections;
-import java.util.List;
-
-public class SqlFunctionScalarCast extends SqlNode {
- private DataType dataType;
- private List arguments;
-
- public SqlFunctionScalarCast(DataType dataType, List arguments) {
- assert(arguments != null);
- assert(arguments.size() == 1 && arguments.get(0) != null);
- this.arguments = arguments;
- this.dataType = dataType;
- if (this.arguments != null) {
- for (SqlNode node : this.arguments) {
- node.setParent(this);
- }
- }
- }
-
- public DataType getDataType() {
- return dataType;
- }
-
-
- public List getArguments() {
- if (arguments == null) {
- return null;
- } else {
- return Collections.unmodifiableList(arguments);
- }
- }
-
- @Override
- public String toSimpleSql() {
- assert(arguments != null);
- assert(arguments.size() == 1 && arguments.get(0) != null);
- return "CAST (" + arguments.get(0).toSimpleSql() + " AS " + getDataType().toString() + ")";
- }
-
- @Override
- public SqlNodeType getType() {
- return SqlNodeType.FUNCTION_SCALAR_CAST;
- }
-
- @Override
- public R accept(SqlNodeVisitor visitor) throws AdapterException {
- return visitor.visit(this);
- }
-
- public String getFunctionName() {
- return "CAST";
- }
-
- public ScalarFunction getFunction() {
- return ScalarFunction.CAST;
- }
-
-}
diff --git a/jdbc-adapter/virtualschema-common/src/main/java/com/exasol/adapter/sql/SqlFunctionScalarExtract.java b/jdbc-adapter/virtualschema-common/src/main/java/com/exasol/adapter/sql/SqlFunctionScalarExtract.java
deleted file mode 100644
index 9dcc53b3b..000000000
--- a/jdbc-adapter/virtualschema-common/src/main/java/com/exasol/adapter/sql/SqlFunctionScalarExtract.java
+++ /dev/null
@@ -1,60 +0,0 @@
-package com.exasol.adapter.sql;
-
-import com.exasol.adapter.AdapterException;
-
-import java.util.Collections;
-import java.util.List;
-
-public class SqlFunctionScalarExtract extends SqlNode {
- private String toExtract;
- private List arguments;
-
- public SqlFunctionScalarExtract(String toExtract, List arguments) {
- assert(arguments.size() == 1);
- this.arguments = arguments;
- this.toExtract = toExtract;
- if (this.arguments != null) {
- for (SqlNode node : this.arguments) {
- node.setParent(this);
- }
- }
- }
-
- public String getToExtract() {
- return toExtract;
- }
-
-
- public List getArguments() {
- if (arguments == null) {
- return null;
- } else {
- return Collections.unmodifiableList(arguments);
- }
- }
-
- @Override
- public String toSimpleSql() {
- assert(arguments.size() == 1 && arguments.get(0) != null);
- return "EXTRACT (" + toExtract + " FROM " + arguments.get(0).toSimpleSql() + ")";
- }
-
- @Override
- public SqlNodeType getType() {
- return SqlNodeType.FUNCTION_SCALAR_EXTRACT;
- }
-
- @Override
- public R accept(SqlNodeVisitor visitor) throws AdapterException {
- return visitor.visit(this);
- }
-
- public String getFunctionName() {
- return "EXTRACT";
- }
-
- public ScalarFunction getFunction() {
- return ScalarFunction.EXTRACT;
- }
-
-}
diff --git a/jdbc-adapter/virtualschema-common/src/main/java/com/exasol/adapter/sql/SqlGroupBy.java b/jdbc-adapter/virtualschema-common/src/main/java/com/exasol/adapter/sql/SqlGroupBy.java
deleted file mode 100644
index 3df72808c..000000000
--- a/jdbc-adapter/virtualschema-common/src/main/java/com/exasol/adapter/sql/SqlGroupBy.java
+++ /dev/null
@@ -1,42 +0,0 @@
-package com.exasol.adapter.sql;
-
-import com.exasol.adapter.AdapterException;
-import com.google.common.base.Joiner;
-
-import java.util.ArrayList;
-import java.util.List;
-
-public class SqlGroupBy extends SqlExpressionList {
-
- public SqlGroupBy(List groupByList) {
- super(groupByList);
- if (this.getExpressions() != null) {
- for (SqlNode node : this.getExpressions()) {
- node.setParent(this);
- }
- }
- }
-
- @Override
- public SqlNodeType getType() {
- return SqlNodeType.GROUP_BY;
- }
-
- @Override
- public String toSimpleSql() {
- if (getExpressions().isEmpty()) {
- return "*";
- }
- List selectElement = new ArrayList<>();
- for (SqlNode node : getExpressions()) {
- selectElement.add(node.toSimpleSql());
- }
- return Joiner.on(", ").join(selectElement);
- }
-
- @Override
- public R accept(SqlNodeVisitor visitor) throws AdapterException {
- return visitor.visit(this);
- }
-
-}
diff --git a/jdbc-adapter/virtualschema-common/src/main/java/com/exasol/adapter/sql/SqlJoin.java b/jdbc-adapter/virtualschema-common/src/main/java/com/exasol/adapter/sql/SqlJoin.java
deleted file mode 100644
index 6594244af..000000000
--- a/jdbc-adapter/virtualschema-common/src/main/java/com/exasol/adapter/sql/SqlJoin.java
+++ /dev/null
@@ -1,72 +0,0 @@
-package com.exasol.adapter.sql;
-
-import com.exasol.adapter.AdapterException;
-
-public class SqlJoin extends SqlNode {
-
- private SqlNode left;
- private SqlNode right;
- private SqlNode condition;
- private JoinType joinType;
-
- public SqlJoin(SqlNode left, SqlNode right, SqlNode condition, JoinType joinType)
- {
- this.left = left;
- if (this.left != null) {
- this.left.setParent(this);
- }
- this.right = right;
- if (this.right != null) {
- this.right.setParent(this);
- }
- this.condition = condition;
- if (this.condition != null) {
- this.condition.setParent(this);
- }
- this.joinType = joinType;
- }
-
- /**
- * @return the left
- */
- public SqlNode getLeft() {
- return left;
- }
-
- /**
- * @return the right
- */
- public SqlNode getRight() {
- return right;
- }
-
- /**
- * @return the condition
- */
- public SqlNode getCondition() {
- return condition;
- }
-
- /**
- * @return the joinType
- */
- public JoinType getJoinType() {
- return joinType;
- }
-
- @Override
- public SqlNodeType getType() {
- return SqlNodeType.JOIN;
- }
-
- @Override
- public R accept(SqlNodeVisitor visitor) throws AdapterException {
- return visitor.visit(this);
- }
-
- @Override
- String toSimpleSql() {
- return left.toSimpleSql() + " " + joinType.name().replace('_', ' ') + " JOIN " + right.toSimpleSql() + " ON " + condition.toSimpleSql();
- }
-
-}
\ No newline at end of file
diff --git a/jdbc-adapter/virtualschema-common/src/main/java/com/exasol/adapter/sql/SqlLimit.java b/jdbc-adapter/virtualschema-common/src/main/java/com/exasol/adapter/sql/SqlLimit.java
deleted file mode 100644
index c1e5564ea..000000000
--- a/jdbc-adapter/virtualschema-common/src/main/java/com/exasol/adapter/sql/SqlLimit.java
+++ /dev/null
@@ -1,61 +0,0 @@
-package com.exasol.adapter.sql;
-
-
-import com.exasol.adapter.AdapterException;
-
-public class SqlLimit extends SqlNode {
-
- int limit;
- int offset;
-
- public SqlLimit(int limit) {
- this(limit, 0);
- }
-
- public SqlLimit(int limit, int offset) {
- this.limit = limit;
- this.offset = offset;
- assert(offset >= 0);
- assert(limit >= 0);
- }
-
- public int getLimit() {
- return limit;
- }
-
- public int getOffset() {
- return offset;
- }
-
- public boolean hasOffset() {
- return offset != 0;
- }
-
- public void setLimit(int limit) {
- this.limit = limit;
- }
-
- public void setOffset(int offset) {
- this.offset = offset;
- }
-
- @Override
- public String toSimpleSql() {
- String offsetSql = "";
- if (offset != 0) {
- offsetSql = " OFFSET " + offset;
- }
- return "LIMIT " + limit + offsetSql;
- }
-
- @Override
- public SqlNodeType getType() {
- return SqlNodeType.LIMIT;
- }
-
- @Override
- public R accept(SqlNodeVisitor visitor) throws AdapterException {
- return visitor.visit(this);
- }
-
-}
diff --git a/jdbc-adapter/virtualschema-common/src/main/java/com/exasol/adapter/sql/SqlLiteralBool.java b/jdbc-adapter/virtualschema-common/src/main/java/com/exasol/adapter/sql/SqlLiteralBool.java
deleted file mode 100644
index 643c175dc..000000000
--- a/jdbc-adapter/virtualschema-common/src/main/java/com/exasol/adapter/sql/SqlLiteralBool.java
+++ /dev/null
@@ -1,37 +0,0 @@
-package com.exasol.adapter.sql;
-
-
-import com.exasol.adapter.AdapterException;
-
-public class SqlLiteralBool extends SqlNode {
-
- private boolean value;
-
- public SqlLiteralBool(boolean value) {
- this.value = value;
- }
-
- public boolean getValue() {
- return value;
- }
-
- @Override
- public String toSimpleSql() {
- if (value) {
- return "true";
- } else {
- return "false";
- }
- }
-
- @Override
- public SqlNodeType getType() {
- return SqlNodeType.LITERAL_BOOL;
- }
-
- @Override
- public R accept(SqlNodeVisitor visitor) throws AdapterException {
- return visitor.visit(this);
- }
-
-}
diff --git a/jdbc-adapter/virtualschema-common/src/main/java/com/exasol/adapter/sql/SqlLiteralDate.java b/jdbc-adapter/virtualschema-common/src/main/java/com/exasol/adapter/sql/SqlLiteralDate.java
deleted file mode 100644
index 010d67ec3..000000000
--- a/jdbc-adapter/virtualschema-common/src/main/java/com/exasol/adapter/sql/SqlLiteralDate.java
+++ /dev/null
@@ -1,33 +0,0 @@
-package com.exasol.adapter.sql;
-
-
-import com.exasol.adapter.AdapterException;
-
-public class SqlLiteralDate extends SqlNode {
-
- private String value; // Stored as YYYY-MM-DD
-
- public SqlLiteralDate(String value) {
- this.value = value;
- }
-
- public String getValue() {
- return value;
- }
-
- @Override
- public String toSimpleSql() {
- return "DATE '" + value + "'"; // This gets always executed as TO_DATE('2015-02-01','YYYY-MM-DD')
- }
-
- @Override
- public SqlNodeType getType() {
- return SqlNodeType.LITERAL_DATE;
- }
-
- @Override
- public R accept(SqlNodeVisitor visitor) throws AdapterException {
- return visitor.visit(this);
- }
-
-}
diff --git a/jdbc-adapter/virtualschema-common/src/main/java/com/exasol/adapter/sql/SqlLiteralDouble.java b/jdbc-adapter/virtualschema-common/src/main/java/com/exasol/adapter/sql/SqlLiteralDouble.java
deleted file mode 100644
index 657539e75..000000000
--- a/jdbc-adapter/virtualschema-common/src/main/java/com/exasol/adapter/sql/SqlLiteralDouble.java
+++ /dev/null
@@ -1,33 +0,0 @@
-package com.exasol.adapter.sql;
-
-
-import com.exasol.adapter.AdapterException;
-
-public class SqlLiteralDouble extends SqlNode {
-
- private double value;
-
- public SqlLiteralDouble(double value) {
- this.value = value;
- }
-
- public double getValue() {
- return value;
- }
-
- @Override
- public String toSimpleSql() {
- return Double.toString(value);
- }
-
- @Override
- public SqlNodeType getType() {
- return SqlNodeType.LITERAL_DOUBLE;
- }
-
- @Override
- public R accept(SqlNodeVisitor visitor) throws AdapterException {
- return visitor.visit(this);
- }
-
-}
diff --git a/jdbc-adapter/virtualschema-common/src/main/java/com/exasol/adapter/sql/SqlLiteralExactnumeric.java b/jdbc-adapter/virtualschema-common/src/main/java/com/exasol/adapter/sql/SqlLiteralExactnumeric.java
deleted file mode 100644
index 6d155cd4c..000000000
--- a/jdbc-adapter/virtualschema-common/src/main/java/com/exasol/adapter/sql/SqlLiteralExactnumeric.java
+++ /dev/null
@@ -1,34 +0,0 @@
-package com.exasol.adapter.sql;
-
-import com.exasol.adapter.AdapterException;
-
-import java.math.BigDecimal;
-
-public class SqlLiteralExactnumeric extends SqlNode {
-
- private BigDecimal value;
-
- public SqlLiteralExactnumeric(BigDecimal value) {
- this.value = value;
- }
-
- public BigDecimal getValue() {
- return value;
- }
-
- @Override
- public String toSimpleSql() {
- return value.toString();
- }
-
- @Override
- public SqlNodeType getType() {
- return SqlNodeType.LITERAL_EXACTNUMERIC;
- }
-
- @Override
- public R accept(SqlNodeVisitor visitor) throws AdapterException {
- return visitor.visit(this);
- }
-
-}
diff --git a/jdbc-adapter/virtualschema-common/src/main/java/com/exasol/adapter/sql/SqlLiteralInterval.java b/jdbc-adapter/virtualschema-common/src/main/java/com/exasol/adapter/sql/SqlLiteralInterval.java
deleted file mode 100644
index 8f951eea2..000000000
--- a/jdbc-adapter/virtualschema-common/src/main/java/com/exasol/adapter/sql/SqlLiteralInterval.java
+++ /dev/null
@@ -1,45 +0,0 @@
-package com.exasol.adapter.sql;
-
-
-import com.exasol.adapter.AdapterException;
-import com.exasol.adapter.metadata.DataType;
-
-public class SqlLiteralInterval extends SqlNode {
-
- private String value; // stored as YYYY-MM-DD HH:MI:SS.FF6
- private DataType type;
-
- public SqlLiteralInterval(String value, DataType type) {
- this.value = value;
- this.type = type;
- }
-
- public String getValue() {
- return value;
- }
-
- public DataType getDataType() {
- return type;
- }
-
- @Override
- public String toSimpleSql() {
- if (type.getIntervalType() == DataType.IntervalType.YEAR_TO_MONTH) {
- return "INTERVAL '" + value.toString() + "' YEAR (" + type.getPrecision() + ") TO MONTH";
- } else {
- return "INTERVAL '" + value.toString() + "' DAY (" + type.getPrecision()
- + ") TO SECOND (" + type.getIntervalFraction() + ")";
- }
- }
-
- @Override
- public SqlNodeType getType() {
- return SqlNodeType.LITERAL_TIMESTAMP;
- }
-
- @Override
- public R accept(SqlNodeVisitor visitor) throws AdapterException {
- return visitor.visit(this);
- }
-
-}
diff --git a/jdbc-adapter/virtualschema-common/src/main/java/com/exasol/adapter/sql/SqlLiteralNull.java b/jdbc-adapter/virtualschema-common/src/main/java/com/exasol/adapter/sql/SqlLiteralNull.java
deleted file mode 100644
index 8076af3ca..000000000
--- a/jdbc-adapter/virtualschema-common/src/main/java/com/exasol/adapter/sql/SqlLiteralNull.java
+++ /dev/null
@@ -1,23 +0,0 @@
-package com.exasol.adapter.sql;
-
-
-import com.exasol.adapter.AdapterException;
-
-public class SqlLiteralNull extends SqlNode {
-
- @Override
- public String toSimpleSql() {
- return "NULL";
- }
-
- @Override
- public SqlNodeType getType() {
- return SqlNodeType.LITERAL_NULL;
- }
-
- @Override
- public R accept(SqlNodeVisitor visitor) throws AdapterException {
- return visitor.visit(this);
- }
-
-}
diff --git a/jdbc-adapter/virtualschema-common/src/main/java/com/exasol/adapter/sql/SqlLiteralString.java b/jdbc-adapter/virtualschema-common/src/main/java/com/exasol/adapter/sql/SqlLiteralString.java
deleted file mode 100644
index 2e1b10ce7..000000000
--- a/jdbc-adapter/virtualschema-common/src/main/java/com/exasol/adapter/sql/SqlLiteralString.java
+++ /dev/null
@@ -1,34 +0,0 @@
-package com.exasol.adapter.sql;
-
-
-import com.exasol.adapter.AdapterException;
-
-public class SqlLiteralString extends SqlNode {
-
- private String value;
-
- public SqlLiteralString(String value) {
- this.value = value;
- }
-
- public String getValue() {
- return value;
- }
-
- @Override
- public String toSimpleSql() {
- // Don't forget to escape single quote
- return "'" + value.replace("'", "''") + "'";
- }
-
- @Override
- public SqlNodeType getType() {
- return SqlNodeType.LITERAL_STRING;
- }
-
- @Override
- public R accept(SqlNodeVisitor visitor) throws AdapterException {
- return visitor.visit(this);
- }
-
-}
diff --git a/jdbc-adapter/virtualschema-common/src/main/java/com/exasol/adapter/sql/SqlLiteralTimestamp.java b/jdbc-adapter/virtualschema-common/src/main/java/com/exasol/adapter/sql/SqlLiteralTimestamp.java
deleted file mode 100644
index 0965aa4ff..000000000
--- a/jdbc-adapter/virtualschema-common/src/main/java/com/exasol/adapter/sql/SqlLiteralTimestamp.java
+++ /dev/null
@@ -1,33 +0,0 @@
-package com.exasol.adapter.sql;
-
-
-import com.exasol.adapter.AdapterException;
-
-public class SqlLiteralTimestamp extends SqlNode {
-
- private String value; // stored as YYYY-MM-DD HH:MI:SS.FF6
-
- public SqlLiteralTimestamp(String value) {
- this.value = value;
- }
-
- public String getValue() {
- return value;
- }
-
- @Override
- public String toSimpleSql() {
- return "TIMESTAMP '" + value.toString() + "'";
- }
-
- @Override
- public SqlNodeType getType() {
- return SqlNodeType.LITERAL_TIMESTAMP;
- }
-
- @Override
- public R accept(SqlNodeVisitor visitor) throws AdapterException {
- return visitor.visit(this);
- }
-
-}
diff --git a/jdbc-adapter/virtualschema-common/src/main/java/com/exasol/adapter/sql/SqlLiteralTimestampUtc.java b/jdbc-adapter/virtualschema-common/src/main/java/com/exasol/adapter/sql/SqlLiteralTimestampUtc.java
deleted file mode 100644
index 6f1b8403e..000000000
--- a/jdbc-adapter/virtualschema-common/src/main/java/com/exasol/adapter/sql/SqlLiteralTimestampUtc.java
+++ /dev/null
@@ -1,33 +0,0 @@
-package com.exasol.adapter.sql;
-
-
-import com.exasol.adapter.AdapterException;
-
-public class SqlLiteralTimestampUtc extends SqlNode {
-
- private String value; // stored as YYYY-MM-DD HH:MI:SS.FF6
-
- public SqlLiteralTimestampUtc(String value) {
- this.value = value;
- }
-
- public String getValue() {
- return value;
- }
-
- @Override
- public String toSimpleSql() {
- return "TIMESTAMP '" + value.toString() + "'";
- }
-
- @Override
- public SqlNodeType getType() {
- return SqlNodeType.LITERAL_TIMESTAMPUTC;
- }
-
- @Override
- public R accept(SqlNodeVisitor visitor) throws AdapterException {
- return visitor.visit(this);
- }
-
-}
diff --git a/jdbc-adapter/virtualschema-common/src/main/java/com/exasol/adapter/sql/SqlNode.java b/jdbc-adapter/virtualschema-common/src/main/java/com/exasol/adapter/sql/SqlNode.java
deleted file mode 100644
index 765a6e1c3..000000000
--- a/jdbc-adapter/virtualschema-common/src/main/java/com/exasol/adapter/sql/SqlNode.java
+++ /dev/null
@@ -1,40 +0,0 @@
-package com.exasol.adapter.sql;
-
-import com.exasol.adapter.AdapterException;
-
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * Node in a graph representing a SQL query.
- */
-public abstract class SqlNode {
-
- private SqlNode parent;
-
- public abstract SqlNodeType getType();
-
-
- public void setParent(SqlNode parent) {
- this.parent = parent;
- }
-
- public SqlNode getParent() {
- return parent;
- }
-
- public boolean hasParent() {
- return (this.parent != null);
- }
-
- /**
- * See {@link SqlNodeVisitor}
- * @param visitor The visitor object on which the appropriate visit(sqlNode) method is called
- */
- public abstract R accept(SqlNodeVisitor visitor) throws AdapterException;
-
- /**
- * @return A SQL representation of the current graph, using EXASOL SQL syntax. It is called "SIMPLE" because it is not guaranteed to be 100 % correct SQL (e.g. might be ambiguous).
- */
- abstract String toSimpleSql();
-}
diff --git a/jdbc-adapter/virtualschema-common/src/main/java/com/exasol/adapter/sql/SqlNodeType.java b/jdbc-adapter/virtualschema-common/src/main/java/com/exasol/adapter/sql/SqlNodeType.java
deleted file mode 100644
index c392c1df0..000000000
--- a/jdbc-adapter/virtualschema-common/src/main/java/com/exasol/adapter/sql/SqlNodeType.java
+++ /dev/null
@@ -1,56 +0,0 @@
-package com.exasol.adapter.sql;
-
-/**
- * All types of nodes that can be part of a pushdown request.
- * Each type represents a different class inheriting from SqlNode.
- */
-public enum SqlNodeType {
-
- SELECT,
-
- TABLE,
- JOIN,
-
- SELECT_LIST,
- GROUP_BY,
-
- COLUMN,
-
- LITERAL_NULL,
- LITERAL_BOOL,
- LITERAL_DATE,
- LITERAL_TIMESTAMP,
- LITERAL_TIMESTAMPUTC,
- LITERAL_DOUBLE,
- LITERAL_EXACTNUMERIC,
- LITERAL_STRING,
- LITERAL_INTERVAL,
-
- PREDICATE_AND,
- PREDICATE_OR,
- PREDICATE_NOT,
-
- PREDICATE_EQUAL,
- PREDICATE_NOTEQUAL,
- PREDICATE_LESS,
- PREDICATE_LESSEQUAL,
-
- PREDICATE_LIKE,
- PREDICATE_LIKE_REGEXP,
- PREDICATE_BETWEEN,
- PREDICATE_IN_CONSTLIST,
-
- PREDICATE_IS_NULL,
- PREDICATE_IS_NOT_NULL,
-
- FUNCTION_SCALAR,
- FUNCTION_SCALAR_CASE,
- FUNCTION_SCALAR_CAST,
- FUNCTION_SCALAR_EXTRACT,
- FUNCTION_AGGREGATE,
- FUNCTION_AGGREGATE_GROUP_CONCAT,
-
- ORDER_BY,
-
- LIMIT;
-}
diff --git a/jdbc-adapter/virtualschema-common/src/main/java/com/exasol/adapter/sql/SqlNodeVisitor.java b/jdbc-adapter/virtualschema-common/src/main/java/com/exasol/adapter/sql/SqlNodeVisitor.java
deleted file mode 100644
index 42b80f241..000000000
--- a/jdbc-adapter/virtualschema-common/src/main/java/com/exasol/adapter/sql/SqlNodeVisitor.java
+++ /dev/null
@@ -1,89 +0,0 @@
-package com.exasol.adapter.sql;
-
-import com.exasol.adapter.AdapterException;
-
-/**
- * Implementation of the Visitor pattern for the SqlNode.
- *
- * Benefit of this Visitor implementation: We get compile time safety that all
- * Visitors have implementations for all SqlNode types.
- *
- * Drawback of this Visitor implementation: Whenever a new SqlNode gets added,
- * we need to implement it here (should be fine for now). If this becomes to
- * annoying, we can still switch to a visitor pattern using Reflection.
- */
-public interface SqlNodeVisitor {
-
- public R visit(SqlStatementSelect select) throws AdapterException;
-
- public R visit(SqlSelectList selectList) throws AdapterException;
-
- public R visit(SqlGroupBy groupBy) throws AdapterException;
-
- public R visit(SqlColumn sqlColumn) throws AdapterException;
-
- public R visit(SqlFunctionAggregate sqlFunctionAggregate) throws AdapterException;
-
- public R visit(SqlFunctionAggregateGroupConcat sqlFunctionAggregateGroupConcat) throws AdapterException;
-
- public R visit(SqlFunctionScalar sqlFunctionScalar) throws AdapterException;
-
- public R visit(SqlFunctionScalarCase sqlFunctionScalarCase) throws AdapterException;
-
- public R visit(SqlFunctionScalarCast sqlFunctionScalarCast) throws AdapterException;
-
- public R visit(SqlFunctionScalarExtract sqlFunctionScalarExtract) throws AdapterException;
-
- public R visit(SqlLimit sqlLimit) throws AdapterException;
-
- public R visit(SqlLiteralBool sqlLiteralBool) throws AdapterException;
-
- public R visit(SqlLiteralDate sqlLiteralDate) throws AdapterException;
-
- public R visit(SqlLiteralDouble sqlLiteralDouble) throws AdapterException;
-
- public R visit(SqlLiteralExactnumeric sqlLiteralExactnumeric) throws AdapterException;
-
- public R visit(SqlLiteralNull sqlLiteralNull) throws AdapterException;
-
- public R visit(SqlLiteralString sqlLiteralString) throws AdapterException;
-
- public R visit(SqlLiteralTimestamp sqlLiteralTimestamp) throws AdapterException;
-
- public R visit(SqlLiteralTimestampUtc sqlLiteralTimestampUtc) throws AdapterException;
-
- public R visit(SqlLiteralInterval sqlLiteralInterval) throws AdapterException;
-
- public R visit(SqlOrderBy sqlOrderBy) throws AdapterException;
-
- public R visit(SqlPredicateAnd sqlPredicateAnd) throws AdapterException;
-
- public R visit(SqlPredicateBetween sqlPredicateBetween) throws AdapterException;
-
- public R visit(SqlPredicateEqual sqlPredicateEqual) throws AdapterException;
-
- public R visit(SqlPredicateInConstList sqlPredicateInConstList) throws AdapterException;
-
- public R visit(SqlPredicateLess sqlPredicateLess) throws AdapterException;
-
- public R visit(SqlPredicateLessEqual sqlPredicateLessEqual) throws AdapterException;
-
- public R visit(SqlPredicateLike sqlPredicateLike) throws AdapterException;
-
- public R visit(SqlPredicateLikeRegexp sqlPredicateLikeRegexp) throws AdapterException;
-
- public R visit(SqlPredicateNot sqlPredicateNot) throws AdapterException;
-
- public R visit(SqlPredicateNotEqual sqlPredicateNotEqual) throws AdapterException;
-
- public R visit(SqlPredicateOr sqlPredicateOr) throws AdapterException;
-
- public R visit(SqlPredicateIsNotNull sqlPredicateOr) throws AdapterException;
-
- public R visit(SqlPredicateIsNull sqlPredicateOr) throws AdapterException;
-
- public R visit(SqlTable sqlTable) throws AdapterException;
-
- public R visit(SqlJoin sqlJoin) throws AdapterException;
-
-}
diff --git a/jdbc-adapter/virtualschema-common/src/main/java/com/exasol/adapter/sql/SqlOrderBy.java b/jdbc-adapter/virtualschema-common/src/main/java/com/exasol/adapter/sql/SqlOrderBy.java
deleted file mode 100644
index f69dd7d07..000000000
--- a/jdbc-adapter/virtualschema-common/src/main/java/com/exasol/adapter/sql/SqlOrderBy.java
+++ /dev/null
@@ -1,82 +0,0 @@
-package com.exasol.adapter.sql;
-
-import com.exasol.adapter.AdapterException;
-import com.google.common.base.Joiner;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-
-public class SqlOrderBy extends SqlNode {
-
- List expressions;
- List isAsc;
-
- // True, if the desired position of nulls is at the end, false if at beginning.
- // This does not necessarily mean the user explicitly specified NULLS LAST or NULLS FIRST.
- List nullsLast;
-
- public SqlOrderBy(List expressions, List isAsc, List nullsFirst) {
- this.expressions = expressions;
- this.isAsc = isAsc;
- this.nullsLast = nullsFirst;
- if (this.expressions != null) {
- for (SqlNode node : this.expressions) {
- node.setParent(this);
- }
- }
- }
-
- public List getExpressions() {
- if (expressions == null) {
- return null;
- } else {
- return Collections.unmodifiableList(expressions);
- }
- }
-
- public List isAscending() {
- if (isAsc == null) {
- return null;
- } else {
- return Collections.unmodifiableList(isAsc);
- }
- }
-
- public List nullsLast() {
- if (nullsLast == null) {
- return null;
- } else {
- return Collections.unmodifiableList(nullsLast);
- }
- }
-
- @Override
- public String toSimpleSql() {
- // ORDER BY [ASC/DESC] [NULLS FIRST/LAST]
- // ASC and NULLS LAST are default
- List sqlOrderElement = new ArrayList<>();
- for (int i = 0; i < expressions.size(); ++i) {
- String elementSql = expressions.get(i).toSimpleSql();
- if (isAsc.get(i) == false) {
- elementSql += " DESC";
- }
- if (nullsLast.get(i) == false) {
- elementSql += " NULLS FIRST";
- }
- sqlOrderElement.add(elementSql);
- }
- return "ORDER BY " + Joiner.on(", ").join(sqlOrderElement);
- }
-
- @Override
- public SqlNodeType getType() {
- return SqlNodeType.ORDER_BY;
- }
-
- @Override
- public R accept(SqlNodeVisitor visitor) throws AdapterException {
- return visitor.visit(this);
- }
-
-}
diff --git a/jdbc-adapter/virtualschema-common/src/main/java/com/exasol/adapter/sql/SqlPredicate.java b/jdbc-adapter/virtualschema-common/src/main/java/com/exasol/adapter/sql/SqlPredicate.java
deleted file mode 100644
index db5be873f..000000000
--- a/jdbc-adapter/virtualschema-common/src/main/java/com/exasol/adapter/sql/SqlPredicate.java
+++ /dev/null
@@ -1,14 +0,0 @@
-package com.exasol.adapter.sql;
-
-public abstract class SqlPredicate extends SqlNode {
-
- private Predicate function;
-
- public SqlPredicate(Predicate function) {
- this.function = function;
- }
-
- public Predicate getFunction() {
- return function;
- }
-}
diff --git a/jdbc-adapter/virtualschema-common/src/main/java/com/exasol/adapter/sql/SqlPredicateAnd.java b/jdbc-adapter/virtualschema-common/src/main/java/com/exasol/adapter/sql/SqlPredicateAnd.java
deleted file mode 100644
index f6d47d25a..000000000
--- a/jdbc-adapter/virtualschema-common/src/main/java/com/exasol/adapter/sql/SqlPredicateAnd.java
+++ /dev/null
@@ -1,52 +0,0 @@
-package com.exasol.adapter.sql;
-
-import com.exasol.adapter.AdapterException;
-import com.google.common.base.Joiner;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-
-
-public class SqlPredicateAnd extends SqlPredicate {
-
- List andedPredicates;
-
- public SqlPredicateAnd(List andedPredicates) {
- super(Predicate.AND);
- this.andedPredicates = andedPredicates;
- if (this.andedPredicates != null) {
- for (SqlNode node : this.andedPredicates) {
- node.setParent(this);
- }
- }
- }
-
- public List getAndedPredicates() {
- if (andedPredicates == null) {
- return null;
- } else {
- return Collections.unmodifiableList(andedPredicates);
- }
- }
-
- @Override
- public String toSimpleSql() {
- List operandsSql = new ArrayList<>();
- for (SqlNode node : andedPredicates) {
- operandsSql.add(node.toSimpleSql());
- }
- return "(" + Joiner.on(" AND ").join(operandsSql) + ")";
- }
-
- @Override
- public SqlNodeType getType() {
- return SqlNodeType.PREDICATE_AND;
- }
-
- @Override
- public R accept(SqlNodeVisitor visitor) throws AdapterException {
- return visitor.visit(this);
- }
-
-}
diff --git a/jdbc-adapter/virtualschema-common/src/main/java/com/exasol/adapter/sql/SqlPredicateBetween.java b/jdbc-adapter/virtualschema-common/src/main/java/com/exasol/adapter/sql/SqlPredicateBetween.java
deleted file mode 100644
index 550de153c..000000000
--- a/jdbc-adapter/virtualschema-common/src/main/java/com/exasol/adapter/sql/SqlPredicateBetween.java
+++ /dev/null
@@ -1,55 +0,0 @@
-package com.exasol.adapter.sql;
-
-
-import com.exasol.adapter.AdapterException;
-
-public class SqlPredicateBetween extends SqlPredicate {
-
- private SqlNode expression;
- private SqlNode betweenLeft;
- private SqlNode betweenRight;
-
- public SqlPredicateBetween(SqlNode expression, SqlNode betweenLeft, SqlNode betweenRight) {
- super(Predicate.BETWEEN);
- this.expression = expression;
- this.betweenLeft = betweenLeft;
- this.betweenRight = betweenRight;
- if (this.expression != null) {
- this.expression.setParent(this);
- }
- if (this.betweenLeft != null) {
- this.betweenLeft.setParent(this);
- }
- if (this.betweenRight != null) {
- this.betweenRight.setParent(this);
- }
- }
-
- public SqlNode getExpression() {
- return expression;
- }
-
- public SqlNode getBetweenLeft() {
- return betweenLeft;
- }
-
- public SqlNode getBetweenRight() {
- return betweenRight;
- }
-
- @Override
- public String toSimpleSql() {
- return expression.toSimpleSql() + " BETWEEN " + betweenLeft.toSimpleSql() + " AND " + betweenRight.toSimpleSql();
- }
-
- @Override
- public SqlNodeType getType() {
- return SqlNodeType.PREDICATE_BETWEEN;
- }
-
- @Override
- public R accept(SqlNodeVisitor visitor) throws AdapterException {
- return visitor.visit(this);
- }
-
-}
diff --git a/jdbc-adapter/virtualschema-common/src/main/java/com/exasol/adapter/sql/SqlPredicateEqual.java b/jdbc-adapter/virtualschema-common/src/main/java/com/exasol/adapter/sql/SqlPredicateEqual.java
deleted file mode 100644
index 1237ca9ec..000000000
--- a/jdbc-adapter/virtualschema-common/src/main/java/com/exasol/adapter/sql/SqlPredicateEqual.java
+++ /dev/null
@@ -1,46 +0,0 @@
-package com.exasol.adapter.sql;
-
-
-import com.exasol.adapter.AdapterException;
-
-public class SqlPredicateEqual extends SqlPredicate {
-
- private SqlNode left;
- private SqlNode right;
-
- public SqlPredicateEqual(SqlNode left, SqlNode right) {
- super(Predicate.EQUAL);
- this.left = left;
- this.right = right;
- if (this.left != null) {
- this.left.setParent(this);
- }
- if (this.right != null) {
- this.right.setParent(this);
- }
- }
-
- public SqlNode getLeft() {
- return left;
- }
-
- public SqlNode getRight() {
- return right;
- }
-
- @Override
- public String toSimpleSql() {
- return left.toSimpleSql() + " = " + right.toSimpleSql();
- }
-
- @Override
- public SqlNodeType getType() {
- return SqlNodeType.PREDICATE_EQUAL;
- }
-
- @Override
- public R accept(SqlNodeVisitor visitor) throws AdapterException {
- return visitor.visit(this);
- }
-
-}
diff --git a/jdbc-adapter/virtualschema-common/src/main/java/com/exasol/adapter/sql/SqlPredicateInConstList.java b/jdbc-adapter/virtualschema-common/src/main/java/com/exasol/adapter/sql/SqlPredicateInConstList.java
deleted file mode 100644
index c1bd042c6..000000000
--- a/jdbc-adapter/virtualschema-common/src/main/java/com/exasol/adapter/sql/SqlPredicateInConstList.java
+++ /dev/null
@@ -1,63 +0,0 @@
-package com.exasol.adapter.sql;
-
-import com.exasol.adapter.AdapterException;
-import com.google.common.base.Joiner;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-
-
-public class SqlPredicateInConstList extends SqlPredicate {
-
- // For IN (...) this stores
- SqlNode expression;
- // Arguments inside the brackets
- List inArguments;
-
- public SqlPredicateInConstList(SqlNode expression, List inArguments) {
- super(Predicate.IN_CONSTLIST);
- this.expression = expression;
- this.inArguments = inArguments;
- if (this.expression != null) {
- this.expression.setParent(this);
- }
- if (this.inArguments != null) {
- for (SqlNode node : this.inArguments) {
- node.setParent(this);
- }
- }
- }
-
- public SqlNode getExpression() {
- return expression;
- }
-
- public List getInArguments() {
- if (inArguments == null) {
- return null;
- } else {
- return Collections.unmodifiableList(inArguments);
- }
- }
-
- @Override
- public String toSimpleSql() {
- List argumentsSql = new ArrayList<>();
- for (SqlNode node : inArguments) {
- argumentsSql.add(node.toSimpleSql());
- }
- return expression.toSimpleSql() + " IN (" + Joiner.on(", ").join(argumentsSql) + ")";
- }
-
- @Override
- public SqlNodeType getType() {
- return SqlNodeType.PREDICATE_IN_CONSTLIST;
- }
-
- @Override
- public R accept(SqlNodeVisitor visitor) throws AdapterException {
- return visitor.visit(this);
- }
-
-}
diff --git a/jdbc-adapter/virtualschema-common/src/main/java/com/exasol/adapter/sql/SqlPredicateIsNotNull.java b/jdbc-adapter/virtualschema-common/src/main/java/com/exasol/adapter/sql/SqlPredicateIsNotNull.java
deleted file mode 100644
index 0ddfd0a43..000000000
--- a/jdbc-adapter/virtualschema-common/src/main/java/com/exasol/adapter/sql/SqlPredicateIsNotNull.java
+++ /dev/null
@@ -1,37 +0,0 @@
-package com.exasol.adapter.sql;
-
-
-import com.exasol.adapter.AdapterException;
-
-public class SqlPredicateIsNotNull extends SqlPredicate {
-
- private SqlNode expression;
-
- public SqlPredicateIsNotNull(SqlNode expression) {
- super(Predicate.IS_NULL);
- this.expression = expression;
- if (this.expression != null) {
- this.expression.setParent(this);
- }
- }
-
- public SqlNode getExpression() {
- return expression;
- }
-
- @Override
- public String toSimpleSql() {
- return expression.toSimpleSql() + " IS NOT NULL";
- }
-
- @Override
- public SqlNodeType getType() {
- return SqlNodeType.PREDICATE_IS_NULL;
- }
-
- @Override
- public R accept(SqlNodeVisitor visitor) throws AdapterException {
- return visitor.visit(this);
- }
-
-}
diff --git a/jdbc-adapter/virtualschema-common/src/main/java/com/exasol/adapter/sql/SqlPredicateIsNull.java b/jdbc-adapter/virtualschema-common/src/main/java/com/exasol/adapter/sql/SqlPredicateIsNull.java
deleted file mode 100644
index 4178e277b..000000000
--- a/jdbc-adapter/virtualschema-common/src/main/java/com/exasol/adapter/sql/SqlPredicateIsNull.java
+++ /dev/null
@@ -1,37 +0,0 @@
-package com.exasol.adapter.sql;
-
-
-import com.exasol.adapter.AdapterException;
-
-public class SqlPredicateIsNull extends SqlPredicate {
-
- private SqlNode expression;
-
- public SqlPredicateIsNull(SqlNode expression) {
- super(Predicate.IS_NULL);
- this.expression = expression;
- if (this.expression != null) {
- this.expression.setParent(this);
- }
- }
-
- public SqlNode getExpression() {
- return expression;
- }
-
- @Override
- public String toSimpleSql() {
- return expression.toSimpleSql() + " IS NULL";
- }
-
- @Override
- public SqlNodeType getType() {
- return SqlNodeType.PREDICATE_IS_NULL;
- }
-
- @Override
- public R accept(SqlNodeVisitor visitor) throws AdapterException {
- return visitor.visit(this);
- }
-
-}
diff --git a/jdbc-adapter/virtualschema-common/src/main/java/com/exasol/adapter/sql/SqlPredicateLess.java b/jdbc-adapter/virtualschema-common/src/main/java/com/exasol/adapter/sql/SqlPredicateLess.java
deleted file mode 100644
index 0a1eb168f..000000000
--- a/jdbc-adapter/virtualschema-common/src/main/java/com/exasol/adapter/sql/SqlPredicateLess.java
+++ /dev/null
@@ -1,46 +0,0 @@
-package com.exasol.adapter.sql;
-
-
-import com.exasol.adapter.AdapterException;
-
-public class SqlPredicateLess extends SqlPredicate {
-
- private SqlNode left;
- private SqlNode right;
-
- public SqlPredicateLess(SqlNode left, SqlNode right) {
- super(Predicate.LESS);
- this.left = left;
- this.right = right;
- if (this.left != null) {
- this.left.setParent(this);
- }
- if (this.right != null) {
- this.right.setParent(this);
- }
- }
-
- public SqlNode getLeft() {
- return left;
- }
-
- public SqlNode getRight() {
- return right;
- }
-
- @Override
- public String toSimpleSql() {
- return left.toSimpleSql() + " < " + right.toSimpleSql();
- }
-
- @Override
- public SqlNodeType getType() {
- return SqlNodeType.PREDICATE_LESS;
- }
-
- @Override
- public R accept(SqlNodeVisitor visitor) throws AdapterException {
- return visitor.visit(this);
- }
-
-}
diff --git a/jdbc-adapter/virtualschema-common/src/main/java/com/exasol/adapter/sql/SqlPredicateLessEqual.java b/jdbc-adapter/virtualschema-common/src/main/java/com/exasol/adapter/sql/SqlPredicateLessEqual.java
deleted file mode 100644
index e126d48d8..000000000
--- a/jdbc-adapter/virtualschema-common/src/main/java/com/exasol/adapter/sql/SqlPredicateLessEqual.java
+++ /dev/null
@@ -1,46 +0,0 @@
-package com.exasol.adapter.sql;
-
-
-import com.exasol.adapter.AdapterException;
-
-public class SqlPredicateLessEqual extends SqlPredicate {
-
- private SqlNode left;
- private SqlNode right;
-
- public SqlPredicateLessEqual(SqlNode left, SqlNode right) {
- super(Predicate.LESSEQUAL);
- this.left = left;
- this.right = right;
- if (this.left != null) {
- this.left.setParent(this);
- }
- if (this.right != null) {
- this.right.setParent(this);
- }
- }
-
- public SqlNode getLeft() {
- return left;
- }
-
- public SqlNode getRight() {
- return right;
- }
-
- @Override
- public String toSimpleSql() {
- return left.toSimpleSql() + " <= " + right.toSimpleSql();
- }
-
- @Override
- public SqlNodeType getType() {
- return SqlNodeType.PREDICATE_LESSEQUAL;
- }
-
- @Override
- public R accept(SqlNodeVisitor visitor) throws AdapterException {
- return visitor.visit(this);
- }
-
-}
diff --git a/jdbc-adapter/virtualschema-common/src/main/java/com/exasol/adapter/sql/SqlPredicateLike.java b/jdbc-adapter/virtualschema-common/src/main/java/com/exasol/adapter/sql/SqlPredicateLike.java
deleted file mode 100644
index f2b183a96..000000000
--- a/jdbc-adapter/virtualschema-common/src/main/java/com/exasol/adapter/sql/SqlPredicateLike.java
+++ /dev/null
@@ -1,66 +0,0 @@
-package com.exasol.adapter.sql;
-
-
-import com.exasol.adapter.AdapterException;
-
-/**
- *
- */
-public class SqlPredicateLike extends SqlPredicate {
-
- private SqlNode left;
- private SqlNode pattern;
- private SqlNode escapeChar;
-
- public SqlPredicateLike(SqlNode left, SqlNode pattern) {
- this(left, pattern, null);
- }
-
- public SqlPredicateLike(SqlNode left, SqlNode pattern, SqlNode escapeChar) {
- super(Predicate.LIKE);
- this.left = left;
- this.pattern = pattern;
- this.escapeChar = escapeChar;
- if (this.left != null) {
- this.left.setParent(this);
- }
- if (this.pattern != null) {
- this.pattern.setParent(this);
- }
- if (this.escapeChar != null) {
- this.escapeChar.setParent(this);
- }
- }
-
- public SqlNode getLeft() {
- return left;
- }
-
- public SqlNode getPattern() {
- return pattern;
- }
-
- public SqlNode getEscapeChar() {
- return escapeChar;
- }
-
- @Override
- public String toSimpleSql() {
- String sql = left.toSimpleSql() + " LIKE " + pattern.toSimpleSql();
- if (escapeChar != null) {
- sql += " ESCAPE " + escapeChar;
- }
- return sql;
- }
-
- @Override
- public SqlNodeType getType() {
- return SqlNodeType.PREDICATE_LIKE;
- }
-
- @Override
- public R accept(SqlNodeVisitor visitor) throws AdapterException {
- return visitor.visit(this);
- }
-
-}
diff --git a/jdbc-adapter/virtualschema-common/src/main/java/com/exasol/adapter/sql/SqlPredicateLikeRegexp.java b/jdbc-adapter/virtualschema-common/src/main/java/com/exasol/adapter/sql/SqlPredicateLikeRegexp.java
deleted file mode 100644
index a858e90ab..000000000
--- a/jdbc-adapter/virtualschema-common/src/main/java/com/exasol/adapter/sql/SqlPredicateLikeRegexp.java
+++ /dev/null
@@ -1,46 +0,0 @@
-package com.exasol.adapter.sql;
-
-
-import com.exasol.adapter.AdapterException;
-
-public class SqlPredicateLikeRegexp extends SqlPredicate {
-
- private SqlNode left;
- private SqlNode pattern;
-
- public SqlPredicateLikeRegexp(SqlNode left, SqlNode pattern) {
- super(Predicate.REGEXP_LIKE);
- this.left = left;
- this.pattern = pattern;
- if (this.left != null) {
- this.left.setParent(this);
- }
- if (this.pattern != null) {
- this.pattern.setParent(this);
- }
- }
-
- public SqlNode getLeft() {
- return left;
- }
-
- public SqlNode getPattern() {
- return pattern;
- }
-
- @Override
- public String toSimpleSql() {
- return left.toSimpleSql() + " REGEXP_LIKE " + pattern.toSimpleSql();
- }
-
- @Override
- public SqlNodeType getType() {
- return SqlNodeType.PREDICATE_LIKE_REGEXP;
- }
-
- @Override
- public R accept(SqlNodeVisitor visitor) throws AdapterException {
- return visitor.visit(this);
- }
-
-}
diff --git a/jdbc-adapter/virtualschema-common/src/main/java/com/exasol/adapter/sql/SqlPredicateNot.java b/jdbc-adapter/virtualschema-common/src/main/java/com/exasol/adapter/sql/SqlPredicateNot.java
deleted file mode 100644
index 11f867c0b..000000000
--- a/jdbc-adapter/virtualschema-common/src/main/java/com/exasol/adapter/sql/SqlPredicateNot.java
+++ /dev/null
@@ -1,37 +0,0 @@
-package com.exasol.adapter.sql;
-
-
-import com.exasol.adapter.AdapterException;
-
-public class SqlPredicateNot extends SqlPredicate {
-
- private SqlNode expression;
-
- public SqlPredicateNot(SqlNode expression) {
- super(Predicate.NOT);
- this.expression = expression;
- if (this.expression != null) {
- this.expression.setParent(this);
- }
- }
-
- public SqlNode getExpression() {
- return expression;
- }
-
- @Override
- public String toSimpleSql() {
- return "NOT (" + expression.toSimpleSql() + ")";
- }
-
- @Override
- public SqlNodeType getType() {
- return SqlNodeType.PREDICATE_NOT;
- }
-
- @Override
- public R accept(SqlNodeVisitor visitor) throws AdapterException {
- return visitor.visit(this);
- }
-
-}
diff --git a/jdbc-adapter/virtualschema-common/src/main/java/com/exasol/adapter/sql/SqlPredicateNotEqual.java b/jdbc-adapter/virtualschema-common/src/main/java/com/exasol/adapter/sql/SqlPredicateNotEqual.java
deleted file mode 100644
index 6f31df61e..000000000
--- a/jdbc-adapter/virtualschema-common/src/main/java/com/exasol/adapter/sql/SqlPredicateNotEqual.java
+++ /dev/null
@@ -1,46 +0,0 @@
-package com.exasol.adapter.sql;
-
-
-import com.exasol.adapter.AdapterException;
-
-public class SqlPredicateNotEqual extends SqlPredicate {
-
- private SqlNode left;
- private SqlNode right;
-
- public SqlPredicateNotEqual(SqlNode left, SqlNode right) {
- super(Predicate.NOTEQUAL);
- this.left = left;
- this.right = right;
- if (this.left != null) {
- this.left.setParent(this);
- }
- if (this.right != null) {
- this.right.setParent(this);
- }
- }
-
- public SqlNode getLeft() {
- return left;
- }
-
- public SqlNode getRight() {
- return right;
- }
-
- @Override
- public String toSimpleSql() {
- return left.toSimpleSql() + " != " + right.toSimpleSql();
- }
-
- @Override
- public SqlNodeType getType() {
- return SqlNodeType.PREDICATE_NOTEQUAL;
- }
-
- @Override
- public R accept(SqlNodeVisitor visitor) throws AdapterException {
- return visitor.visit(this);
- }
-
-}
diff --git a/jdbc-adapter/virtualschema-common/src/main/java/com/exasol/adapter/sql/SqlPredicateOr.java b/jdbc-adapter/virtualschema-common/src/main/java/com/exasol/adapter/sql/SqlPredicateOr.java
deleted file mode 100644
index 6fb94816b..000000000
--- a/jdbc-adapter/virtualschema-common/src/main/java/com/exasol/adapter/sql/SqlPredicateOr.java
+++ /dev/null
@@ -1,52 +0,0 @@
-package com.exasol.adapter.sql;
-
-import com.exasol.adapter.AdapterException;
-import com.google.common.base.Joiner;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-
-
-public class SqlPredicateOr extends SqlPredicate {
-
- List orPredicates;
-
- public SqlPredicateOr(List orPredicates) {
- super(Predicate.OR);
- this.orPredicates = orPredicates;
- if (this.orPredicates != null) {
- for (SqlNode node : this.orPredicates) {
- node.setParent(this);
- }
- }
- }
-
- public List getOrPredicates() {
- if (orPredicates == null) {
- return null;
- } else {
- return Collections.unmodifiableList(orPredicates);
- }
- }
-
- @Override
- public String toSimpleSql() {
- List operandsSql = new ArrayList<>();
- for (SqlNode node : orPredicates) {
- operandsSql.add(node.toSimpleSql());
- }
- return "(" + Joiner.on(" OR ").join(operandsSql) + ")";
- }
-
- @Override
- public SqlNodeType getType() {
- return SqlNodeType.PREDICATE_OR;
- }
-
- @Override
- public R accept(SqlNodeVisitor visitor) throws AdapterException {
- return visitor.visit(this);
- }
-
-}
diff --git a/jdbc-adapter/virtualschema-common/src/main/java/com/exasol/adapter/sql/SqlSelectList.java b/jdbc-adapter/virtualschema-common/src/main/java/com/exasol/adapter/sql/SqlSelectList.java
deleted file mode 100644
index e9b95d239..000000000
--- a/jdbc-adapter/virtualschema-common/src/main/java/com/exasol/adapter/sql/SqlSelectList.java
+++ /dev/null
@@ -1,84 +0,0 @@
-package com.exasol.adapter.sql;
-
-import com.exasol.adapter.AdapterException;
-import com.google.common.base.Joiner;
-
-import java.util.ArrayList;
-import java.util.List;
-
-public class SqlSelectList extends SqlExpressionList {
-
- SqlSelectListType type;
-
- private SqlSelectList(SqlSelectListType type, List selectList) {
- super(selectList);
- this.type = type;
- }
-
- /**
- * Creates a SqlSelectList for SELECT *. See {@link SqlSelectListType#SelectStar}.
- * @return the new SqlSelectList.
- */
- public static SqlSelectList createSelectStarSelectList() {
- return new SqlSelectList(SqlSelectListType.SelectStar, null);
- }
-
- /**
- * Creates a SqlSelectList that uses an arbitrary value. See {@link SqlSelectListType#AnyValue}.
- * @return the new SqlSelectList.
- */
- public static SqlSelectList createAnyValueSelectList() {
- return new SqlSelectList(SqlSelectListType.AnyValue, null);
- }
-
- /**
- * Creates a regular SqlSelectList. See {@link SqlSelectListType#Regular}.
- * @param selectList The selectList needs at least one element.
- * @return the new SqlSelectList.
- */
- public static SqlSelectList createRegularSelectList(List selectList) {
- assert (selectList != null);
- assert (selectList.size() > 0);
- return new SqlSelectList(SqlSelectListType.Regular, selectList);
- }
-
-
-
- public boolean isRequestAnyColumn() {
- return type == SqlSelectListType.AnyValue;
- }
-
- /**
- * @return true if this is "SELECT *", false otherwise
- */
- public boolean isSelectStar() {
- return type == SqlSelectListType.SelectStar;
- }
-
- @Override
- public SqlNodeType getType() {
- return SqlNodeType.SELECT_LIST;
- }
-
- @Override
- public String toSimpleSql() {
- if (isRequestAnyColumn()) {
- // The system requested any column
- return "true";
- }
- if (isSelectStar()) {
- return "*";
- }
- List selectElement = new ArrayList<>();
- for (SqlNode node : getExpressions()) {
- selectElement.add(node.toSimpleSql());
- }
- return Joiner.on(", ").join(selectElement);
- }
-
- @Override
- public R accept(SqlNodeVisitor visitor) throws AdapterException {
- return visitor.visit(this);
- }
-
-}
diff --git a/jdbc-adapter/virtualschema-common/src/main/java/com/exasol/adapter/sql/SqlSelectListType.java b/jdbc-adapter/virtualschema-common/src/main/java/com/exasol/adapter/sql/SqlSelectListType.java
deleted file mode 100644
index f3957f6f4..000000000
--- a/jdbc-adapter/virtualschema-common/src/main/java/com/exasol/adapter/sql/SqlSelectListType.java
+++ /dev/null
@@ -1,21 +0,0 @@
-package com.exasol.adapter.sql;
-
-/**
- * Specifies the type of a SelectList.
- */
-public enum SqlSelectListType {
- /**
- * The user requests all available columns, i.e. SELECT * FROM ...
- */
- SelectStar,
- /**
- * We just need one arbitrary value for each row. Example: If user
- * runs COUNT (*) and COUNT cannot be pushed down, we need to return any
- * value for each row (e.g. constant TRUE) and then EXASOL can do the COUNT.
- */
- AnyValue,
- /**
- * The user has to specify the desired elements.
- */
- Regular;
-}
diff --git a/jdbc-adapter/virtualschema-common/src/main/java/com/exasol/adapter/sql/SqlStatement.java b/jdbc-adapter/virtualschema-common/src/main/java/com/exasol/adapter/sql/SqlStatement.java
deleted file mode 100644
index f9356114a..000000000
--- a/jdbc-adapter/virtualschema-common/src/main/java/com/exasol/adapter/sql/SqlStatement.java
+++ /dev/null
@@ -1,9 +0,0 @@
-package com.exasol.adapter.sql;
-
-public abstract class SqlStatement extends SqlNode {
-
- public SqlStatement() {
-
- }
-
-}
diff --git a/jdbc-adapter/virtualschema-common/src/main/java/com/exasol/adapter/sql/SqlStatementSelect.java b/jdbc-adapter/virtualschema-common/src/main/java/com/exasol/adapter/sql/SqlStatementSelect.java
deleted file mode 100644
index c948d223e..000000000
--- a/jdbc-adapter/virtualschema-common/src/main/java/com/exasol/adapter/sql/SqlStatementSelect.java
+++ /dev/null
@@ -1,136 +0,0 @@
-package com.exasol.adapter.sql;
-
-import com.exasol.adapter.AdapterException;
-
-/**
- * We could consider to apply builder pattern here (if time)
- */
-public class SqlStatementSelect extends SqlStatement {
-
- private SqlNode fromClause;
- private SqlSelectList selectList;
- private SqlNode whereClause;
- private SqlExpressionList groupBy;
- private SqlNode having;
- private SqlOrderBy orderBy;
- private SqlLimit limit;
-
- public SqlStatementSelect(SqlNode fromClause, SqlSelectList selectList, SqlNode whereClause, SqlExpressionList groupBy, SqlNode having, SqlOrderBy orderBy, SqlLimit limit) {
- this.fromClause = fromClause;
- this.selectList = selectList;
- this.whereClause = whereClause;
- this.groupBy = groupBy;
- this.having = having;
- this.orderBy = orderBy;
- this.limit = limit;
- assert(this.fromClause != null);
- assert(this.selectList != null);
- this.fromClause.setParent(this);
- this.selectList.setParent(this);
-
- if (this.whereClause != null) {
- this.whereClause.setParent(this);
- }
- if (this.groupBy != null) {
- this.groupBy.setParent(this);
- }
- if (this.having != null) {
- this.having.setParent(this);
- }
- if (this.orderBy != null) {
- this.orderBy.setParent(this);
- }
- if (this.limit != null) {
- this.limit.setParent(this);
- }
- }
-
- public boolean hasProjection() {
- return selectList != null;
- }
-
- public boolean hasGroupBy() {
- return groupBy != null;
- }
-
- public boolean hasHaving() {
- return having != null;
- }
-
- public boolean hasFilter() {
- return whereClause != null;
- }
-
- public boolean hasOrderBy() {
- return orderBy != null;
- }
-
- public boolean hasLimit() {
- return limit != null;
- }
-
- public SqlNode getFromClause() {
- return fromClause;
- }
-
- public SqlSelectList getSelectList() {
- return selectList;
- }
-
- public SqlNode getWhereClause() {
- return whereClause;
- }
-
- public SqlExpressionList getGroupBy() {
- return groupBy;
- }
-
- public SqlNode getHaving() {
- return having;
- }
-
- public SqlOrderBy getOrderBy() {
- return orderBy;
- }
-
- public SqlLimit getLimit() {
- return limit;
- }
-
- @Override
- public String toSimpleSql() {
-
- StringBuilder sql = new StringBuilder();
- sql.append("SELECT ");
- sql.append(selectList.toSimpleSql());
- sql.append(" FROM ");
- sql.append(fromClause.toSimpleSql());
- if (hasFilter()) {
- sql.append(" WHERE " + whereClause.toSimpleSql());
- }
- if (hasGroupBy()) {
- sql.append(" GROUP BY " + groupBy.toSimpleSql());
- }
- if (hasHaving()) {
- sql.append(" HAVING " + having.toSimpleSql());
- }
- if (hasOrderBy()) {
- sql.append(" " + orderBy.toSimpleSql());
- }
- if (hasLimit()) {
- sql.append(" " + limit.toSimpleSql());
- }
- return sql.toString();
- }
-
- @Override
- public SqlNodeType getType() {
- return SqlNodeType.SELECT;
- }
-
- @Override
- public R accept(SqlNodeVisitor visitor) throws AdapterException {
- return visitor.visit(this);
- }
-
-}
diff --git a/jdbc-adapter/virtualschema-common/src/main/java/com/exasol/adapter/sql/SqlTable.java b/jdbc-adapter/virtualschema-common/src/main/java/com/exasol/adapter/sql/SqlTable.java
deleted file mode 100644
index b27082251..000000000
--- a/jdbc-adapter/virtualschema-common/src/main/java/com/exasol/adapter/sql/SqlTable.java
+++ /dev/null
@@ -1,55 +0,0 @@
-package com.exasol.adapter.sql;
-
-import com.exasol.adapter.AdapterException;
-import com.exasol.adapter.metadata.TableMetadata;
-
-public class SqlTable extends SqlNode {
-
- private String name;
- private String alias; // what is the exact semantic of this? Currently simply to generate a query with the expected alias.
- private TableMetadata metadata;
-
- public SqlTable(String name, TableMetadata metadata) {
- this.name = name;
- this.alias = name;
- this.metadata = metadata;
- }
-
- public SqlTable(String name, String alias, TableMetadata metadata) {
- this.name = name;
- this.alias = alias;
- this.metadata = metadata;
- }
-
- public boolean hasAlias() {
- return !name.equals(alias);
- }
-
- public String getName() {
- return name;
- }
-
- public String getAlias() {
- return alias;
- }
-
- public TableMetadata getMetadata() {
- return metadata;
- }
-
- @Override
- public String toSimpleSql() {
- return "\"" + name.replace("\"", "\"\"") + "\"";
- }
-
- @Override
- public SqlNodeType getType() {
- return SqlNodeType.TABLE;
- }
-
- @Override
- public R accept(SqlNodeVisitor visitor) throws AdapterException {
- return visitor.visit(this);
- }
-
-}
diff --git a/jdbc-adapter/virtualschema-common/src/main/java/com/exasol/adapter/sql/SqlUtils.java b/jdbc-adapter/virtualschema-common/src/main/java/com/exasol/adapter/sql/SqlUtils.java
deleted file mode 100644
index da987e5d4..000000000
--- a/jdbc-adapter/virtualschema-common/src/main/java/com/exasol/adapter/sql/SqlUtils.java
+++ /dev/null
@@ -1,20 +0,0 @@
-package com.exasol.adapter.sql;
-
-import java.util.Map;
-
-public class SqlUtils {
-
- public static String quoteIdentifierIfNeeded(String identifier, Map config) {
- String quoteChar = "\"";
- if (config.containsKey("QUOTE_CHAR")) {
- quoteChar = config.get("QUOTE_CHAR").toString();
- }
- if (identifier.toUpperCase().equals(identifier)) {
- // Only upper case, no need to quote
- return identifier;
- } else {
- return quoteChar + identifier + quoteChar;
- }
- }
-
-}
diff --git a/jdbc-adapter/virtualschema-common/src/main/java/com/exasol/utils/JsonHelper.java b/jdbc-adapter/virtualschema-common/src/main/java/com/exasol/utils/JsonHelper.java
deleted file mode 100644
index 577b05a55..000000000
--- a/jdbc-adapter/virtualschema-common/src/main/java/com/exasol/utils/JsonHelper.java
+++ /dev/null
@@ -1,52 +0,0 @@
-package com.exasol.utils;
-
-import java.io.PrintWriter;
-import java.io.StringReader;
-import java.io.StringWriter;
-import java.util.HashMap;
-import java.util.Map;
-
-import javax.json.Json;
-import javax.json.JsonBuilderFactory;
-import javax.json.JsonObject;
-import javax.json.JsonReader;
-import javax.json.JsonWriter;
-import javax.json.stream.JsonGenerator;
-
-/**
- * http://docs.oracle.com/javaee/7/api/javax/json/JsonObjectBuilder.html
- * http://docs.oracle.com/javaee/7/api/javax/json/stream/JsonGenerator.html
- */
-public class JsonHelper {
-
- public static JsonBuilderFactory getBuilderFactory() {
- Map config = new HashMap();
- return Json.createBuilderFactory(config);
- }
-
- public static JsonObject getJsonObject(String data) throws Exception {
- JsonReader jr = Json.createReader(new StringReader(data));
- JsonObject obj = jr.readObject();
- jr.close();
- return obj;
- }
-
- public static String getKeyAsString(JsonObject obj, String key, String defaultValue) {
- String value = defaultValue;
- if (obj.containsKey(key)) {
- value = obj.get(key).toString();
- }
- return value;
- }
-
- public static String prettyJson(JsonObject obj) {
- Map config = new HashMap();
- config.put(JsonGenerator.PRETTY_PRINTING, true);
- StringWriter strWriter = new StringWriter();
- PrintWriter pw = new PrintWriter(strWriter);
- JsonWriter jsonWriter = Json.createWriterFactory(config).createWriter(pw);
- jsonWriter.writeObject(obj);
- return strWriter.toString();
- }
-
-}
diff --git a/jdbc-adapter/virtualschema-common/src/main/java/com/exasol/utils/SqlTestUtil.java b/jdbc-adapter/virtualschema-common/src/main/java/com/exasol/utils/SqlTestUtil.java
deleted file mode 100644
index 0b7c9cf82..000000000
--- a/jdbc-adapter/virtualschema-common/src/main/java/com/exasol/utils/SqlTestUtil.java
+++ /dev/null
@@ -1,14 +0,0 @@
-package com.exasol.utils;
-
-public class SqlTestUtil {
-
- /**
- * Convert newlines, tabs, and double whitespaces to whitespaces. At the end only single whitespaces remain.
- */
- public static String normalizeSql(String sql) {
- return sql.replaceAll("\t", " ")
- .replaceAll("\n", " ")
- .replaceAll("\\s+", " ");
- }
-
-}
diff --git a/jdbc-adapter/virtualschema-common/src/test/java/com/exasol/adapter/capabilities/AggregateFunctionCapabilityTest.java b/jdbc-adapter/virtualschema-common/src/test/java/com/exasol/adapter/capabilities/AggregateFunctionCapabilityTest.java
deleted file mode 100644
index ca4222dad..000000000
--- a/jdbc-adapter/virtualschema-common/src/test/java/com/exasol/adapter/capabilities/AggregateFunctionCapabilityTest.java
+++ /dev/null
@@ -1,31 +0,0 @@
-package com.exasol.adapter.capabilities;
-
-import com.exasol.adapter.sql.AggregateFunction;
-import org.junit.Test;
-
-import static org.junit.Assert.*;
-
-public class AggregateFunctionCapabilityTest {
-
- @Test
- public void testCompleteness() {
- // Do we have functions where we don't have capabilities for?
- for (AggregateFunction func : AggregateFunction.values()) {
- boolean foundCap = false;
- for (AggregateFunctionCapability cap : AggregateFunctionCapability.values()) {
- if (cap.getFunction() == func) {
- foundCap = true;
- }
- }
- assertTrue("Did not find a capability for function " + func.name(), foundCap);
- }
- }
-
- @Test
- public void testConsistentNaming () {
- for (AggregateFunctionCapability cap : AggregateFunctionCapability.values()) {
- assertTrue(cap.name().startsWith(cap.getFunction().name()));
- }
- }
-
-}
\ No newline at end of file
diff --git a/jdbc-adapter/virtualschema-common/src/test/java/com/exasol/adapter/capabilities/PredicateCapabilityTest.java b/jdbc-adapter/virtualschema-common/src/test/java/com/exasol/adapter/capabilities/PredicateCapabilityTest.java
deleted file mode 100644
index 4b9f75640..000000000
--- a/jdbc-adapter/virtualschema-common/src/test/java/com/exasol/adapter/capabilities/PredicateCapabilityTest.java
+++ /dev/null
@@ -1,33 +0,0 @@
-package com.exasol.adapter.capabilities;
-
-import com.exasol.adapter.sql.AggregateFunction;
-import com.exasol.adapter.sql.Predicate;
-import org.junit.Test;
-
-import static org.junit.Assert.*;
-import static org.junit.Assert.assertTrue;
-
-public class PredicateCapabilityTest {
-
- @Test
- public void testCompleteness() {
- // Do we have predicates where we don't have capabilities for?
- for (Predicate pred : Predicate.values()) {
- boolean foundCap = false;
- for (PredicateCapability cap : PredicateCapability.values()) {
- if (cap.getPredicate() == pred) {
- foundCap = true;
- }
- }
- assertTrue("Did not find a capability for predicate " + pred.name(), foundCap);
- }
- }
-
- @Test
- public void testConsistentNaming () {
- for (PredicateCapability cap : PredicateCapability.values()) {
- assertTrue(cap.name().startsWith(cap.getPredicate().name()));
- }
- }
-
-}
\ No newline at end of file
diff --git a/jdbc-adapter/virtualschema-common/src/test/java/com/exasol/adapter/capabilities/ScalarFunctionCapabilityTest.java b/jdbc-adapter/virtualschema-common/src/test/java/com/exasol/adapter/capabilities/ScalarFunctionCapabilityTest.java
deleted file mode 100644
index 92bbdc855..000000000
--- a/jdbc-adapter/virtualschema-common/src/test/java/com/exasol/adapter/capabilities/ScalarFunctionCapabilityTest.java
+++ /dev/null
@@ -1,34 +0,0 @@
-package com.exasol.adapter.capabilities;
-
-import com.exasol.adapter.sql.AggregateFunction;
-import com.exasol.adapter.sql.Predicate;
-import com.exasol.adapter.sql.ScalarFunction;
-import org.junit.Test;
-
-import static org.junit.Assert.*;
-import static org.junit.Assert.assertTrue;
-
-public class ScalarFunctionCapabilityTest {
-
- @Test
- public void testCompleteness() {
- // Do we have functions where we don't have capabilities for?
- for (ScalarFunction function : ScalarFunction.values()) {
- boolean foundCap = false;
- for (ScalarFunctionCapability cap : ScalarFunctionCapability.values()) {
- if (cap.getFunction() == function) {
- foundCap = true;
- }
- }
- assertTrue("Did not find a capability for function " + function.name(), foundCap);
- }
- }
-
- @Test
- public void testConsistentNaming () {
- for (ScalarFunctionCapability cap : ScalarFunctionCapability.values()) {
- assertEquals(cap.name(), cap.getFunction().name());
- }
- }
-
-}
\ No newline at end of file
diff --git a/jdbc-adapter/virtualschema-common/src/test/java/com/exasol/adapter/json/RequestJsonParserTest.java b/jdbc-adapter/virtualschema-common/src/test/java/com/exasol/adapter/json/RequestJsonParserTest.java
deleted file mode 100644
index 4a5c762a7..000000000
--- a/jdbc-adapter/virtualschema-common/src/test/java/com/exasol/adapter/json/RequestJsonParserTest.java
+++ /dev/null
@@ -1,227 +0,0 @@
-package com.exasol.adapter.json;
-
-import static org.junit.Assert.assertTrue;
-
-import java.io.File;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import javax.json.JsonObject;
-import javax.json.JsonValue;
-
-import org.junit.Test;
-import org.mockito.internal.matchers.apachecommons.ReflectionEquals;
-
-import com.exasol.adapter.metadata.ColumnMetadata;
-import com.exasol.adapter.metadata.SchemaMetadataInfo;
-import com.exasol.adapter.metadata.DataType;
-import com.exasol.adapter.metadata.TableMetadata;
-import com.exasol.adapter.metadata.DataType.ExaCharset;
-import com.exasol.adapter.request.AdapterRequest;
-import com.exasol.adapter.request.PushdownRequest;
-import com.exasol.adapter.request.SetPropertiesRequest;
-import com.exasol.adapter.sql.JoinType;
-import com.exasol.adapter.sql.SqlJoin;
-import com.exasol.adapter.sql.SqlNode;
-import com.exasol.adapter.sql.SqlNodeType;
-import com.exasol.adapter.sql.SqlPredicate;
-import com.exasol.adapter.sql.SqlPredicateEqual;
-import com.exasol.adapter.sql.SqlStatementSelect;
-import com.exasol.utils.JsonHelper;
-import com.google.common.base.Charsets;
-import com.google.common.io.Files;
-
-public class RequestJsonParserTest {
-
- @Test
- public void testParsePushdownRequest() throws Exception {
- // test resources from src/test/resources are copied to target/test-classes, and this folder is the classpath of the junit test.
- String file = "target/test-classes/pushdown_request.json";
- String json = Files.toString(new File(file), Charsets.UTF_8);
-
- Map properties = new HashMap();
- properties.put("HIVE_SERVER", "my-hive-server");
- properties.put("HIVE_DB", "my-hive-db");
- properties.put("HIVE_USER", "my-hive-user");
- SchemaMetadataInfo expectedSchemaMetaInfo = new SchemaMetadataInfo(
- "MY_HIVE_VSCHEMA", "{\"lastRefreshed\":\"2015-03-01 12:10:01\",\"key\":\"Any custom schema state here\"}",
- properties);
-
- List expectedInvolvedTablesMetadata = new ArrayList<>();
- String tableName = "CLICKS";
- String tableAdapterNotes = "";
- List tableColumns = new ArrayList<>();
- tableColumns.add(new ColumnMetadata("ID", "", DataType.createDecimal(22, 0), true, false, "", ""));
- tableColumns.add(new ColumnMetadata("USER_ID", "", DataType.createDecimal(18, 0), true, false, "", ""));
- tableColumns.add(new ColumnMetadata("URL", "", DataType.createVarChar(1000, ExaCharset.UTF8), true, false, "", ""));
- tableColumns.add(new ColumnMetadata("REQUEST_TIME", "", DataType.createTimestamp(false), true, false, "", ""));
- String tableComment = "";
- expectedInvolvedTablesMetadata.add(new TableMetadata(tableName, tableAdapterNotes, tableColumns, tableComment));
-
- RequestJsonParser parser = new RequestJsonParser();
- AdapterRequest request = parser.parseRequest(json);
- assertObjectEquals(expectedSchemaMetaInfo, request.getSchemaMetadataInfo());
- assertObjectEquals(expectedInvolvedTablesMetadata, ((PushdownRequest)request).getInvolvedTablesMetadata());
- }
-
- @Test
- public void testParsePushdownRequestAllTypes() throws Exception {
- String file = "target/test-classes/pushdown_request_alltypes.json";
- String json = Files.toString(new File(file), Charsets.UTF_8);
-
- Map properties = new HashMap();
- SchemaMetadataInfo expectedSchemaMetaInfo = new SchemaMetadataInfo("VS", "", properties);
-
- List expectedInvolvedTablesMetadata = new ArrayList<>();
- String tableName = "T1";
- String tableAdapterNotes = "";
- String tableComment = "";
- List tableColumns = new ArrayList<>();
- tableColumns.add(new ColumnMetadata("C_DECIMAL", "", DataType.createDecimal(18, 2), true, false, "", ""));
- tableColumns.add(new ColumnMetadata("C_DOUBLE", "", DataType.createDouble(), true, false, "", ""));
- tableColumns.add(new ColumnMetadata("C_VARCHAR_UTF8_1", "", DataType.createVarChar(10000, ExaCharset.UTF8), true, false, "", ""));
- tableColumns.add(new ColumnMetadata("C_VARCHAR_UTF8_2", "", DataType.createVarChar(10000, ExaCharset.UTF8), true, false, "", ""));
- tableColumns.add(new ColumnMetadata("C_VARCHAR_ASCII", "", DataType.createVarChar(10000, ExaCharset.ASCII), true, false, "", ""));
- tableColumns.add(new ColumnMetadata("C_CHAR_UTF8_1", "", DataType.createChar(3, ExaCharset.UTF8), true, false, "", ""));
- tableColumns.add(new ColumnMetadata("C_CHAR_UTF8_2", "", DataType.createChar(3, ExaCharset.UTF8), true, false, "", ""));
- tableColumns.add(new ColumnMetadata("C_CHAR_ASCII", "", DataType.createChar(3, ExaCharset.ASCII), true, false, "", ""));
- tableColumns.add(new ColumnMetadata("C_DATE", "", DataType.createDate(), true, false, "", ""));
- tableColumns.add(new ColumnMetadata("C_TIMESTAMP_1", "", DataType.createTimestamp(false), true, false, "", ""));
- tableColumns.add(new ColumnMetadata("C_TIMESTAMP_2", "", DataType.createTimestamp(false), true, false, "", ""));
- tableColumns.add(new ColumnMetadata("C_TIMESTAMP_3", "", DataType.createTimestamp(true), true, false, "", ""));
- tableColumns.add(new ColumnMetadata("C_BOOLEAN", "", DataType.createBool(), true, false, "", ""));
- tableColumns.add(new ColumnMetadata("C_GEOMETRY", "", DataType.createGeometry(1), true, false, "", ""));
- tableColumns.add(new ColumnMetadata("C_INTERVAL_DS_1", "", DataType.createIntervalDaySecond(2, 3), true, false, "", ""));
- tableColumns.add(new ColumnMetadata("C_INTERVAL_DS_2", "", DataType.createIntervalDaySecond(3, 4), true, false, "", ""));
- tableColumns.add(new ColumnMetadata("C_INTERVAL_YM_1", "", DataType.createIntervalYearMonth(2), true, false, "", ""));
- tableColumns.add(new ColumnMetadata("C_INTERVAL_YM_2", "", DataType.createIntervalYearMonth(3), true, false, "", ""));
- expectedInvolvedTablesMetadata.add(new TableMetadata(tableName, tableAdapterNotes, tableColumns, tableComment));
-
- RequestJsonParser parser = new RequestJsonParser();
- AdapterRequest request = parser.parseRequest(json);
- assertObjectEquals(expectedSchemaMetaInfo, request.getSchemaMetadataInfo());
- assertObjectEquals(expectedInvolvedTablesMetadata, ((PushdownRequest)request).getInvolvedTablesMetadata());
- }
-
- @Test
- public void testParseSetPropertiesRequest() throws Exception {
- String file = "target/test-classes/set_properties_request.json";
- String json = Files.toString(new File(file), Charsets.UTF_8);
-
- Map expectedOldSchemaProperties = new HashMap();
- expectedOldSchemaProperties.put("EXISTING_PROP_1", "Old Value 1");
- expectedOldSchemaProperties.put("EXISTING_PROP_2", "Old Value 2");
- SchemaMetadataInfo expectedSchemaMetaInfo = new SchemaMetadataInfo("VS", "", expectedOldSchemaProperties);
-
- Map expectedNewProperties = new HashMap();
- expectedNewProperties.put("EXISTING_PROP_1", "New Value");
- expectedNewProperties.put("EXISTING_PROP_2", null);
- expectedNewProperties.put("NEW_PROP", "VAL2");
- expectedNewProperties.put("DELETED_PROP_NON_EXISTING", null);
-
- RequestJsonParser parser = new RequestJsonParser();
- AdapterRequest request = parser.parseRequest(json);
- assertObjectEquals(expectedSchemaMetaInfo, request.getSchemaMetadataInfo());
- assertObjectEquals(expectedNewProperties, ((SetPropertiesRequest)request).getProperties());
- }
-
- @Test
- public void testSimpleInnerJoinRequest() throws Exception {
- String req =
- "{"+
- "\"involvedTables\" :" +
- " [" +
- " {" +
- " \"columns\" :" +
- " [" +
- " {" +
- " \"dataType\" :" +
- " {" +
- " \"precision\" : 18," +
- " \"scale\" : 0," +
- " \"type\" : \"DECIMAL\"" +
- " }," +
- " \"name\" : \"ID\"" +
- " }" +
- " ]," +
- " \"name\" : \"T1\"" +
- " }," +
- " {" +
- " \"columns\" :" +
- " [" +
- " {" +
- " \"dataType\" :" +
- " {" +
- " \"precision\" : 18," +
- " \"scale\" : 0," +
- " \"type\" : \"DECIMAL\"" +
- " }," +
- " \"name\" : \"ID\"" +
- " }" +
- " ]," +
- " \"name\" : \"T2\"" +
- " }" +
- " ]," +
- " \"pushdownRequest\" : " +
- " {" +
- " \"type\" : \"select\"," +
- " \"from\" : " +
- " {" +
- " \"type\": \"join\"," +
- " \"join_type\": \"inner\"," +
- " \"left\":" +
- " {" +
- " \"name\" : \"T1\"," +
- " \"type\" : \"table\"" +
- " }," +
- " \"right\":" +
- " {" +
- " \"name\" : \"T2\"," +
- " \"type\" : \"table\"" +
- " }," +
- " \"condition\":" +
- " {" +
- " \"left\" :" +
- " {" +
- " \"columnNr\" : 0," +
- " \"name\" : \"ID\"," +
- " \"tableName\" : \"T1\"," +
- " \"type\" : \"column\"" +
- " }," +
- " \"right\" :" +
- " {" +
- " \"columnNr\" : 0," +
- " \"name\" : \"ID\"," +
- " \"tableName\" : \"T2\"," +
- " \"type\" : \"column\"" +
- " }," +
- " \"type\" : \"predicate_equal\"" +
- " }" +
- " }" +
- " }," +
- " \"type\" : \"pushdown\"" +
- "}";
-
- RequestJsonParser parser = new RequestJsonParser();
- AdapterRequest request = parser.parseRequest(req);
- PushdownRequest pushdown = (PushdownRequest) request;
-
- SqlStatementSelect select = (SqlStatementSelect) pushdown.getSelect();
- SqlJoin from = (SqlJoin) select.getFromClause();
-
- assertTrue(from.getType() == SqlNodeType.JOIN);
- assertTrue(from.getJoinType() == JoinType.INNER);
- assertTrue(from.getCondition().getType() == SqlNodeType.PREDICATE_EQUAL);
- assertTrue(from.getLeft().getType() == SqlNodeType.TABLE);
- assertTrue(from.getRight().getType() == SqlNodeType.TABLE);
- }
-
- /**
- * Without this method we would need to override equals() and .hashcode() for each object, which explodes code and makes it less maintainable
- */
- public void assertObjectEquals(final T expected, final T actual) {
- assertTrue("Expected:\n" + expected + "\nactual:\n" + actual, new ReflectionEquals(actual, (String[])null).matches(expected));
- }
-}
diff --git a/jdbc-adapter/virtualschema-common/src/test/java/com/exasol/adapter/sql/SqlNodeTest.java b/jdbc-adapter/virtualschema-common/src/test/java/com/exasol/adapter/sql/SqlNodeTest.java
deleted file mode 100644
index 35bcae315..000000000
--- a/jdbc-adapter/virtualschema-common/src/test/java/com/exasol/adapter/sql/SqlNodeTest.java
+++ /dev/null
@@ -1,61 +0,0 @@
-package com.exasol.adapter.sql;
-
-import com.exasol.adapter.metadata.ColumnMetadata;
-import com.exasol.adapter.metadata.DataType;
-import com.exasol.adapter.metadata.DataType.ExaCharset;
-import com.exasol.adapter.metadata.MetadataException;
-import com.exasol.adapter.metadata.TableMetadata;
-import com.exasol.utils.SqlTestUtil;
-import com.google.common.collect.ImmutableList;
-import org.junit.Test;
-
-import java.math.BigDecimal;
-import java.util.ArrayList;
-import java.util.List;
-
-import static org.junit.Assert.assertEquals;
-
-public class SqlNodeTest {
-
- @Test
- public void testToSimpleSql() throws MetadataException {
- SqlNode node = getTestSqlNode();
- String expectedSql = "SELECT \"USER_ID\", COUNT(\"URL\") FROM \"CLICKS\"" +
- " WHERE 1 < \"USER_ID\"" +
- " GROUP BY \"USER_ID\"" +
- " HAVING 1 < COUNT(\"URL\")" +
- " ORDER BY \"USER_ID\"" +
- " LIMIT 10";
- String actualSql = node.toSimpleSql();
- assertEquals(SqlTestUtil.normalizeSql(expectedSql), SqlTestUtil.normalizeSql(actualSql));
- }
-
- private SqlNode getTestSqlNode() throws MetadataException {
- // SELECT USER_ID, count(URL) FROM CLICKS
- // WHERE 1 < USER_ID
- // GROUP BY USER_ID
- // HAVING 1 < COUNT(URL)
- // ORDER BY USER_ID
- // LIMIT 10;
- TableMetadata clicksMeta = getClicksTableMetadata();
- SqlTable fromClause = new SqlTable("CLICKS", clicksMeta);
- SqlSelectList selectList = SqlSelectList.createRegularSelectList(ImmutableList.of(
- new SqlColumn(0, clicksMeta.getColumns().get(0)),
- new SqlFunctionAggregate(AggregateFunction.COUNT, ImmutableList.of(new SqlColumn(1, clicksMeta.getColumns().get(1))), false)));
- SqlNode whereClause = new SqlPredicateLess(new SqlLiteralExactnumeric(BigDecimal.ONE), new SqlColumn(0, clicksMeta.getColumns().get(0)));
- SqlExpressionList groupBy = new SqlGroupBy(ImmutableList.of(new SqlColumn(0, clicksMeta.getColumns().get(0))));
- SqlNode countUrl = new SqlFunctionAggregate(AggregateFunction.COUNT, ImmutableList.of(new SqlColumn(1, clicksMeta.getColumns().get(1))), false);
- SqlNode having = new SqlPredicateLess(new SqlLiteralExactnumeric(BigDecimal.ONE), countUrl);
- SqlOrderBy orderBy = new SqlOrderBy(ImmutableList.of(new SqlColumn(0, clicksMeta.getColumns().get(0))), ImmutableList.of(true), ImmutableList.of(true));
- SqlLimit limit = new SqlLimit(10);
- return new SqlStatementSelect(fromClause, selectList, whereClause, groupBy, having, orderBy, limit);
- }
-
- private TableMetadata getClicksTableMetadata() throws MetadataException {
- List columns = new ArrayList<>();
- columns.add(new ColumnMetadata("USER_ID", "", DataType.createDecimal(18, 0), true, false, "", ""));
- columns.add(new ColumnMetadata("URL", "", DataType.createVarChar(10000, ExaCharset.UTF8), true, false, "", ""));
- return new TableMetadata("CLICKS", "", columns, "");
- }
-
-}
diff --git a/jdbc-adapter/virtualschema-common/src/test/resources/pushdown_request.json b/jdbc-adapter/virtualschema-common/src/test/resources/pushdown_request.json
deleted file mode 100644
index 19a5b664d..000000000
--- a/jdbc-adapter/virtualschema-common/src/test/resources/pushdown_request.json
+++ /dev/null
@@ -1,154 +0,0 @@
-{
- "type": "pushdown",
- "pushdownRequest": {
- "type" : "select",
- "aggregationType" : "group_by",
- "from" :
- {
- "type" : "table",
- "name" : "CLICKS"
- },
- "selectList" :
- [
- {
- "type" : "column",
- "name" : "USER_ID",
- "columnNr" : 1,
- "tableName" : "CLICKS"
- },
- {
- "type" : "function_aggregate",
- "name" : "count",
- "arguments" :
- [
- {
- "type" : "column",
- "name" : "URL",
- "columnNr" : 2,
- "tableName" : "CLICKS"
- }
- ]
- }
- ],
- "filter" :
- {
- "type" : "predicate_less",
- "left" :
- {
- "type" : "literal_exactnumeric",
- "value" : "1"
- },
- "right" :
- {
- "type" : "column",
- "name" : "USER_ID",
- "columnNr" : 1,
- "tableName" : "CLICKS"
- }
- },
- "groupBy" :
- [
- {
- "type" : "column",
- "name" : "USER_ID",
- "columnNr" : 1,
- "tableName" : "CLICKS"
- }
- ],
- "having" :
- {
- "type" : "predicate_less",
- "left" :
- {
- "type" : "literal_exactnumeric",
- "value" : "1"
- },
- "right" :
- {
- "type" : "function_aggregate",
- "name" : "count",
- "arguments" :
- [
- {
- "type" : "column",
- "name" : "URL",
- "columnNr" : 2,
- "tableName" : "CLICKS"
- }
- ]
- }
- },
- "orderBy" :
- [
- {
- "type" : "order_by_element",
- "expression" :
- {
- "columnNr" : 1,
- "name" : "USER_ID",
- "tableName" : "CLICKS",
- "type" : "column"
- },
- "isAscending" : true,
- "nullsLast" : true
- }
- ],
- "limit" :
- {
- "numElements" : 10
- }
- },
- "involvedTables": [
- {
- "name" : "CLICKS",
- "columns" :
- [
- {
- "name" : "ID",
- "dataType" :
- {
- "precision" : 22,
- "scale" : 0,
- "type" : "DECIMAL"
- }
- },
- {
- "name" : "USER_ID",
- "dataType" :
- {
- "precision" : 18,
- "scale" : 0,
- "type" : "DECIMAL"
- }
- },
- {
- "name" : "URL",
- "dataType" :
- {
- "size" : 1000,
- "type" : "VARCHAR"
- }
- },
- {
- "name" : "REQUEST_TIME",
- "dataType" :
- {
- "type" : "TIMESTAMP"
- }
- }
- ]
- }
- ],
- "schemaMetadataInfo": {
- "name": "MY_HIVE_VSCHEMA",
- "adapterNotes": {
- "lastRefreshed": "2015-03-01 12:10:01",
- "key": "Any custom schema state here"
- },
- "properties": {
- "HIVE_SERVER": "my-hive-server",
- "HIVE_DB": "my-hive-db",
- "HIVE_USER": "my-hive-user"
- }
- }
-}
diff --git a/jdbc-adapter/virtualschema-common/src/test/resources/pushdown_request_alltypes.json b/jdbc-adapter/virtualschema-common/src/test/resources/pushdown_request_alltypes.json
deleted file mode 100644
index 2c146e9e1..000000000
--- a/jdbc-adapter/virtualschema-common/src/test/resources/pushdown_request_alltypes.json
+++ /dev/null
@@ -1,154 +0,0 @@
-{
- "type": "pushdown",
- "pushdownRequest": {
- "type" : "select",
- "from" :
- {
- "type" : "table",
- "name" : "T1"
- }
- },
- "involvedTables": [
- {
- "name": "T1",
- "columns": [
- {
- "name": "C_DECIMAL",
- "dataType": {
- "type": "DECIMAL",
- "precision": 18,
- "scale": 2
- }
- },
- {
- "name": "C_DOUBLE",
- "dataType": {
- "type": "DOUBLE"
- }
- },
- {
- "name": "C_VARCHAR_UTF8_1",
- "dataType": {
- "type": "VARCHAR",
- "size": 10000,
- "characterSet": "UTF8"
- }
- },
- {
- "name": "C_VARCHAR_UTF8_2",
- "dataType": {
- "type": "VARCHAR",
- "size": 10000
- }
- },
- {
- "name": "C_VARCHAR_ASCII",
- "dataType": {
- "type": "VARCHAR",
- "size": 10000,
- "characterSet": "ASCII"
- }
- },
- {
- "name": "C_CHAR_UTF8_1",
- "dataType": {
- "type": "CHAR",
- "size": 3
- }
- },
- {
- "name": "C_CHAR_UTF8_2",
- "dataType": {
- "type": "CHAR",
- "size": 3,
- "characterSet": "UTF8"
- }
- },
- {
- "name": "C_CHAR_ASCII",
- "dataType": {
- "type": "CHAR",
- "size": 3,
- "characterSet": "ASCII"
- }
- },
- {
- "name": "C_DATE",
- "dataType": {
- "type": "DATE"
- }
- },
- {
- "name": "C_TIMESTAMP_1",
- "dataType": {
- "type": "TIMESTAMP"
- }
- },
- {
- "name": "C_TIMESTAMP_2",
- "dataType": {
- "type": "TIMESTAMP",
- "withLocalTimeZone": false
- }
- },
- {
- "name": "C_TIMESTAMP_3",
- "dataType": {
- "type": "TIMESTAMP",
- "withLocalTimeZone": true
- }
- },
- {
- "name": "C_BOOLEAN",
- "dataType": {
- "type": "BOOLEAN"
- }
- },
- {
- "name": "C_GEOMETRY",
- "dataType": {
- "type": "GEOMETRY",
- "srid": 1
- }
- },
- {
- "name": "C_INTERVAL_DS_1",
- "dataType": {
- "type": "INTERVAL",
- "fromTo": "DAY TO SECONDS"
- }
- },
- {
- "name": "C_INTERVAL_DS_2",
- "dataType": {
- "type": "INTERVAL",
- "fromTo": "DAY TO SECONDS",
- "precision": 3,
- "fraction": 4
- }
- },
- {
- "name": "C_INTERVAL_YM_1",
- "dataType": {
- "type": "INTERVAL",
- "fromTo": "YEAR TO MONTH"
- }
- },
- {
- "name": "C_INTERVAL_YM_2",
- "dataType": {
- "type": "INTERVAL",
- "fromTo": "YEAR TO MONTH",
- "precision": 3
- }
- }
- ]
- }
- ],
- "schemaMetadataInfo": {
- "name": "VS",
- "adapterNotes": "",
- "properties": {
- }
- }
-}
diff --git a/jdbc-adapter/virtualschema-common/src/test/resources/set_properties_request.json b/jdbc-adapter/virtualschema-common/src/test/resources/set_properties_request.json
deleted file mode 100644
index 243fed96a..000000000
--- a/jdbc-adapter/virtualschema-common/src/test/resources/set_properties_request.json
+++ /dev/null
@@ -1,16 +0,0 @@
-{
- "properties": {
- "EXISTING_PROP_1": "New Value",
- "EXISTING_PROP_2": null,
- "NEW_PROP": "VAL2",
- "DELETED_PROP_NON_EXISTING": null
- },
- "type": "setProperties",
- "schemaMetadataInfo": {
- "name": "VS",
- "properties": {
- "EXISTING_PROP_1": "Old Value 1",
- "EXISTING_PROP_2": "Old Value 2"
- }
- }
-}
diff --git a/jdbc-adapter/virtualschema-jdbc-adapter-dist/pom.xml b/jdbc-adapter/virtualschema-jdbc-adapter-dist/pom.xml
index 9190e5df0..4cc1a2759 100644
--- a/jdbc-adapter/virtualschema-jdbc-adapter-dist/pom.xml
+++ b/jdbc-adapter/virtualschema-jdbc-adapter-dist/pom.xml
@@ -20,8 +20,8 @@
com.exasol
- virtualschema-common
- ${product.version}
+ virtual-schema-common-java
+ 1.0.2
com.exasol
diff --git a/jdbc-adapter/virtualschema-jdbc-adapter/pom.xml b/jdbc-adapter/virtualschema-jdbc-adapter/pom.xml
index 2206bae1f..986c73624 100644
--- a/jdbc-adapter/virtualschema-jdbc-adapter/pom.xml
+++ b/jdbc-adapter/virtualschema-jdbc-adapter/pom.xml
@@ -92,11 +92,11 @@
-
- com.exasol
- virtualschema-common
- ${product.version}
-
+
+ com.exasol
+ virtual-schema-common-java
+ 1.1.1
+
org.yaml
diff --git a/jdbc-adapter/virtualschema-jdbc-adapter/src/main/java/com/exasol/adapter/dialects/AbstractSqlDialect.java b/jdbc-adapter/virtualschema-jdbc-adapter/src/main/java/com/exasol/adapter/dialects/AbstractSqlDialect.java
index 39c8497a5..a46e45289 100644
--- a/jdbc-adapter/virtualschema-jdbc-adapter/src/main/java/com/exasol/adapter/dialects/AbstractSqlDialect.java
+++ b/jdbc-adapter/virtualschema-jdbc-adapter/src/main/java/com/exasol/adapter/dialects/AbstractSqlDialect.java
@@ -118,43 +118,43 @@ private static DataType getExaTypeFromJdbcType(final JdbcTypeDescription jdbcTyp
switch (jdbcTypeDescription.getJdbcType()) {
case Types.TINYINT:
case Types.SMALLINT:
- if (jdbcTypeDescription.getPrecisionOrSize() <= DataType.maxExasolDecimalPrecision) {
+ if (jdbcTypeDescription.getPrecisionOrSize() <= DataType.MAX_EXASOL_DECIMAL_PRECISION) {
final int precision = jdbcTypeDescription.getPrecisionOrSize() == 0 ? 9
: jdbcTypeDescription.getPrecisionOrSize();
colType = DataType.createDecimal(precision, 0);
} else {
- colType = DataType.createVarChar(DataType.maxExasolVarcharSize, DataType.ExaCharset.UTF8);
+ colType = DataType.createVarChar(DataType.MAX_EXASOL_VARCHAR_SIZE, DataType.ExaCharset.UTF8);
}
break;
case Types.INTEGER:
- if (jdbcTypeDescription.getPrecisionOrSize() <= DataType.maxExasolDecimalPrecision) {
+ if (jdbcTypeDescription.getPrecisionOrSize() <= DataType.MAX_EXASOL_DECIMAL_PRECISION) {
final int precision = jdbcTypeDescription.getPrecisionOrSize() == 0 ? 18
: jdbcTypeDescription.getPrecisionOrSize();
colType = DataType.createDecimal(precision, 0);
} else {
- colType = DataType.createVarChar(DataType.maxExasolVarcharSize, DataType.ExaCharset.UTF8);
+ colType = DataType.createVarChar(DataType.MAX_EXASOL_VARCHAR_SIZE, DataType.ExaCharset.UTF8);
}
break;
case Types.BIGINT: // Java type long
- if (jdbcTypeDescription.getPrecisionOrSize() <= DataType.maxExasolDecimalPrecision) {
+ if (jdbcTypeDescription.getPrecisionOrSize() <= DataType.MAX_EXASOL_DECIMAL_PRECISION) {
final int precision = jdbcTypeDescription.getPrecisionOrSize() == 0 ? 36
: jdbcTypeDescription.getPrecisionOrSize();
colType = DataType.createDecimal(precision, 0);
} else {
- colType = DataType.createVarChar(DataType.maxExasolVarcharSize, DataType.ExaCharset.UTF8);
+ colType = DataType.createVarChar(DataType.MAX_EXASOL_VARCHAR_SIZE, DataType.ExaCharset.UTF8);
}
break;
case Types.DECIMAL:
- if (jdbcTypeDescription.getPrecisionOrSize() <= DataType.maxExasolDecimalPrecision) {
+ if (jdbcTypeDescription.getPrecisionOrSize() <= DataType.MAX_EXASOL_DECIMAL_PRECISION) {
colType = DataType.createDecimal(jdbcTypeDescription.getPrecisionOrSize(),
jdbcTypeDescription.getDecimalScale());
} else {
- colType = DataType.createVarChar(DataType.maxExasolVarcharSize, DataType.ExaCharset.UTF8);
+ colType = DataType.createVarChar(DataType.MAX_EXASOL_VARCHAR_SIZE, DataType.ExaCharset.UTF8);
}
break;
case Types.NUMERIC: // Java BigInteger
- colType = DataType.createVarChar(DataType.maxExasolVarcharSize, DataType.ExaCharset.UTF8);
+ colType = DataType.createVarChar(DataType.MAX_EXASOL_VARCHAR_SIZE, DataType.ExaCharset.UTF8);
break;
case Types.REAL:
case Types.FLOAT:
@@ -167,12 +167,12 @@ private static DataType getExaTypeFromJdbcType(final JdbcTypeDescription jdbcTyp
case Types.LONGNVARCHAR: {
final DataType.ExaCharset charset = (jdbcTypeDescription.getCharOctedLength() == jdbcTypeDescription
.getPrecisionOrSize()) ? DataType.ExaCharset.ASCII : DataType.ExaCharset.UTF8;
- if (jdbcTypeDescription.getPrecisionOrSize() <= DataType.maxExasolVarcharSize) {
- final int precision = jdbcTypeDescription.getPrecisionOrSize() == 0 ? DataType.maxExasolVarcharSize
+ if (jdbcTypeDescription.getPrecisionOrSize() <= DataType.MAX_EXASOL_VARCHAR_SIZE) {
+ final int precision = jdbcTypeDescription.getPrecisionOrSize() == 0 ? DataType.MAX_EXASOL_VARCHAR_SIZE
: jdbcTypeDescription.getPrecisionOrSize();
colType = DataType.createVarChar(precision, charset);
} else {
- colType = DataType.createVarChar(DataType.maxExasolVarcharSize, charset);
+ colType = DataType.createVarChar(DataType.MAX_EXASOL_VARCHAR_SIZE, charset);
}
break;
}
@@ -180,13 +180,13 @@ private static DataType getExaTypeFromJdbcType(final JdbcTypeDescription jdbcTyp
case Types.NCHAR: {
final DataType.ExaCharset charset = (jdbcTypeDescription.getCharOctedLength() == jdbcTypeDescription
.getPrecisionOrSize()) ? DataType.ExaCharset.ASCII : DataType.ExaCharset.UTF8;
- if (jdbcTypeDescription.getPrecisionOrSize() <= DataType.maxExasolCharSize) {
+ if (jdbcTypeDescription.getPrecisionOrSize() <= DataType.MAX_EXASOL_CHAR_SIZE) {
colType = DataType.createChar(jdbcTypeDescription.getPrecisionOrSize(), charset);
} else {
- if (jdbcTypeDescription.getPrecisionOrSize() <= DataType.maxExasolVarcharSize) {
+ if (jdbcTypeDescription.getPrecisionOrSize() <= DataType.MAX_EXASOL_VARCHAR_SIZE) {
colType = DataType.createVarChar(jdbcTypeDescription.getPrecisionOrSize(), charset);
} else {
- colType = DataType.createVarChar(DataType.maxExasolVarcharSize, charset);
+ colType = DataType.createVarChar(DataType.MAX_EXASOL_VARCHAR_SIZE, charset);
}
}
break;
@@ -198,7 +198,7 @@ private static DataType getExaTypeFromJdbcType(final JdbcTypeDescription jdbcTyp
colType = DataType.createTimestamp(false);
break;
case Types.TIME:
- colType = DataType.createVarChar(DataType.maxExasolVarcharSize, DataType.ExaCharset.UTF8);
+ colType = DataType.createVarChar(DataType.MAX_EXASOL_VARCHAR_SIZE, DataType.ExaCharset.UTF8);
break;
case Types.BIT:
case Types.BOOLEAN:
@@ -210,7 +210,7 @@ private static DataType getExaTypeFromJdbcType(final JdbcTypeDescription jdbcTyp
case Types.BLOB:
case Types.CLOB:
case Types.NCLOB:
- colType = DataType.createVarChar(DataType.maxExasolVarcharSize, DataType.ExaCharset.UTF8);
+ colType = DataType.createVarChar(DataType.MAX_EXASOL_VARCHAR_SIZE, DataType.ExaCharset.UTF8);
break;
case Types.OTHER:
case Types.JAVA_OBJECT:
diff --git a/jdbc-adapter/virtualschema-jdbc-adapter/src/main/java/com/exasol/adapter/dialects/SqlGenerationVisitor.java b/jdbc-adapter/virtualschema-jdbc-adapter/src/main/java/com/exasol/adapter/dialects/SqlGenerationVisitor.java
index bc3c0f761..0250fe156 100644
--- a/jdbc-adapter/virtualschema-jdbc-adapter/src/main/java/com/exasol/adapter/dialects/SqlGenerationVisitor.java
+++ b/jdbc-adapter/virtualschema-jdbc-adapter/src/main/java/com/exasol/adapter/dialects/SqlGenerationVisitor.java
@@ -150,8 +150,12 @@ public String visit(final SqlSelectList selectList) throws AdapterException {
public String visit(final SqlColumn column) throws AdapterException {
String tablePrefix = "";
if (this.context.hasMoreThanOneTable()) {
- tablePrefix = this.dialect.applyQuoteIfNeeded(column.getTableName())
- + this.dialect.getTableCatalogAndSchemaSeparator();
+ if (column.hasTableAlias()) {
+ tablePrefix = this.dialect.applyQuoteIfNeeded(column.getTableAlias());
+ } else {
+ tablePrefix = this.dialect.applyQuoteIfNeeded(column.getTableName());
+ }
+ tablePrefix = tablePrefix + this.dialect.getTableCatalogAndSchemaSeparator();
}
return tablePrefix + this.dialect.applyQuoteIfNeeded(column.getName());
}
@@ -169,7 +173,12 @@ public String visit(final SqlTable table) {
schemaPrefix += this.dialect.applyQuoteIfNeeded(this.context.getSchemaName())
+ this.dialect.getTableCatalogAndSchemaSeparator();
}
- return schemaPrefix + this.dialect.applyQuoteIfNeeded(table.getName());
+ if (table.hasAlias()) {
+ return schemaPrefix + this.dialect.applyQuoteIfNeeded(table.getName())
+ + " " + this.dialect.applyQuoteIfNeeded(table.getAlias());
+ } else {
+ return schemaPrefix + this.dialect.applyQuoteIfNeeded(table.getName());
+ }
}
@Override
diff --git a/jdbc-adapter/virtualschema-jdbc-adapter/src/main/java/com/exasol/adapter/dialects/impl/DB2SqlDialect.java b/jdbc-adapter/virtualschema-jdbc-adapter/src/main/java/com/exasol/adapter/dialects/impl/DB2SqlDialect.java
index a36252939..07e7de4df 100644
--- a/jdbc-adapter/virtualschema-jdbc-adapter/src/main/java/com/exasol/adapter/dialects/impl/DB2SqlDialect.java
+++ b/jdbc-adapter/virtualschema-jdbc-adapter/src/main/java/com/exasol/adapter/dialects/impl/DB2SqlDialect.java
@@ -347,10 +347,10 @@ public DataType dialectSpecificMapJdbcType(final JdbcTypeDescription jdbcTypeDes
switch (jdbcType) {
case Types.CLOB:
- colType = DataType.createVarChar(DataType.maxExasolVarcharSize, DataType.ExaCharset.UTF8);
+ colType = DataType.createVarChar(DataType.MAX_EXASOL_VARCHAR_SIZE, DataType.ExaCharset.UTF8);
break;
case 1111:
- colType = DataType.createVarChar(DataType.maxExasolVarcharSize, DataType.ExaCharset.UTF8);
+ colType = DataType.createVarChar(DataType.MAX_EXASOL_VARCHAR_SIZE, DataType.ExaCharset.UTF8);
break;
// set timestamp to varchar as db2 offers a much higher precision than exasol
// however java timestamp only supports nanoseconds -> varchar(32)
@@ -368,10 +368,10 @@ public DataType dialectSpecificMapJdbcType(final JdbcTypeDescription jdbcTypeDes
case Types.LONGNVARCHAR: {
final int size = jdbcTypeDescription.getPrecisionOrSize();
final DataType.ExaCharset charset = DataType.ExaCharset.UTF8;
- if (size <= DataType.maxExasolVarcharSize) {
+ if (size <= DataType.MAX_EXASOL_VARCHAR_SIZE) {
colType = DataType.createVarChar(size, charset);
} else {
- colType = DataType.createVarChar(DataType.maxExasolVarcharSize, charset);
+ colType = DataType.createVarChar(DataType.MAX_EXASOL_VARCHAR_SIZE, charset);
}
break;
}
diff --git a/jdbc-adapter/virtualschema-jdbc-adapter/src/main/java/com/exasol/adapter/dialects/impl/OracleSqlDialect.java b/jdbc-adapter/virtualschema-jdbc-adapter/src/main/java/com/exasol/adapter/dialects/impl/OracleSqlDialect.java
index 1e0f909f0..91c223d2d 100644
--- a/jdbc-adapter/virtualschema-jdbc-adapter/src/main/java/com/exasol/adapter/dialects/impl/OracleSqlDialect.java
+++ b/jdbc-adapter/virtualschema-jdbc-adapter/src/main/java/com/exasol/adapter/dialects/impl/OracleSqlDialect.java
@@ -359,34 +359,34 @@ public DataType dialectSpecificMapJdbcType(final JdbcTypeDescription jdbcTypeDes
// without scale and precision. Convert to VARCHAR.
// See http://docs.oracle.com/cd/B28359_01/server.111/b28318/datatype.htm#i16209
// and https://docs.oracle.com/cd/E19501-01/819-3659/gcmaz/
- colType = DataType.createVarChar(DataType.maxExasolVarcharSize, DataType.ExaCharset.UTF8);
+ colType = DataType.createVarChar(DataType.MAX_EXASOL_VARCHAR_SIZE, DataType.ExaCharset.UTF8);
break;
}
- if (decimalPrec <= DataType.maxExasolDecimalPrecision) {
+ if (decimalPrec <= DataType.MAX_EXASOL_DECIMAL_PRECISION) {
colType = DataType.createDecimal(decimalPrec, decimalScale);
} else {
- colType = DataType.createVarChar(DataType.maxExasolVarcharSize, DataType.ExaCharset.UTF8);
+ colType = DataType.createVarChar(DataType.MAX_EXASOL_VARCHAR_SIZE, DataType.ExaCharset.UTF8);
}
break;
case Types.OTHER:
// Oracle JDBC uses OTHER as CLOB
- colType = DataType.createVarChar(DataType.maxExasolVarcharSize, DataType.ExaCharset.UTF8);
+ colType = DataType.createVarChar(DataType.MAX_EXASOL_VARCHAR_SIZE, DataType.ExaCharset.UTF8);
break;
case -103:
// INTERVAL YEAR TO MONTH
case -104:
// INTERVAL DAY TO SECOND
- colType = DataType.createVarChar(DataType.maxExasolVarcharSize, DataType.ExaCharset.UTF8);
+ colType = DataType.createVarChar(DataType.MAX_EXASOL_VARCHAR_SIZE, DataType.ExaCharset.UTF8);
break;
case -102:
case -101:
// -101 and -102 is TIMESTAMP WITH (LOCAL) TIMEZONE in Oracle.
- colType = DataType.createVarChar(DataType.maxExasolVarcharSize, DataType.ExaCharset.UTF8);
+ colType = DataType.createVarChar(DataType.MAX_EXASOL_VARCHAR_SIZE, DataType.ExaCharset.UTF8);
break;
case 100:
case 101:
// 100 and 101 are BINARY_FLOAT and BINARY_DOUBLE in Oracle.
- colType = DataType.createVarChar(DataType.maxExasolVarcharSize, DataType.ExaCharset.UTF8);
+ colType = DataType.createVarChar(DataType.MAX_EXASOL_VARCHAR_SIZE, DataType.ExaCharset.UTF8);
break;
}
return colType;
diff --git a/jdbc-adapter/virtualschema-jdbc-adapter/src/main/java/com/exasol/adapter/dialects/impl/RedshiftSqlDialect.java b/jdbc-adapter/virtualschema-jdbc-adapter/src/main/java/com/exasol/adapter/dialects/impl/RedshiftSqlDialect.java
index 2b72c7e78..275ba1c89 100644
--- a/jdbc-adapter/virtualschema-jdbc-adapter/src/main/java/com/exasol/adapter/dialects/impl/RedshiftSqlDialect.java
+++ b/jdbc-adapter/virtualschema-jdbc-adapter/src/main/java/com/exasol/adapter/dialects/impl/RedshiftSqlDialect.java
@@ -205,7 +205,7 @@ public DataType dialectSpecificMapJdbcType(final JdbcTypeDescription jdbcTypeDes
final int decimalPrec = jdbcTypeDescription.getPrecisionOrSize();
final int decimalScale = jdbcTypeDescription.getDecimalScale();
- if (decimalPrec <= DataType.maxExasolDecimalPrecision) {
+ if (decimalPrec <= DataType.MAX_EXASOL_DECIMAL_PRECISION) {
colType = DataType.createDecimal(decimalPrec, decimalScale);
} else {
colType = DataType.createDouble();
diff --git a/jdbc-adapter/virtualschema-jdbc-adapter/src/main/java/com/exasol/adapter/dialects/impl/SqlServerSqlDialect.java b/jdbc-adapter/virtualschema-jdbc-adapter/src/main/java/com/exasol/adapter/dialects/impl/SqlServerSqlDialect.java
index f83194183..4b55fd619 100644
--- a/jdbc-adapter/virtualschema-jdbc-adapter/src/main/java/com/exasol/adapter/dialects/impl/SqlServerSqlDialect.java
+++ b/jdbc-adapter/virtualschema-jdbc-adapter/src/main/java/com/exasol/adapter/dialects/impl/SqlServerSqlDialect.java
@@ -359,7 +359,7 @@ public DataType dialectSpecificMapJdbcType(final JdbcTypeDescription jdbcTypeDes
final int decimalPrec = jdbcTypeDescription.getPrecisionOrSize();
final int decimalScale = jdbcTypeDescription.getDecimalScale();
- if (decimalPrec <= DataType.maxExasolDecimalPrecision) {
+ if (decimalPrec <= DataType.MAX_EXASOL_DECIMAL_PRECISION) {
colType = DataType.createDecimal(decimalPrec, decimalScale);
} else {
colType = DataType.createDouble();
diff --git a/jdbc-adapter/virtualschema-jdbc-adapter/src/main/java/com/exasol/adapter/dialects/impl/SybaseSqlDialect.java b/jdbc-adapter/virtualschema-jdbc-adapter/src/main/java/com/exasol/adapter/dialects/impl/SybaseSqlDialect.java
index f2007d299..a3f498fcc 100644
--- a/jdbc-adapter/virtualschema-jdbc-adapter/src/main/java/com/exasol/adapter/dialects/impl/SybaseSqlDialect.java
+++ b/jdbc-adapter/virtualschema-jdbc-adapter/src/main/java/com/exasol/adapter/dialects/impl/SybaseSqlDialect.java
@@ -367,7 +367,7 @@ public DataType dialectSpecificMapJdbcType(final JdbcTypeDescription jdbcTypeDes
final int decimalPrec = jdbcTypeDescription.getPrecisionOrSize();
final int decimalScale = jdbcTypeDescription.getDecimalScale();
- if (decimalPrec <= DataType.maxExasolDecimalPrecision) {
+ if (decimalPrec <= DataType.MAX_EXASOL_DECIMAL_PRECISION) {
colType = DataType.createDecimal(decimalPrec, decimalScale);
} else {
int size = decimalPrec + 1;
@@ -390,7 +390,7 @@ public DataType dialectSpecificMapJdbcType(final JdbcTypeDescription jdbcTypeDes
case Types.CLOB: // TEXT and UNITEXT types in Sybase
- colType = DataType.createVarChar(DataType.maxExasolVarcharSize, DataType.ExaCharset.UTF8);
+ colType = DataType.createVarChar(DataType.MAX_EXASOL_VARCHAR_SIZE, DataType.ExaCharset.UTF8);
break;
case Types.BLOB:
diff --git a/jdbc-adapter/virtualschema-jdbc-adapter/src/main/java/com/exasol/adapter/dialects/impl/TeradataSqlDialect.java b/jdbc-adapter/virtualschema-jdbc-adapter/src/main/java/com/exasol/adapter/dialects/impl/TeradataSqlDialect.java
index f8cde0e39..847fe8a2c 100644
--- a/jdbc-adapter/virtualschema-jdbc-adapter/src/main/java/com/exasol/adapter/dialects/impl/TeradataSqlDialect.java
+++ b/jdbc-adapter/virtualschema-jdbc-adapter/src/main/java/com/exasol/adapter/dialects/impl/TeradataSqlDialect.java
@@ -206,7 +206,7 @@ public DataType dialectSpecificMapJdbcType(final JdbcTypeDescription jdbcTypeDes
final int decimalPrec = jdbcTypeDescription.getPrecisionOrSize();
final int decimalScale = jdbcTypeDescription.getDecimalScale();
- if (decimalPrec <= DataType.maxExasolDecimalPrecision) {
+ if (decimalPrec <= DataType.MAX_EXASOL_DECIMAL_PRECISION) {
colType = DataType.createDecimal(decimalPrec, decimalScale);
} else {
colType = DataType.createDouble();
diff --git a/jdbc-adapter/virtualschema-jdbc-adapter/src/main/java/com/exasol/adapter/jdbc/JdbcAdapter.java b/jdbc-adapter/virtualschema-jdbc-adapter/src/main/java/com/exasol/adapter/jdbc/JdbcAdapter.java
index b4e6389f8..4ec3c8a7b 100644
--- a/jdbc-adapter/virtualschema-jdbc-adapter/src/main/java/com/exasol/adapter/jdbc/JdbcAdapter.java
+++ b/jdbc-adapter/virtualschema-jdbc-adapter/src/main/java/com/exasol/adapter/jdbc/JdbcAdapter.java
@@ -193,25 +193,26 @@ private static Capabilities parseExcludedCapabilities(final String excludedCapab
logger.info(() -> "Excluded Capabilities: "
+ (excludedCapabilitiesStr.isEmpty() ? "none" : excludedCapabilitiesStr));
final Capabilities excludedCapabilities = new Capabilities();
- for (final String cap : excludedCapabilitiesStr.split(",")) {
- if (cap.trim().isEmpty()) {
+ for (String capability : excludedCapabilitiesStr.split(",")) {
+ capability = capability.trim();
+ if (capability.isEmpty()) {
continue;
}
- if (cap.startsWith(ResponseJsonSerializer.LITERAL_PREFIX)) {
- final String literalCap = cap.replaceFirst(ResponseJsonSerializer.LITERAL_PREFIX, "");
+ if (capability.startsWith(ResponseJsonSerializer.LITERAL_PREFIX)) {
+ final String literalCap = capability.replaceFirst(ResponseJsonSerializer.LITERAL_PREFIX, "");
excludedCapabilities.supportLiteral(LiteralCapability.valueOf(literalCap));
- } else if (cap.startsWith(ResponseJsonSerializer.AGGREGATE_FUNCTION_PREFIX)) {
+ } else if (capability.startsWith(ResponseJsonSerializer.AGGREGATE_FUNCTION_PREFIX)) {
// Aggregate functions must be checked before scalar functions
- final String aggregateFunctionCap = cap.replaceFirst(ResponseJsonSerializer.AGGREGATE_FUNCTION_PREFIX,
+ final String aggregateFunctionCap = capability.replaceFirst(ResponseJsonSerializer.AGGREGATE_FUNCTION_PREFIX,
"");
excludedCapabilities
.supportAggregateFunction(AggregateFunctionCapability.valueOf(aggregateFunctionCap));
- } else if (cap.startsWith(ResponseJsonSerializer.SCALAR_FUNCTION_PREFIX)) {
- final String scalarFunctionCap = cap.replaceFirst(ResponseJsonSerializer.SCALAR_FUNCTION_PREFIX, "");
+ } else if (capability.startsWith(ResponseJsonSerializer.SCALAR_FUNCTION_PREFIX)) {
+ final String scalarFunctionCap = capability.replaceFirst(ResponseJsonSerializer.SCALAR_FUNCTION_PREFIX, "");
excludedCapabilities.supportScalarFunction(ScalarFunctionCapability.valueOf(scalarFunctionCap));
} else {
// High Level Capability
- excludedCapabilities.supportMainCapability(MainCapability.valueOf(cap));
+ excludedCapabilities.supportMainCapability(MainCapability.valueOf(capability));
}
}
return excludedCapabilities;
@@ -234,42 +235,110 @@ private static String handlePushdownRequest(final PushdownRequest request, final
final SqlGenerationVisitor sqlGeneratorVisitor = dialect.getSqlGenerationVisitor(context);
final String pushdownQuery = request.getSelect().accept(sqlGeneratorVisitor);
- final ExaConnectionInformation connection = JdbcAdapterProperties.getConnectionInformation(meta.getProperties(),
- exaMeta);
- String credentials = "";
- if (connection.getUser() != null || connection.getPassword() != null) {
- credentials = "USER '" + connection.getUser() + "' IDENTIFIED BY '" + connection.getPassword() + "'";
- }
+ String sql = generateImportQueryForPushdownQuery(exaMeta, meta, dialect, pushdownQuery);
+ return ResponseJsonSerializer.makePushdownResponse(sql);
+ }
+
+ private static String generateImportQueryForPushdownQuery(ExaMetadata exaMeta, SchemaMetadataInfo meta, SqlDialect dialect, String pushdownQuery) throws AdapterException {
String sql = "";
if (JdbcAdapterProperties.isLocal(meta.getProperties())) {
- sql = pushdownQuery;
+ sql = generateLocalQuery(pushdownQuery);
} else if (JdbcAdapterProperties.isImportFromExa(meta.getProperties())) {
- sql = String.format("IMPORT FROM EXA AT '%s' %s STATEMENT '%s'",
- JdbcAdapterProperties.getExaConnectionString(meta.getProperties()), credentials,
- pushdownQuery.replace("'", "''"));
+ sql = generateExasolImportQuery(exaMeta, meta, pushdownQuery);
} else if (JdbcAdapterProperties.isImportFromOra(meta.getProperties())) {
- sql = String.format("IMPORT FROM ORA AT %s %s STATEMENT '%s'",
- JdbcAdapterProperties.getOraConnectionName(meta.getProperties()), credentials,
- pushdownQuery.replace("'", "''"));
+ sql = generateOracleImportQuery(exaMeta, meta, pushdownQuery);
} else {
- if (JdbcAdapterProperties.userSpecifiedConnection(meta.getProperties())) {
- credentials = JdbcAdapterProperties.getConnectionName(meta.getProperties());
- } else {
- credentials = "'" + connection.getAddress() + "' " + credentials;
- }
+ sql = generateJDBCImportQuery(exaMeta, meta, dialect, pushdownQuery);
+ }
+ return sql;
+ }
- final String columnDescription = createColumnDescription(exaMeta, meta, pushdownQuery, dialect);
- if (columnDescription == null) {
- sql = String.format("IMPORT FROM JDBC AT %s STATEMENT '%s'", credentials,
- pushdownQuery.replace("'", "''"));
- } else {
- sql = String.format("IMPORT INTO %s FROM JDBC AT %s STATEMENT '%s'", columnDescription, credentials,
- pushdownQuery.replace("'", "''"));
- }
+ private static String generateLocalQuery(final String pushdownQuery) {
+ return pushdownQuery;
+ }
+
+ private static String generateExasolImportQuery(ExaMetadata exaMeta, SchemaMetadataInfo meta, String pushdownQuery) {
+ String credentials = getCredentialsForEXAImport(exaMeta, meta);
+ StringBuilder exasolImportQuery = new StringBuilder();
+ exasolImportQuery.append("IMPORT FROM EXA AT '");
+ exasolImportQuery.append(JdbcAdapterProperties.getExaConnectionString(meta.getProperties()));
+ exasolImportQuery.append("' ");
+ exasolImportQuery.append(credentials);
+ exasolImportQuery.append(" STATEMENT '");
+ exasolImportQuery.append( pushdownQuery.replace("'", "''"));
+ exasolImportQuery.append("'");
+ return exasolImportQuery.toString();
+ }
+
+ private static String generateOracleImportQuery(ExaMetadata exaMeta, SchemaMetadataInfo meta, String pushdownQuery) {
+ String credentials = getCredentialsForORAImport(exaMeta, meta);
+ StringBuilder oracleImportQuery = new StringBuilder();
+ oracleImportQuery.append("IMPORT FROM ORA AT ");
+ oracleImportQuery.append(JdbcAdapterProperties.getOraConnectionName(meta.getProperties()));
+ oracleImportQuery.append(" ");
+ oracleImportQuery.append(credentials);
+ oracleImportQuery.append(" STATEMENT '");
+ oracleImportQuery.append( pushdownQuery.replace("'", "''"));
+ oracleImportQuery.append("'");
+ return oracleImportQuery.toString();
+ }
+
+ private static String generateJDBCImportQuery(ExaMetadata exaMeta, SchemaMetadataInfo meta, SqlDialect dialect, String pushdownQuery) throws AdapterException {
+ String credentials = getCredentialsForJDBCImport(exaMeta, meta);
+
+ StringBuilder jdbcImportQuery = new StringBuilder();
+ final String columnDescription = createColumnDescription(exaMeta, meta, pushdownQuery, dialect);
+ if (columnDescription == null) {
+ jdbcImportQuery.append("IMPORT FROM JDBC AT ");
+ jdbcImportQuery.append(credentials);
+ jdbcImportQuery.append(" STATEMENT '");
+ jdbcImportQuery.append( pushdownQuery.replace("'", "''"));
+ jdbcImportQuery.append("'");
+ } else {
+ jdbcImportQuery.append("IMPORT INTO ");
+ jdbcImportQuery.append(columnDescription);
+ jdbcImportQuery.append(" FROM JDBC AT ");
+ jdbcImportQuery.append(credentials);
+ jdbcImportQuery.append(" STATEMENT '");
+ jdbcImportQuery.append( pushdownQuery.replace("'", "''"));
+ jdbcImportQuery.append("'");
}
+ return jdbcImportQuery.toString();
+ }
- return ResponseJsonSerializer.makePushdownResponse(sql);
+ protected static String getCredentialsForJDBCImport(ExaMetadata exaMeta, SchemaMetadataInfo meta) {
+ String credentials = "";
+ if (JdbcAdapterProperties.isUserSpecifiedConnection(meta.getProperties())) {
+ credentials = JdbcAdapterProperties.getConnectionName(meta.getProperties());
+ } else {
+ credentials = getUserAndPasswordForImport(exaMeta, meta);
+ final ExaConnectionInformation connection = JdbcAdapterProperties.getConnectionInformation(meta.getProperties(), exaMeta);
+ credentials = "'" + connection.getAddress() + "' " + credentials;
+ }
+ return credentials;
+ }
+
+ protected static String getCredentialsForORAImport(ExaMetadata exaMeta, SchemaMetadataInfo meta) {
+ String credentials = "";
+ if (!JdbcAdapterProperties.isUserSpecifiedConnection(meta.getProperties())) {
+ credentials = getUserAndPasswordForImport(exaMeta, meta);
+ }
+ return credentials;
+ }
+
+ protected static String getCredentialsForEXAImport(ExaMetadata exaMeta, SchemaMetadataInfo meta) {
+ return getUserAndPasswordForImport(exaMeta, meta);
+ }
+
+ private static String getUserAndPasswordForImport(ExaMetadata exaMeta, SchemaMetadataInfo meta) {
+ String credentials = "";
+ final ExaConnectionInformation connection = JdbcAdapterProperties.getConnectionInformation(meta.getProperties(),
+ exaMeta);
+ if (connection.getUser() != null || connection.getPassword() != null) {
+ credentials = "USER '" + connection.getUser() + "' IDENTIFIED BY '" + connection.getPassword() + "'";
+ }
+ return credentials;
}
private static String createColumnDescription(final ExaMetadata exaMeta, final SchemaMetadataInfo meta,
diff --git a/jdbc-adapter/virtualschema-jdbc-adapter/src/main/java/com/exasol/adapter/jdbc/JdbcAdapterProperties.java b/jdbc-adapter/virtualschema-jdbc-adapter/src/main/java/com/exasol/adapter/jdbc/JdbcAdapterProperties.java
index e73ecd759..6e3abb6c6 100644
--- a/jdbc-adapter/virtualschema-jdbc-adapter/src/main/java/com/exasol/adapter/jdbc/JdbcAdapterProperties.java
+++ b/jdbc-adapter/virtualschema-jdbc-adapter/src/main/java/com/exasol/adapter/jdbc/JdbcAdapterProperties.java
@@ -86,7 +86,7 @@ public static String getSchema(final Map properties) {
return getProperty(properties, PROP_SCHEMA_NAME);
}
- public static boolean userSpecifiedConnection(final Map properties) {
+ public static boolean isUserSpecifiedConnection(final Map properties) {
final String connName = getProperty(properties, PROP_CONNECTION_NAME);
return (connName != null && !connName.isEmpty());
}
diff --git a/jdbc-adapter/virtualschema-jdbc-adapter/src/test/java/com/exasol/adapter/dialects/AbstractIntegrationTest.java b/jdbc-adapter/virtualschema-jdbc-adapter/src/test/java/com/exasol/adapter/dialects/AbstractIntegrationTest.java
index fc7b25f6f..6e926dba0 100644
--- a/jdbc-adapter/virtualschema-jdbc-adapter/src/test/java/com/exasol/adapter/dialects/AbstractIntegrationTest.java
+++ b/jdbc-adapter/virtualschema-jdbc-adapter/src/test/java/com/exasol/adapter/dialects/AbstractIntegrationTest.java
@@ -102,7 +102,7 @@ public static void createJDBCAdapter(final List jarIncludes) throws SQLE
public static void createVirtualSchema(final Connection conn, final String virtualSchemaName, final String dialect,
final String remoteCatalog, final String remoteSchema, final String connectionName, final String user,
final String password, final String adapter, final String remoteConnectionString, final boolean isLocal,
- final String debugAddress, final String tableFilter, final String suffix) throws SQLException {
+ final String debugAddress, final String tableFilter, final String suffix, final String excludedCapabilities) throws SQLException {
removeVirtualSchema(conn, virtualSchemaName);
String sql = "CREATE VIRTUAL SCHEMA " + virtualSchemaName;
sql += " USING " + adapter;
@@ -134,6 +134,9 @@ public static void createVirtualSchema(final Connection conn, final String virtu
sql += " DEBUG_ADDRESS='" + debugAddress + "'";
}
sql += " LOG_LEVEL='ALL'";
+ if (!excludedCapabilities.isEmpty()) {
+ sql += " EXCLUDED_CAPABILITIES='" + excludedCapabilities + "'";
+ }
if (!tableFilter.isEmpty()) {
sql += " TABLE_FILTER='" + tableFilter + "'";
}
@@ -146,10 +149,10 @@ public static void createVirtualSchema(final Connection conn, final String virtu
public static void createVirtualSchema(final String virtualSchemaName, final String dialect,
final String remoteCatalog, final String remoteSchema, final String connectionName, final String user,
final String password, final String adapter, final String remoteConnectionString, final boolean isLocal,
- final String debugAddress, final String tableFilter, final String suffix) throws SQLException {
+ final String debugAddress, final String tableFilter, final String suffix, final String excludedCapabilities) throws SQLException {
checkConnection();
createVirtualSchema(connection, virtualSchemaName, dialect, remoteCatalog, remoteSchema, connectionName, user,
- password, adapter, remoteConnectionString, isLocal, debugAddress, tableFilter, suffix);
+ password, adapter, remoteConnectionString, isLocal, debugAddress, tableFilter, suffix, excludedCapabilities);
}
public static void createConnection(final Connection conn, final String connectionName,
diff --git a/jdbc-adapter/virtualschema-jdbc-adapter/src/test/java/com/exasol/adapter/dialects/CustomSqlGenerationVisitorTest.java b/jdbc-adapter/virtualschema-jdbc-adapter/src/test/java/com/exasol/adapter/dialects/CustomSqlGenerationVisitorTest.java
index 16c4fcb05..369a2a7e4 100644
--- a/jdbc-adapter/virtualschema-jdbc-adapter/src/test/java/com/exasol/adapter/dialects/CustomSqlGenerationVisitorTest.java
+++ b/jdbc-adapter/virtualschema-jdbc-adapter/src/test/java/com/exasol/adapter/dialects/CustomSqlGenerationVisitorTest.java
@@ -8,10 +8,10 @@
import com.exasol.adapter.metadata.MetadataException;
import com.exasol.adapter.metadata.TableMetadata;
import com.exasol.adapter.sql.*;
-import com.exasol.utils.SqlTestUtil;
import com.google.common.collect.ImmutableList;
import org.junit.Test;
import org.mockito.Mockito;
+import utils.SqlTestUtil;
import java.util.ArrayList;
import java.util.List;
diff --git a/jdbc-adapter/virtualschema-jdbc-adapter/src/test/java/com/exasol/adapter/dialects/FileBasedIntegrationTest.java b/jdbc-adapter/virtualschema-jdbc-adapter/src/test/java/com/exasol/adapter/dialects/FileBasedIntegrationTest.java
index dc67cfdbd..4b8f483c8 100644
--- a/jdbc-adapter/virtualschema-jdbc-adapter/src/test/java/com/exasol/adapter/dialects/FileBasedIntegrationTest.java
+++ b/jdbc-adapter/virtualschema-jdbc-adapter/src/test/java/com/exasol/adapter/dialects/FileBasedIntegrationTest.java
@@ -1,11 +1,12 @@
package com.exasol.adapter.dialects;
import static org.junit.Assert.assertTrue;
+import static org.mockito.Mockito.when;
import java.io.File;
-import java.util.ArrayList;
-import java.util.List;
+import java.lang.reflect.InvocationTargetException;
+import java.util.*;
import javax.json.JsonObject;
import javax.json.JsonValue;
@@ -21,6 +22,8 @@
import com.google.common.io.Files;
import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
import org.mockito.Mockito;
@@ -53,36 +56,46 @@
* returned Pushdown SQLs.
*
*/
+@RunWith(Parameterized.class)
public class FileBasedIntegrationTest {
private static final String INTEGRATION_TESTFILES_DIR = "target/test-classes/integration";
private static final String TEST_FILE_KEY_TESTCASES = "testCases";
private static final String TEST_FILE_KEY_EXP_PD_REQUEST = "expectedPushdownRequest";
private static final String TEST_FILE_KEY_EXP_PD_RESPONSE = "expectedPushdownResponse";
- private static final String TEST_FILE_KEY_DIALECT_EXASOL = "Exasol";
private static final String JSON_API_KEY_INVOLVED_TABLES = "involvedTables";
+ @Parameterized.Parameters(name = "{index}: {0}")
+ public static Iterable extends Object> data() {
+ final File testDir = new File(INTEGRATION_TESTFILES_DIR);
+ return Arrays.asList(testDir.listFiles((dir, name) -> name.endsWith(".json")));
+ }
+
+ private final File testFile;
+
+ public FileBasedIntegrationTest(final File testFile) {
+ this.testFile = testFile;
+ }
+
@Test
public void testPushdownFromTestFile() throws Exception {
- File testDir = new File(INTEGRATION_TESTFILES_DIR);
- File[] files = testDir.listFiles((dir, name) -> name.endsWith(".json"));
- for (File testFile : files) {
- String jsonTest = Files.toString(testFile, Charsets.UTF_8);
- int numberOftests = getNumberOfTestsFrom(jsonTest);
- for (int testNr = 0; testNr < numberOftests; testNr++) {
- List pushdownRequests = getPushdownRequestsFrom(jsonTest, testNr);
- List expectedPushdownQueries = getExpectedPushdownQueriesFrom(jsonTest, testNr);
- for (PushdownRequest pushdownRequest: pushdownRequests) {
- String pushdownQuery = generatePushdownQuery(pushdownRequest, hasMultipleTables(jsonTest, testNr));
- assertExpectedPushdowns(expectedPushdownQueries, pushdownQuery, testFile.getName(), testNr);
+ final String jsonTest = Files.toString(testFile, Charsets.UTF_8);
+ final int numberOftests = getNumberOfTestsFrom(jsonTest);
+ for (int testNr = 0; testNr < numberOftests; testNr++) {
+ final List pushdownRequests = getPushdownRequestsFrom(jsonTest, testNr);
+ final Map> expectedPushdownQueries = getExpectedPushdownQueriesFrom(jsonTest, testNr);
+ for (final String dialect : expectedPushdownQueries.keySet()) {
+ for (final PushdownRequest pushdownRequest : pushdownRequests) {
+ final String pushdownQuery = generatePushdownQuery(dialect, pushdownRequest, hasMultipleTables(jsonTest, testNr), testFile.getName(), testNr);
+ assertExpectedPushdowns(expectedPushdownQueries.get(dialect), pushdownQuery, testFile.getName(), testNr, dialect);
}
}
}
}
- private void assertExpectedPushdowns(List expectedPushdownQueries, String pushdownQuery, String testFile,
- int testNr) {
- boolean foundInExpected = expectedPushdownQueries.stream().anyMatch(pushdownQuery::contains);
- StringBuilder errorMessage = new StringBuilder();
+ private void assertExpectedPushdowns(final List expectedPushdownQueries, final String pushdownQuery, final String testFile,
+ final int testNr, final String dialect) {
+ final boolean foundInExpected = expectedPushdownQueries.stream().anyMatch(pushdownQuery::contains);
+ final StringBuilder errorMessage = new StringBuilder();
if (!foundInExpected)
{
errorMessage.append("Generated Pushdown: ");
@@ -93,55 +106,74 @@ private void assertExpectedPushdowns(List expectedPushdownQueries, Strin
errorMessage.append(testFile);
errorMessage.append(" ,Test#: ");
errorMessage.append(testNr);
+ errorMessage.append(" ,Dialect: ");
+ errorMessage.append(dialect);
}
assertTrue(errorMessage.toString(), foundInExpected);
}
- private int getNumberOfTestsFrom(String jsonTest) throws Exception {
- JsonObject root = JsonHelper.getJsonObject(jsonTest);
+ private int getNumberOfTestsFrom(final String jsonTest) throws Exception {
+ final JsonObject root = JsonHelper.getJsonObject(jsonTest);
return root.getJsonArray(TEST_FILE_KEY_TESTCASES).size();
}
- private List getPushdownRequestsFrom(String jsonTest, int testNr) throws Exception {
- JsonObject root = JsonHelper.getJsonObject(jsonTest);
- JsonObject test = root.getJsonArray(TEST_FILE_KEY_TESTCASES).getValuesAs(JsonObject.class).get(testNr);
- int numberOfPushdownRequests = test.getJsonArray(TEST_FILE_KEY_EXP_PD_REQUEST).size();
- List pushdownRequests = new ArrayList(numberOfPushdownRequests);
+ private List getPushdownRequestsFrom(final String jsonTest, final int testNr) throws Exception {
+ final JsonObject root = JsonHelper.getJsonObject(jsonTest);
+ final JsonObject test = root.getJsonArray(TEST_FILE_KEY_TESTCASES).getValuesAs(JsonObject.class).get(testNr);
+ final int numberOfPushdownRequests = test.getJsonArray(TEST_FILE_KEY_EXP_PD_REQUEST).size();
+ final List pushdownRequests = new ArrayList(numberOfPushdownRequests);
for(int requestNr = 0; requestNr < numberOfPushdownRequests; requestNr++) {
- String req = test.getJsonArray(TEST_FILE_KEY_EXP_PD_REQUEST).get(requestNr).toString();
- RequestJsonParser parser = new RequestJsonParser();
- AdapterRequest request = parser.parseRequest(req);
+ final String req = test.getJsonArray(TEST_FILE_KEY_EXP_PD_REQUEST).get(requestNr).toString();
+ final RequestJsonParser parser = new RequestJsonParser();
+ final AdapterRequest request = parser.parseRequest(req);
pushdownRequests.add((PushdownRequest) request);
}
return pushdownRequests;
}
- private Boolean hasMultipleTables(String jsonTest, int testNr) throws Exception {
- JsonObject root = JsonHelper.getJsonObject(jsonTest);
- JsonObject test = root.getJsonArray(TEST_FILE_KEY_TESTCASES).getValuesAs(JsonObject.class).get(testNr);
- JsonValue req = test.getJsonArray(TEST_FILE_KEY_EXP_PD_REQUEST).get(0);
- int size = ((JsonObject) req).getJsonArray(JSON_API_KEY_INVOLVED_TABLES).size();
+ private Boolean hasMultipleTables(final String jsonTest, final int testNr) throws Exception {
+ final JsonObject root = JsonHelper.getJsonObject(jsonTest);
+ final JsonObject test = root.getJsonArray(TEST_FILE_KEY_TESTCASES).getValuesAs(JsonObject.class).get(testNr);
+ final JsonValue req = test.getJsonArray(TEST_FILE_KEY_EXP_PD_REQUEST).get(0);
+ final int size = ((JsonObject) req).getJsonArray(JSON_API_KEY_INVOLVED_TABLES).size();
return size > 1;
}
- private String generatePushdownQuery(PushdownRequest pushdownRequest, Boolean multipleTables) throws AdapterException {
- String schemaName = "LS";
- SqlGenerationContext context = new SqlGenerationContext("", schemaName, false, multipleTables);
- SqlDialectContext dialectContext = new SqlDialectContext(Mockito.mock(SchemaAdapterNotes.class));
- ExasolSqlDialect dialect = new ExasolSqlDialect(dialectContext);
- final SqlGenerationVisitor sqlGeneratorVisitor = dialect.getSqlGenerationVisitor(context);
- return pushdownRequest.getSelect().accept(sqlGeneratorVisitor);
+ private String generatePushdownQuery(final String dialect, final PushdownRequest pushdownRequest, final Boolean multipleTables, final String testFile, final int testNr) throws AdapterException, ClassNotFoundException, NoSuchMethodException, IllegalAccessException, InvocationTargetException, InstantiationException {
+ final String schemaName = "LS";
+ final SqlGenerationContext context = new SqlGenerationContext("", schemaName, false, multipleTables);
+ final SchemaAdapterNotes notes = Mockito.mock(SchemaAdapterNotes.class);
+ when(notes.isNullsAreSortedAtEnd()).thenReturn(false);
+ when(notes.isNullsAreSortedAtStart()).thenReturn(false);
+ when(notes.isNullsAreSortedHigh()).thenReturn(true);
+ when(notes.isNullsAreSortedLow()).thenReturn(false);
+ final SqlDialectContext dialectContext = new SqlDialectContext(notes);
+ final Class dialectClass = Class.forName("com.exasol.adapter.dialects.impl." + dialect + "SqlDialect");
+ final SqlDialect sqlDialect = (SqlDialect)dialectClass.getConstructor(SqlDialectContext.class).newInstance(dialectContext);
+ final SqlGenerationVisitor sqlGeneratorVisitor = sqlDialect.getSqlGenerationVisitor(context);
+ try {
+ return pushdownRequest.getSelect().accept(sqlGeneratorVisitor);
+ } catch (final Exception e)
+ {
+ System.err.println("Exception in: " + testFile + " Test#: " + testNr + " dialect: " + dialect);
+ throw e;
+ }
}
- private List getExpectedPushdownQueriesFrom(String jsonTest, int testNr) throws Exception {
- JsonObject root = JsonHelper.getJsonObject(jsonTest);
- JsonObject test = root.getJsonArray(TEST_FILE_KEY_TESTCASES).getValuesAs(JsonObject.class).get(testNr);
- int numberOfPushdownResponses = test.getJsonObject(TEST_FILE_KEY_EXP_PD_RESPONSE).getJsonArray(TEST_FILE_KEY_DIALECT_EXASOL).size();
- List pushdownResponses = new ArrayList<>(numberOfPushdownResponses);
- for(int pushdownNr = 0; pushdownNr < numberOfPushdownResponses; pushdownNr++) {
- pushdownResponses.add(test.getJsonObject(TEST_FILE_KEY_EXP_PD_RESPONSE).getJsonArray(TEST_FILE_KEY_DIALECT_EXASOL).get(pushdownNr)
- .toString().replaceAll("\\\\\"", "\"").replaceAll("^\"+", "").replaceAll("\"$", ""));
+ private Map> getExpectedPushdownQueriesFrom(final String jsonTest, final int testNr) throws Exception {
+ final JsonObject root = JsonHelper.getJsonObject(jsonTest);
+ final JsonObject test = root.getJsonArray(TEST_FILE_KEY_TESTCASES).getValuesAs(JsonObject.class).get(testNr);
+ final JsonObject expectedResponses = test.getJsonObject(TEST_FILE_KEY_EXP_PD_RESPONSE);
+ final Map> expectedQueriesForDialects = new HashMap<>();
+ for ( final String dialect : expectedResponses.keySet()) {
+ final int numberOfPushdownResponses = test.getJsonObject(TEST_FILE_KEY_EXP_PD_RESPONSE).getJsonArray(dialect).size();
+ final List pushdownResponses = new ArrayList<>(numberOfPushdownResponses);
+ for(int pushdownNr = 0; pushdownNr < numberOfPushdownResponses; pushdownNr++) {
+ pushdownResponses.add(test.getJsonObject(TEST_FILE_KEY_EXP_PD_RESPONSE).getJsonArray(dialect).get(pushdownNr)
+ .toString().replaceAll("\\\\\"", "\"").replaceAll("^\"+", "").replaceAll("\"$", ""));
+ }
+ expectedQueriesForDialects.put(dialect, pushdownResponses);
}
- return pushdownResponses;
+ return expectedQueriesForDialects;
}
}
\ No newline at end of file
diff --git a/jdbc-adapter/virtualschema-jdbc-adapter/src/test/java/com/exasol/adapter/dialects/SqlDialectTest.java b/jdbc-adapter/virtualschema-jdbc-adapter/src/test/java/com/exasol/adapter/dialects/SqlDialectTest.java
index 0f7ea8ad8..934c6c14f 100644
--- a/jdbc-adapter/virtualschema-jdbc-adapter/src/test/java/com/exasol/adapter/dialects/SqlDialectTest.java
+++ b/jdbc-adapter/virtualschema-jdbc-adapter/src/test/java/com/exasol/adapter/dialects/SqlDialectTest.java
@@ -28,9 +28,9 @@
import com.exasol.adapter.sql.SqlSelectList;
import com.exasol.adapter.sql.SqlStatementSelect;
import com.exasol.adapter.sql.SqlTable;
-import com.exasol.utils.SqlTestUtil;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
+import utils.SqlTestUtil;
public class SqlDialectTest {
diff --git a/jdbc-adapter/virtualschema-jdbc-adapter/src/test/java/com/exasol/adapter/dialects/impl/DB2SqlDialectIT.java b/jdbc-adapter/virtualschema-jdbc-adapter/src/test/java/com/exasol/adapter/dialects/impl/DB2SqlDialectIT.java
index 681d3eec9..588d5e9ba 100644
--- a/jdbc-adapter/virtualschema-jdbc-adapter/src/test/java/com/exasol/adapter/dialects/impl/DB2SqlDialectIT.java
+++ b/jdbc-adapter/virtualschema-jdbc-adapter/src/test/java/com/exasol/adapter/dialects/impl/DB2SqlDialectIT.java
@@ -31,7 +31,7 @@ public static void setUpClass() throws FileNotFoundException, SQLException, Clas
createDB2JDBCAdapter();
createVirtualSchema(VIRTUAL_SCHEMA, DB2SqlDialect.getPublicName(), "", DB2_SCHEMA, "", getConfig().getDB2User(),
getConfig().getDB2Password(), "ADAPTER.JDBC_ADAPTER", getConfig().getDB2JdbcConnectionString(),
- IS_LOCAL, getConfig().debugAddress(), "", null);
+ IS_LOCAL, getConfig().debugAddress(), "", null, "");
}
@Test
diff --git a/jdbc-adapter/virtualschema-jdbc-adapter/src/test/java/com/exasol/adapter/dialects/impl/ExasolSqlDialectIT.java b/jdbc-adapter/virtualschema-jdbc-adapter/src/test/java/com/exasol/adapter/dialects/impl/ExasolSqlDialectIT.java
index 77634da69..d90199675 100644
--- a/jdbc-adapter/virtualschema-jdbc-adapter/src/test/java/com/exasol/adapter/dialects/impl/ExasolSqlDialectIT.java
+++ b/jdbc-adapter/virtualschema-jdbc-adapter/src/test/java/com/exasol/adapter/dialects/impl/ExasolSqlDialectIT.java
@@ -31,6 +31,49 @@
*/
public class ExasolSqlDialectIT extends AbstractIntegrationTest {
+ public static class ConnectionBuilder {
+ private String connectionName;
+ private String connectionString;
+ private String connectionUser;
+ private String connectionPassword;
+
+ public ConnectionBuilder(
+ final String connectionName,
+ final String connectionString) {
+ this.connectionName = connectionName;
+ this.connectionString = connectionString;
+ this.connectionUser = "";
+ this.connectionPassword = "";
+ }
+
+ public ConnectionBuilder user(final String user) {
+ this.connectionUser = user;
+ return this;
+ }
+
+ public ConnectionBuilder password(final String password) {
+ this.connectionPassword = password;
+ return this;
+ }
+
+ public String getCreateConnection() {
+ StringBuilder createConnection = new StringBuilder();
+ createConnection.append("CREATE CONNECTION ");
+ createConnection.append(this.connectionName);
+ createConnection.append(" TO '");
+ createConnection.append(this.connectionString);
+ createConnection.append("'");
+ if (this.connectionUser != "" && this.connectionPassword != "") {
+ createConnection.append(" USER '");
+ createConnection.append(this.connectionUser);
+ createConnection.append("' IDENTIFIED BY '");
+ createConnection.append(this.connectionPassword);
+ createConnection.append("'");
+ }
+ return createConnection.toString();
+ }
+ }
+
@Rule
public ExpectedException thrown = ExpectedException.none();
@@ -54,10 +97,10 @@ public static void setUpClass() throws FileNotFoundException, SQLException, Clas
createTestSchema();
createVirtualSchema(VIRTUAL_SCHEMA, ExasolSqlDialect.getPublicName(), "", TEST_SCHEMA, "",
getConfig().getExasolUser(), getConfig().getExasolPassword(), "ADAPTER.JDBC_ADAPTER", connectionString,
- IS_LOCAL, getConfig().debugAddress(), "", null);
+ IS_LOCAL, getConfig().debugAddress(), "", null, "");
createVirtualSchema(VIRTUAL_SCHEMA_MIXED_CASE, ExasolSqlDialect.getPublicName(), "", TEST_SCHEMA_MIXED_CASE, "",
getConfig().getExasolUser(), getConfig().getExasolPassword(), "ADAPTER.JDBC_ADAPTER", connectionString,
- IS_LOCAL, getConfig().debugAddress(), "", null);
+ IS_LOCAL, getConfig().debugAddress(), "", null, "");
}
private static void createTestSchema() throws SQLException {
@@ -132,31 +175,33 @@ public void testDataTypeSelect() throws SQLException {
}
@Test
- public void testIdentifierCaseSensitivity() throws SQLException, FileNotFoundException {
- ResultSet result = executeQuery("SELECT * FROM \"Table_Mixed_Case\"");
- matchLastRow(result, 1L, 2L, 3L);
- result = executeQuery("SELECT \"Column1\", \"column2\", COLUMN3 FROM \"Table_Mixed_Case\"");
+ public void testIdentifierCaseSensitivityOnTable() throws SQLException {
+ final ResultSet result = executeQuery("SELECT * FROM " + VIRTUAL_SCHEMA_MIXED_CASE + ".\"Table_Mixed_Case\"");
matchLastRow(result, 1L, 2L, 3L);
- result = executeQuery("SELECT \"Column1\", \"column2\", COLUMN3 FROM \"Table_Mixed_Case\"");
+ }
+
+ @Test
+ public void testIdentifierCaseSensitivityOnColumns() throws SQLException {
+ final ResultSet result = executeQuery("SELECT \"Column1\", \"column2\", COLUMN3 FROM " + VIRTUAL_SCHEMA_MIXED_CASE + ".\"Table_Mixed_Case\"");
matchLastRow(result, 1L, 2L, 3L);
}
@Test
- public void testIdentifierCaseSensitivityException1() throws SQLException, FileNotFoundException {
+ public void assertUnquotedMixedCaseTableIsNotFound() throws SQLException {
this.thrown.expect(SQLException.class);
- this.thrown.expectMessage("object TABLE_MIXED_CASE not found");
- executeQuery("SELECT \"Column1\", \"column2\", COLUMN3 FROM Table_Mixed_Case");
+ this.thrown.expectMessage("object VS_EXA_IT_MIXED_CASE.TABLE_MIXED_CASE not found");
+ executeQuery("SELECT \"Column1\", \"column2\", COLUMN3 FROM " + VIRTUAL_SCHEMA_MIXED_CASE + ".Table_Mixed_Case");
}
@Test
- public void testIdentifierCaseSensitivityException2() throws SQLException, FileNotFoundException {
+ public void assertUnquotedMixedCaseColumnIsNotFound() throws SQLException {
this.thrown.expect(SQLException.class);
this.thrown.expectMessage("object COLUMN1 not found");
- executeQuery("SELECT Column1, column2, COLUMN3 FROM \"Table_Mixed_Case\"");
+ executeQuery("SELECT Column1, column2, COLUMN3 FROM " + VIRTUAL_SCHEMA_MIXED_CASE + ".\"Table_Mixed_Case\"");
}
@Test
- public void testGroupConcat() throws SQLException, FileNotFoundException {
+ public void testGroupConcat() throws SQLException {
String query = "SELECT GROUP_CONCAT(A) FROM " + VIRTUAL_SCHEMA + ".SIMPLE_VALUES";
ResultSet result = executeQuery(query);
matchLastRow(result, "1,1,2,2,3,3");
@@ -189,7 +234,7 @@ public void testGroupConcat() throws SQLException, FileNotFoundException {
}
@Test
- public void testExtract() throws SQLException, FileNotFoundException {
+ public void testExtract() throws SQLException {
String query = "SELECT EXTRACT(MONTH FROM C9) FROM " + VIRTUAL_SCHEMA + ".ALL_EXA_TYPES";
ResultSet result = executeQuery(query);
matchLastRow(result, (short) 8);
@@ -201,7 +246,7 @@ public void testExtract() throws SQLException, FileNotFoundException {
}
@Test
- public void testCast() throws SQLException, FileNotFoundException {
+ public void testCast() throws SQLException {
String query = "SELECT CAST(A AS CHAR(15)) FROM " + VIRTUAL_SCHEMA + ".SIMPLE_VALUES";
ResultSet result = executeQuery(query);
matchNextRow(result, "1 ");
@@ -271,7 +316,7 @@ public void testCast() throws SQLException, FileNotFoundException {
}
@Test
- public void testCase() throws SQLException, FileNotFoundException {
+ public void testCase() throws SQLException {
String query = "SELECT CASE A WHEN 1 THEN 'YES' WHEN 2 THEN 'PERHAPS' ELSE 'NO' END FROM " + VIRTUAL_SCHEMA
+ ".SIMPLE_VALUES";
ResultSet result = executeQuery(query);
@@ -291,9 +336,73 @@ public void testErrorMessages() throws SQLException, FileNotFoundException {
this.thrown.expectMessage("Could not access the connection information of connection NO_CONNECTION");
createVirtualSchema("VS_EXA_IT_BROKEN", ExasolSqlDialect.getPublicName(), "", "NATIVE_EXA_IT", "NO_CONNECTION",
"", "", "ADAPTER.JDBC_ADAPTER", "",
- false, getConfig().debugAddress(), "", null);
+ false, getConfig().debugAddress(), "", null,
+ "");
+ }
+
+ @Test
+ public void testVirtualSchemaImportFromJDBCWithConnectionName() throws SQLException, FileNotFoundException {
+ final String connectionString = "jdbc:exa:localhost:" + getPortOfConnectedDatabase();
+ ConnectionBuilder JDBCConnection = new ConnectionBuilder(
+ "VS_JDBC_WITH_CONNNAME_CONNECTION", connectionString).
+ user(getConfig().getExasolUser()).
+ password(getConfig().getExasolPassword());
+ execute(JDBCConnection.getCreateConnection());
+ createVirtualSchema("VS_JDBC_WITH_CONNNAME", ExasolSqlDialect.getPublicName(), "", TEST_SCHEMA, "VS_JDBC_WITH_CONNNAME_CONNECTION",
+ "", "", "ADAPTER.JDBC_ADAPTER", "",
+ false, "", "", null, "");
+ final String query = "SELECT 1 FROM VS_JDBC_WITH_CONNNAME.SIMPLE_VALUES";
+ final ResultSet result = executeQuery(query);
+ matchNextRow(result, new Short("1"));
+ matchSingleRowExplain(query, "IMPORT INTO (c0 DECIMAL(1, 0)) FROM JDBC AT VS_JDBC_WITH_CONNNAME_CONNECTION STATEMENT 'SELECT 1 FROM \"NATIVE_EXA_IT\".\"SIMPLE_VALUES\"'",
+ IS_LOCAL);
}
+ @Test
+ public void testVirtualSchemaImportFromEXAWithConnectionName() throws SQLException, FileNotFoundException {
+ final String connectionString = "jdbc:exa:localhost:" + getPortOfConnectedDatabase();
+ ConnectionBuilder EXAConnection = new ConnectionBuilder(
+ "VS_EXA_WITH_CONNNAME_CONNECTION", connectionString).
+ user(getConfig().getExasolUser()).
+ password(getConfig().getExasolPassword());
+ execute(EXAConnection.getCreateConnection());
+ createVirtualSchema("VS_EXA_WITH_CONNNAME", ExasolSqlDialect.getPublicName(), "", TEST_SCHEMA, "VS_EXA_WITH_CONNNAME_CONNECTION",
+ "", "", "ADAPTER.JDBC_ADAPTER", "",
+ false, "", "", "IMPORT_FROM_EXA = 'true' EXA_CONNECTION_STRING = 'localhost:" + getPortOfConnectedDatabase() + "'", "");
+ final String query = "SELECT 1 FROM VS_EXA_WITH_CONNNAME.SIMPLE_VALUES";
+ final ResultSet result = executeQuery(query);
+ matchNextRow(result, new Short("1"));
+ matchSingleRowExplain(query, "IMPORT FROM EXA AT 'localhost:8888' USER 'sys' IDENTIFIED BY 'exasol' STATEMENT 'SELECT 1 FROM \"NATIVE_EXA_IT\".\"SIMPLE_VALUES\"'",
+ IS_LOCAL);
+ }
+
+ @Test
+ public void testVirtualSchemaImportFromJDBCWithConnectionStringUserPassword() throws SQLException, FileNotFoundException {
+ final String connectionString = "jdbc:exa:localhost:" + getPortOfConnectedDatabase();
+ createVirtualSchema("VS_JDBC_WITH_USER_PW", ExasolSqlDialect.getPublicName(), "", TEST_SCHEMA, "",
+ getConfig().getExasolUser(), getConfig().getExasolPassword(), "ADAPTER.JDBC_ADAPTER", connectionString,
+ false, "", "", null, "");
+ final String query = "SELECT 1 FROM VS_JDBC_WITH_USER_PW.SIMPLE_VALUES";
+ final ResultSet result = executeQuery(query);
+ matchNextRow(result, new Short("1"));
+ matchSingleRowExplain(query, "IMPORT INTO (c0 DECIMAL(1, 0)) FROM JDBC AT 'jdbc:exa:localhost:8888' USER 'sys' IDENTIFIED BY 'exasol' STATEMENT 'SELECT 1 FROM \"NATIVE_EXA_IT\".\"SIMPLE_VALUES\"'",
+ IS_LOCAL);
+ }
+
+ @Test
+ public void testVirtualSchemaImportFromEXAWithConnectionStringUserPassword() throws SQLException, FileNotFoundException {
+ final String connectionString = "jdbc:exa:localhost:" + getPortOfConnectedDatabase();
+ createVirtualSchema("VS_EXA_WITH_USER_PW", ExasolSqlDialect.getPublicName(), "", TEST_SCHEMA, "",
+ getConfig().getExasolUser(), getConfig().getExasolPassword(), "ADAPTER.JDBC_ADAPTER", connectionString,
+ false, "", "", "IMPORT_FROM_EXA = 'true' EXA_CONNECTION_STRING = 'localhost:" + getPortOfConnectedDatabase() + "'", "");
+ final String query = "SELECT 1 FROM VS_EXA_WITH_USER_PW.SIMPLE_VALUES";
+ final ResultSet result = executeQuery(query);
+ matchNextRow(result, new Short("1"));
+ matchSingleRowExplain(query, "IMPORT FROM EXA AT 'localhost:8888' USER 'sys' IDENTIFIED BY 'exasol' STATEMENT 'SELECT 1 FROM \"NATIVE_EXA_IT\".\"SIMPLE_VALUES\"'",
+ IS_LOCAL);
+ }
+
+
/**
* This was replaced by integration test {@link #testDataTypeMapping()}. It can
* be enabled temporarily for debugging.
@@ -301,7 +410,7 @@ public void testErrorMessages() throws SQLException, FileNotFoundException {
@Ignore
@Test
public void testDifferentDataTypes()
- throws SQLException, ClassNotFoundException, FileNotFoundException, AdapterException {
+ throws SQLException, FileNotFoundException, AdapterException {
final Statement stmt = getConnection().createStatement();
createOrReplaceSchema(stmt);
createTables(stmt);
diff --git a/jdbc-adapter/virtualschema-jdbc-adapter/src/test/java/com/exasol/adapter/dialects/impl/ExasolSqlDialectTest.java b/jdbc-adapter/virtualschema-jdbc-adapter/src/test/java/com/exasol/adapter/dialects/impl/ExasolSqlDialectTest.java
index 50463cb9f..ce7be2993 100644
--- a/jdbc-adapter/virtualschema-jdbc-adapter/src/test/java/com/exasol/adapter/dialects/impl/ExasolSqlDialectTest.java
+++ b/jdbc-adapter/virtualschema-jdbc-adapter/src/test/java/com/exasol/adapter/dialects/impl/ExasolSqlDialectTest.java
@@ -7,8 +7,8 @@
import com.exasol.adapter.dialects.SqlGenerationContext;
import com.exasol.adapter.dialects.SqlGenerationVisitor;
import com.exasol.adapter.sql.SqlNode;
-import com.exasol.utils.SqlTestUtil;
import org.junit.Test;
+import utils.SqlTestUtil;
import static org.junit.Assert.assertEquals;
diff --git a/jdbc-adapter/virtualschema-jdbc-adapter/src/test/java/com/exasol/adapter/dialects/impl/GenericSqlDialectIT.java b/jdbc-adapter/virtualschema-jdbc-adapter/src/test/java/com/exasol/adapter/dialects/impl/GenericSqlDialectIT.java
index b11917072..ffb814851 100644
--- a/jdbc-adapter/virtualschema-jdbc-adapter/src/test/java/com/exasol/adapter/dialects/impl/GenericSqlDialectIT.java
+++ b/jdbc-adapter/virtualschema-jdbc-adapter/src/test/java/com/exasol/adapter/dialects/impl/GenericSqlDialectIT.java
@@ -29,7 +29,7 @@ public static void setUpClass() throws FileNotFoundException, SQLException, Clas
final String schemaName = "";
createVirtualSchema("VS_GENERIC_MYSQL", GenericSqlDialect.getPublicName(), catalogName, schemaName, "",
getConfig().getGenericUser(), getConfig().getGenericPassword(), "ADAPTER.JDBC_ADAPTER",
- connectionString, IS_LOCAL, getConfig().debugAddress(), "", null);
+ connectionString, IS_LOCAL, getConfig().debugAddress(), "", null,"");
}
@Test
diff --git a/jdbc-adapter/virtualschema-jdbc-adapter/src/test/java/com/exasol/adapter/dialects/impl/HiveSqlDialectIT.java b/jdbc-adapter/virtualschema-jdbc-adapter/src/test/java/com/exasol/adapter/dialects/impl/HiveSqlDialectIT.java
index af46d9cdf..e53ebbffa 100644
--- a/jdbc-adapter/virtualschema-jdbc-adapter/src/test/java/com/exasol/adapter/dialects/impl/HiveSqlDialectIT.java
+++ b/jdbc-adapter/virtualschema-jdbc-adapter/src/test/java/com/exasol/adapter/dialects/impl/HiveSqlDialectIT.java
@@ -32,7 +32,7 @@ public static void setUpClass() throws FileNotFoundException, SQLException, Clas
createHiveJDBCAdapter();
createVirtualSchema(VIRTUAL_SCHEMA, HiveSqlDialect.getPublicName(), "", HIVE_SCHEMA, "", "hdfs", "hdfs",
"ADAPTER.JDBC_ADAPTER", getConfig().getHiveJdbcConnectionString(), IS_LOCAL, getConfig().debugAddress(),
- "ALL_HIVE_DATA_TYPES", null);
+ "ALL_HIVE_DATA_TYPES", null,"");
}
@Test
diff --git a/jdbc-adapter/virtualschema-jdbc-adapter/src/test/java/com/exasol/adapter/dialects/impl/ImpalaSqlDialectIT.java b/jdbc-adapter/virtualschema-jdbc-adapter/src/test/java/com/exasol/adapter/dialects/impl/ImpalaSqlDialectIT.java
index ffb46ebb6..4d3fd2494 100644
--- a/jdbc-adapter/virtualschema-jdbc-adapter/src/test/java/com/exasol/adapter/dialects/impl/ImpalaSqlDialectIT.java
+++ b/jdbc-adapter/virtualschema-jdbc-adapter/src/test/java/com/exasol/adapter/dialects/impl/ImpalaSqlDialectIT.java
@@ -33,7 +33,7 @@ public static void setUpClass() throws FileNotFoundException, SQLException, Clas
createImpalaJDBCAdapter();
createVirtualSchema(VIRTUAL_SCHEMA, ImpalaSqlDialect.getPublicName(), "", IMPALA_SCHEMA, "", "no-user",
"no-password", "ADAPTER.JDBC_ADAPTER", getConfig().getImpalaJdbcConnectionString(), IS_LOCAL,
- getConfig().debugAddress(), "SAMPLE_07,ALL_HIVE_IMPALA_TYPES,SIMPLE,SIMPLE_WITH_NULLS", null);
+ getConfig().debugAddress(), "SAMPLE_07,ALL_HIVE_IMPALA_TYPES,SIMPLE,SIMPLE_WITH_NULLS", null,"");
}
@Test
diff --git a/jdbc-adapter/virtualschema-jdbc-adapter/src/test/java/com/exasol/adapter/dialects/impl/KerberosIT.java b/jdbc-adapter/virtualschema-jdbc-adapter/src/test/java/com/exasol/adapter/dialects/impl/KerberosIT.java
index 26b1de6bf..3f47633e7 100644
--- a/jdbc-adapter/virtualschema-jdbc-adapter/src/test/java/com/exasol/adapter/dialects/impl/KerberosIT.java
+++ b/jdbc-adapter/virtualschema-jdbc-adapter/src/test/java/com/exasol/adapter/dialects/impl/KerberosIT.java
@@ -42,7 +42,7 @@ public static void setUpClass() throws FileNotFoundException, SQLException, Clas
@Test
public void testKerberosVirtualSchema() throws SQLException, ClassNotFoundException, FileNotFoundException {
createVirtualSchema(VIRTUAL_SCHEMA, ExasolSqlDialect.getPublicName(), "", "default", CONNECTION_NAME, "", "",
- "ADAPTER.JDBC_ADAPTER", "", IS_LOCAL, getConfig().debugAddress(), "", null);
+ "ADAPTER.JDBC_ADAPTER", "", IS_LOCAL, getConfig().debugAddress(), "", null,"");
final Statement stmt = getConnection().createStatement();
final ResultSet result = stmt.executeQuery("SELECT * FROM \"sample_07\"");
result.next();
@@ -69,7 +69,7 @@ public void testKerberosVirtualSchemaGrantConnection()
final Connection conn2 = connectToExa(userName, userName);
final Statement stmt2 = conn2.createStatement();
createVirtualSchema(conn2, VIRTUAL_SCHEMA, ExasolSqlDialect.getPublicName(), "", "default", CONNECTION_NAME, "",
- "", adapterName, "", false, getConfig().debugAddress(), "", null);
+ "", adapterName, "", false, getConfig().debugAddress(), "", null,"");
final ResultSet result = stmt2.executeQuery("SELECT * FROM \"sample_07\"");
result.next();
assertEquals("00-0000", result.getString(1));
diff --git a/jdbc-adapter/virtualschema-jdbc-adapter/src/test/java/com/exasol/adapter/dialects/impl/OracleSqlDialectIT.java b/jdbc-adapter/virtualschema-jdbc-adapter/src/test/java/com/exasol/adapter/dialects/impl/OracleSqlDialectIT.java
index ab2d86f0a..1cd7efae3 100644
--- a/jdbc-adapter/virtualschema-jdbc-adapter/src/test/java/com/exasol/adapter/dialects/impl/OracleSqlDialectIT.java
+++ b/jdbc-adapter/virtualschema-jdbc-adapter/src/test/java/com/exasol/adapter/dialects/impl/OracleSqlDialectIT.java
@@ -55,14 +55,14 @@ public static void beforeMethod() throws FileNotFoundException, SQLException, Cl
getConfig().getOracleUser(), getConfig().getOraclePassword(),
// "ADAPTER.JDBC_ORACLE_DEBUG",
"ADAPTER.JDBC_ORACLE", getConfig().getOracleJdbcConnectionString(), IS_LOCAL,
- getConfig().debugAddress(), TEST_TABLE, null);
+ getConfig().debugAddress(), TEST_TABLE, null,"");
// create IMPORT FROM ORA virtual schema
createVirtualSchema(VIRTUAL_SCHEMA_IMPORT, OracleSqlDialect.getPublicName(), "", ORACLE_SCHEMA, "",
getConfig().getOracleUser(), getConfig().getOraclePassword(),
// "ADAPTER.JDBC_ORACLE_DEBUG",
"ADAPTER.JDBC_ORACLE", getConfig().getOracleJdbcConnectionString(), IS_LOCAL,
- getConfig().debugAddress(), TEST_TABLE, "IMPORT_FROM_ORA='true' ORA_CONNECTION_NAME='CONN_ORACLE'");
+ getConfig().debugAddress(), TEST_TABLE, "IMPORT_FROM_ORA='true' ORA_CONNECTION_NAME='CONN_ORACLE'","");
}
private static void createOracleJDBCAdapter() throws SQLException, FileNotFoundException {
diff --git a/jdbc-adapter/virtualschema-jdbc-adapter/src/test/java/com/exasol/adapter/dialects/impl/OracleSqlDialectTest.java b/jdbc-adapter/virtualschema-jdbc-adapter/src/test/java/com/exasol/adapter/dialects/impl/OracleSqlDialectTest.java
index 41427237d..472e0d871 100644
--- a/jdbc-adapter/virtualschema-jdbc-adapter/src/test/java/com/exasol/adapter/dialects/impl/OracleSqlDialectTest.java
+++ b/jdbc-adapter/virtualschema-jdbc-adapter/src/test/java/com/exasol/adapter/dialects/impl/OracleSqlDialectTest.java
@@ -9,9 +9,9 @@
import com.exasol.adapter.sql.SqlNode;
import com.exasol.adapter.sql.SqlSelectList;
import com.exasol.adapter.sql.SqlStatementSelect;
-import com.exasol.utils.SqlTestUtil;
import org.junit.Test;
import org.mockito.Mockito;
+import utils.SqlTestUtil;
import static org.junit.Assert.assertEquals;
diff --git a/jdbc-adapter/virtualschema-jdbc-adapter/src/test/java/com/exasol/adapter/dialects/impl/PostgreSQLDialectIT.java b/jdbc-adapter/virtualschema-jdbc-adapter/src/test/java/com/exasol/adapter/dialects/impl/PostgreSQLDialectIT.java
index 52b6b03da..3792cd4dc 100644
--- a/jdbc-adapter/virtualschema-jdbc-adapter/src/test/java/com/exasol/adapter/dialects/impl/PostgreSQLDialectIT.java
+++ b/jdbc-adapter/virtualschema-jdbc-adapter/src/test/java/com/exasol/adapter/dialects/impl/PostgreSQLDialectIT.java
@@ -48,11 +48,11 @@ public static void setUpClass() throws FileNotFoundException, SQLException, Clas
createPostgreSQLJDBCAdapter();
createVirtualSchema(VIRTUAL_SCHEMA, PostgreSQLSqlDialect.getPublicName(), POSTGRES_CATALOG, POSTGRES_SCHEMA, "", getConfig().getPostgresqlUser(),
getConfig().getPostgresqlPassword(), "ADAPTER.JDBC_ADAPTER", getConfig().getPostgresqlDockerJdbcConnectionString(),
- IS_LOCAL, getConfig().debugAddress(), "", null);
+ IS_LOCAL, getConfig().debugAddress(), "", null, "");
createVirtualSchema(VIRTUAL_SCHEMA_UPPERCASE_TABLE, PostgreSQLSqlDialect.getPublicName(), POSTGRES_CATALOG, POSTGRES_SCHEMA_UPPERCASE_TABLE, "",
getConfig().getPostgresqlUser(), getConfig().getPostgresqlPassword(), "ADAPTER.JDBC_ADAPTER",
getConfig().getPostgresqlDockerJdbcConnectionString(), IS_LOCAL, getConfig().debugAddress(), "",
- "ignore_errors='POSTGRESQL_UPPERCASE_TABLES'");
+ "ignore_errors='POSTGRESQL_UPPERCASE_TABLES'", "");
}
private static void createTestSchema() throws SQLException, ClassNotFoundException, FileNotFoundException {
@@ -101,7 +101,7 @@ public void testCreateSchemaWithUpperCaseTables() throws SQLException, ClassNotF
expectedEx.expectMessage("Table UPPer_t cannot be used in virtual schema. Set property IGNORE_ERRORS to POSTGRESQL_UPPERCASE_TABLES to enforce schema creation.");
createVirtualSchema("FOO", PostgreSQLSqlDialect.getPublicName(), POSTGRES_CATALOG, POSTGRES_SCHEMA_UPPERCASE_TABLE, "",
getConfig().getPostgresqlUser(), getConfig().getPostgresqlPassword(), "ADAPTER.JDBC_ADAPTER",
- getConfig().getPostgresqlDockerJdbcConnectionString(), IS_LOCAL, getConfig().debugAddress(), "", null);
+ getConfig().getPostgresqlDockerJdbcConnectionString(), IS_LOCAL, getConfig().debugAddress(), "", null, "JOIN");
}
@Test
diff --git a/jdbc-adapter/virtualschema-jdbc-adapter/src/test/java/com/exasol/adapter/dialects/impl/SybaseSqlDialectIT.java b/jdbc-adapter/virtualschema-jdbc-adapter/src/test/java/com/exasol/adapter/dialects/impl/SybaseSqlDialectIT.java
index dd37676ca..1668e66b1 100644
--- a/jdbc-adapter/virtualschema-jdbc-adapter/src/test/java/com/exasol/adapter/dialects/impl/SybaseSqlDialectIT.java
+++ b/jdbc-adapter/virtualschema-jdbc-adapter/src/test/java/com/exasol/adapter/dialects/impl/SybaseSqlDialectIT.java
@@ -26,7 +26,7 @@ public static void setUpClass() throws FileNotFoundException, SQLException, Clas
final String schemaName = "tester";
createVirtualSchema(VS_NAME, SybaseSqlDialect.getPublicName(), catalogName, schemaName, "",
getConfig().getSybaseUser(), getConfig().getSybasePassword(), "ADAPTER.JDBC_ADAPTER",
- getConfig().getSybaseJdbcConnectionString(), IS_LOCAL, getConfig().debugAddress(), "", null);
+ getConfig().getSybaseJdbcConnectionString(), IS_LOCAL, getConfig().debugAddress(), "", null,"");
}
private static void createSybaseJDBCAdapter() throws SQLException, FileNotFoundException {
diff --git a/jdbc-adapter/virtualschema-jdbc-adapter/src/test/java/com/exasol/adapter/dialects/impl/TeradataSqlDialectIT.java b/jdbc-adapter/virtualschema-jdbc-adapter/src/test/java/com/exasol/adapter/dialects/impl/TeradataSqlDialectIT.java
index 30d0a0b64..1bf42dec7 100644
--- a/jdbc-adapter/virtualschema-jdbc-adapter/src/test/java/com/exasol/adapter/dialects/impl/TeradataSqlDialectIT.java
+++ b/jdbc-adapter/virtualschema-jdbc-adapter/src/test/java/com/exasol/adapter/dialects/impl/TeradataSqlDialectIT.java
@@ -31,7 +31,7 @@ public static void setUpClass() throws FileNotFoundException, SQLException, Clas
createVirtualSchema(VIRTUAL_SCHEMA, TeradataSqlDialect.getPublicName(), "", TERADATA_SCHEMA, "",
getConfig().getTeradataUser(), getConfig().getTeradataPassword(), "ADAPTER.JDBC_ADAPTER",
getConfig().getTeradataJdbcConnectionString(), false, getConfig().debugAddress(),
- "numeric_data_types, REGION, DateTime_and_Interval_Data_Types, Period_Data_Types", null);
+ "numeric_data_types, REGION, DateTime_and_Interval_Data_Types, Period_Data_Types", null,"");
}
// @Test
diff --git a/jdbc-adapter/virtualschema-jdbc-adapter/src/test/java/com/exasol/adapter/jdbc/JdbcAdapterTest.java b/jdbc-adapter/virtualschema-jdbc-adapter/src/test/java/com/exasol/adapter/jdbc/JdbcAdapterTest.java
new file mode 100644
index 000000000..37d27d491
--- /dev/null
+++ b/jdbc-adapter/virtualschema-jdbc-adapter/src/test/java/com/exasol/adapter/jdbc/JdbcAdapterTest.java
@@ -0,0 +1,81 @@
+package com.exasol.adapter.jdbc;
+
+import com.exasol.ExaConnectionAccessException;
+import com.exasol.ExaConnectionInformation;
+import com.exasol.ExaMetadata;
+import com.exasol.adapter.metadata.SchemaMetadataInfo;
+import org.junit.Before;
+import org.junit.Test;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import static org.junit.Assert.*;
+import static org.mockito.Matchers.any;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+public class JdbcAdapterTest {
+ private ExaConnectionInformation exaConnectionInformation;
+ private ExaMetadata exaMetadata;
+ private SchemaMetadataInfo schemaMetadataInfoConnectionStringUserPassword;
+ private SchemaMetadataInfo schemaMetadataInfoConnectionName;
+
+
+ @Before
+ public void setUp() throws ExaConnectionAccessException {
+ exaConnectionInformation = mock(ExaConnectionInformation.class);
+ exaMetadata = mock(ExaMetadata.class);
+
+ when(exaConnectionInformation.getUser()).thenReturn("testCommUser");
+ when(exaConnectionInformation.getPassword()).thenReturn("testConnPassword");
+ when(exaConnectionInformation.getAddress()).thenReturn("testConnAddress");
+ when(exaMetadata.getConnection(any())).thenReturn(exaConnectionInformation);
+
+ Map propertiesConnectionStringUserPassword = new HashMap<>();
+ propertiesConnectionStringUserPassword.put("CONNECTION_STRING", "testConnectionString");
+ propertiesConnectionStringUserPassword.put("USERNAME", "testUsername");
+ propertiesConnectionStringUserPassword.put("PASSWORD", "testPassword");
+ schemaMetadataInfoConnectionStringUserPassword = new SchemaMetadataInfo("", "", propertiesConnectionStringUserPassword);
+
+ Map propertiesConnectionName = new HashMap<>();
+ propertiesConnectionName.put("CONNECTION_NAME", "CONN_NAME");
+ schemaMetadataInfoConnectionName = new SchemaMetadataInfo("", "", propertiesConnectionName);
+ }
+
+ @Test
+ public void getCredentialsForJDBCImportWithConnectionNameGiven() {
+ final String credentials = JdbcAdapter.getCredentialsForJDBCImport(exaMetadata, schemaMetadataInfoConnectionName);
+ assertEquals("CONN_NAME", credentials);
+ }
+
+ @Test
+ public void getCredentialsForORAImportWithConnectionNameGiven() {
+ final String credentials = JdbcAdapter.getCredentialsForORAImport(exaMetadata, schemaMetadataInfoConnectionName);
+ assertEquals("", credentials);
+ }
+
+ @Test
+ public void getCredentialsForEXAImportWithConnectionNameGiven() {
+ final String credentials = JdbcAdapter.getCredentialsForEXAImport(exaMetadata, schemaMetadataInfoConnectionName);
+ assertEquals("USER 'testCommUser' IDENTIFIED BY 'testConnPassword'", credentials);
+ }
+
+ @Test
+ public void getCredentialsForJDBCImportWithConnectionStringUsernamePasswordGiven() {
+ final String credentials = JdbcAdapter.getCredentialsForJDBCImport(exaMetadata, schemaMetadataInfoConnectionStringUserPassword);
+ assertEquals("'testConnectionString' USER 'testUsername' IDENTIFIED BY 'testPassword'", credentials);
+ }
+
+ @Test
+ public void getCredentialsForORAImportWithConnectionStringUsernamePasswordGiven() {
+ final String credentials = JdbcAdapter.getCredentialsForORAImport(exaMetadata, schemaMetadataInfoConnectionStringUserPassword);
+ assertEquals("USER 'testUsername' IDENTIFIED BY 'testPassword'", credentials);
+ }
+
+ @Test
+ public void getCredentialsForEXAImportWithConnectionStringUsernamePasswordGiven() {
+ final String credentials = JdbcAdapter.getCredentialsForEXAImport(exaMetadata, schemaMetadataInfoConnectionStringUserPassword);
+ assertEquals("USER 'testUsername' IDENTIFIED BY 'testPassword'", credentials);
+ }
+}
\ No newline at end of file
diff --git a/jdbc-adapter/virtualschema-jdbc-adapter/src/test/java/utils/SqlTestUtil.java b/jdbc-adapter/virtualschema-jdbc-adapter/src/test/java/utils/SqlTestUtil.java
new file mode 100644
index 000000000..cdcb7e95a
--- /dev/null
+++ b/jdbc-adapter/virtualschema-jdbc-adapter/src/test/java/utils/SqlTestUtil.java
@@ -0,0 +1,17 @@
+package utils;
+
+public final class SqlTestUtil {
+ private SqlTestUtil(){
+ //Intentionally left blank
+ }
+
+ /**
+ * Convert newlines, tabs, and double whitespaces to whitespaces. At the end only single whitespaces remain.
+ */
+ public static String normalizeSql(final String sql) {
+ return sql.replaceAll("\t", " ")
+ .replaceAll("\n", " ")
+ .replaceAll("\\s+", " ");
+ }
+}
+
diff --git a/jdbc-adapter/virtualschema-jdbc-adapter/src/test/resources/integration/vschema_all_join_types.json b/jdbc-adapter/virtualschema-jdbc-adapter/src/test/resources/integration/vschema_all_join_types.json
new file mode 100644
index 000000000..396c262be
--- /dev/null
+++ b/jdbc-adapter/virtualschema-jdbc-adapter/src/test/resources/integration/vschema_all_join_types.json
@@ -0,0 +1,474 @@
+{
+ "testSchema" :
+ [
+ "create table t1(id int)",
+ "create table t2(id int)"
+ ],
+ "testCases" :
+ [
+ {
+ "testQuery": "select * from vs.t1 inner join vs.t2 on vs.t1.id=vs.t2.id",
+ "testDescription" : "pushdown of INNER JOIN",
+ "expectedPushdownRequest":
+ [
+ {
+ "involvedTables" :
+ [
+ {
+ "columns" :
+ [
+ {
+ "adapterNotes" : "{\"jdbcDataType\":3,\"typeName\":\"DECIMAL\"}",
+ "dataType" :
+ {
+ "precision" : 18,
+ "scale" : 0,
+ "type" : "DECIMAL"
+ },
+ "name" : "ID"
+ }
+ ],
+ "name" : "T1"
+ },
+ {
+ "columns" :
+ [
+ {
+ "adapterNotes" : "{\"jdbcDataType\":3,\"typeName\":\"DECIMAL\"}",
+ "dataType" :
+ {
+ "precision" : 18,
+ "scale" : 0,
+ "type" : "DECIMAL"
+ },
+ "name" : "ID"
+ }
+ ],
+ "name" : "T2"
+ }
+ ],
+ "pushdownRequest" :
+ {
+ "type" : "select",
+ "selectList" :
+ [
+ {
+ "columnNr" : 0,
+ "name" : "ID",
+ "tableName" : "T1",
+ "type" : "column"
+ },
+ {
+ "columnNr" : 0,
+ "name" : "ID",
+ "tableName" : "T2",
+ "type" : "column"
+ }
+ ],
+ "from" :
+ {
+ "type": "join",
+ "join_type": "inner",
+ "left":
+ {
+ "name" : "T1",
+ "type" : "table"
+ },
+ "right":
+ {
+ "name" : "T2",
+ "type" : "table"
+ },
+ "condition":
+ {
+ "left" :
+ {
+ "columnNr" : 0,
+ "name" : "ID",
+ "tableName" : "T1",
+ "type" : "column"
+ },
+ "right" :
+ {
+ "columnNr" : 0,
+ "name" : "ID",
+ "tableName" : "T2",
+ "type" : "column"
+ },
+ "type" : "predicate_equal"
+ }
+ }
+ },
+ "type" : "pushdown"
+ }
+ ],
+ "expectedPushdownResponse":
+ {
+ "Exasol":
+ [
+ "SELECT \"T1\".\"ID\", \"T2\".\"ID\" FROM \"LS\".\"T1\" INNER JOIN \"LS\".\"T2\" ON \"T1\".\"ID\" = \"T2\".\"ID\""
+ ],
+ "Oracle":
+ [
+ "SELECT \"T1\".\"ID\", \"T2\".\"ID\" FROM \"LS\".\"T1\" INNER JOIN \"LS\".\"T2\" ON \"T1\".\"ID\" = \"T2\".\"ID\""
+ ],
+ "PostgreSQL":
+ [
+ "SELECT \"t1\".\"id\", \"t2\".\"id\" FROM \"ls\".\"t1\" INNER JOIN \"ls\".\"t2\" ON \"t1\".\"id\" = \"t2\".\"id\""
+ ],
+ "Hive":
+ [
+ "SELECT `T1`.`ID`, `T2`.`ID` FROM `LS`.`T1` INNER JOIN `LS`.`T2` ON `T1`.`ID` = `T2`.`ID`"
+ ]
+ }
+ },
+ {
+ "testQuery": "select * from vs.t1 left join vs.t2 on vs.t1.id=vs.t2.id",
+ "testDescription" : "pushdown of LEFT JOIN",
+ "expectedPushdownRequest":
+ [
+ {
+ "involvedTables" :
+ [
+ {
+ "columns" :
+ [
+ {
+ "adapterNotes" : "{\"jdbcDataType\":3,\"typeName\":\"DECIMAL\"}",
+ "dataType" :
+ {
+ "precision" : 18,
+ "scale" : 0,
+ "type" : "DECIMAL"
+ },
+ "name" : "ID"
+ }
+ ],
+ "name" : "T1"
+ },
+ {
+ "columns" :
+ [
+ {
+ "adapterNotes" : "{\"jdbcDataType\":3,\"typeName\":\"DECIMAL\"}",
+ "dataType" :
+ {
+ "precision" : 18,
+ "scale" : 0,
+ "type" : "DECIMAL"
+ },
+ "name" : "ID"
+ }
+ ],
+ "name" : "T2"
+ }
+ ],
+ "pushdownRequest" :
+ {
+ "type" : "select",
+ "selectList" :
+ [
+ {
+ "columnNr" : 0,
+ "name" : "ID",
+ "tableName" : "T1",
+ "type" : "column"
+ },
+ {
+ "columnNr" : 0,
+ "name" : "ID",
+ "tableName" : "T2",
+ "type" : "column"
+ }
+ ],
+ "from" :
+ {
+ "type": "join",
+ "join_type": "left_outer",
+ "left":
+ {
+ "name" : "T1",
+ "type" : "table"
+ },
+ "right":
+ {
+ "name" : "T2",
+ "type" : "table"
+ },
+ "condition":
+ {
+ "left" :
+ {
+ "columnNr" : 0,
+ "name" : "ID",
+ "tableName" : "T1",
+ "type" : "column"
+ },
+ "right" :
+ {
+ "columnNr" : 0,
+ "name" : "ID",
+ "tableName" : "T2",
+ "type" : "column"
+ },
+ "type" : "predicate_equal"
+ }
+ }
+ },
+ "type" : "pushdown"
+ }
+ ],
+ "expectedPushdownResponse":
+ {
+ "Exasol":
+ [
+ "SELECT \"T1\".\"ID\", \"T2\".\"ID\" FROM \"LS\".\"T1\" LEFT OUTER JOIN \"LS\".\"T2\" ON \"T1\".\"ID\" = \"T2\".\"ID\""
+ ],
+ "Oracle":
+ [
+ "SELECT \"T1\".\"ID\", \"T2\".\"ID\" FROM \"LS\".\"T1\" LEFT OUTER JOIN \"LS\".\"T2\" ON \"T1\".\"ID\" = \"T2\".\"ID\""
+ ],
+ "PostgreSQL":
+ [
+ "SELECT \"t1\".\"id\", \"t2\".\"id\" FROM \"ls\".\"t1\" LEFT OUTER JOIN \"ls\".\"t2\" ON \"t1\".\"id\" = \"t2\".\"id\""
+ ],
+ "Hive":
+ [
+ "SELECT `T1`.`ID`, `T2`.`ID` FROM `LS`.`T1` LEFT OUTER JOIN `LS`.`T2` ON `T1`.`ID` = `T2`.`ID`"
+ ]
+ }
+ },
+ {
+ "testQuery": "select * from vs.t1 right join vs.t2 on vs.t1.id=vs.t2.id",
+ "testDescription" : "pushdown of RIGHT JOIN",
+ "expectedPushdownRequest":
+ [
+ {
+ "involvedTables" :
+ [
+ {
+ "columns" :
+ [
+ {
+ "adapterNotes" : "{\"jdbcDataType\":3,\"typeName\":\"DECIMAL\"}",
+ "dataType" :
+ {
+ "precision" : 18,
+ "scale" : 0,
+ "type" : "DECIMAL"
+ },
+ "name" : "ID"
+ }
+ ],
+ "name" : "T1"
+ },
+ {
+ "columns" :
+ [
+ {
+ "adapterNotes" : "{\"jdbcDataType\":3,\"typeName\":\"DECIMAL\"}",
+ "dataType" :
+ {
+ "precision" : 18,
+ "scale" : 0,
+ "type" : "DECIMAL"
+ },
+ "name" : "ID"
+ }
+ ],
+ "name" : "T2"
+ }
+ ],
+ "pushdownRequest" :
+ {
+ "type" : "select",
+ "selectList" :
+ [
+ {
+ "columnNr" : 0,
+ "name" : "ID",
+ "tableName" : "T1",
+ "type" : "column"
+ },
+ {
+ "columnNr" : 0,
+ "name" : "ID",
+ "tableName" : "T2",
+ "type" : "column"
+ }
+ ],
+ "from" :
+ {
+ "type": "join",
+ "join_type": "right_outer",
+ "left":
+ {
+ "name" : "T1",
+ "type" : "table"
+ },
+ "right":
+ {
+ "name" : "T2",
+ "type" : "table"
+ },
+ "condition":
+ {
+ "left" :
+ {
+ "columnNr" : 0,
+ "name" : "ID",
+ "tableName" : "T1",
+ "type" : "column"
+ },
+ "right" :
+ {
+ "columnNr" : 0,
+ "name" : "ID",
+ "tableName" : "T2",
+ "type" : "column"
+ },
+ "type" : "predicate_equal"
+ }
+ }
+ },
+ "type" : "pushdown"
+ }
+ ],
+ "expectedPushdownResponse":
+ {
+ "Exasol":
+ [
+ "SELECT \"T1\".\"ID\", \"T2\".\"ID\" FROM \"LS\".\"T1\" RIGHT OUTER JOIN \"LS\".\"T2\" ON \"T1\".\"ID\" = \"T2\".\"ID\""
+ ],
+ "Oracle":
+ [
+ "SELECT \"T1\".\"ID\", \"T2\".\"ID\" FROM \"LS\".\"T1\" RIGHT OUTER JOIN \"LS\".\"T2\" ON \"T1\".\"ID\" = \"T2\".\"ID\""
+ ],
+ "PostgreSQL":
+ [
+ "SELECT \"t1\".\"id\", \"t2\".\"id\" FROM \"ls\".\"t1\" RIGHT OUTER JOIN \"ls\".\"t2\" ON \"t1\".\"id\" = \"t2\".\"id\""
+ ],
+ "Hive":
+ [
+ "SELECT `T1`.`ID`, `T2`.`ID` FROM `LS`.`T1` RIGHT OUTER JOIN `LS`.`T2` ON `T1`.`ID` = `T2`.`ID`"
+ ]
+ }
+ },
+ {
+ "testQuery": "select * from vs.t1 full join vs.t2 on vs.t1.id=vs.t2.id",
+ "testDescription" : "pushdown of FULL JOIN",
+ "expectedPushdownRequest":
+ [
+ {
+ "involvedTables" :
+ [
+ {
+ "columns" :
+ [
+ {
+ "adapterNotes" : "{\"jdbcDataType\":3,\"typeName\":\"DECIMAL\"}",
+ "dataType" :
+ {
+ "precision" : 18,
+ "scale" : 0,
+ "type" : "DECIMAL"
+ },
+ "name" : "ID"
+ }
+ ],
+ "name" : "T1"
+ },
+ {
+ "columns" :
+ [
+ {
+ "adapterNotes" : "{\"jdbcDataType\":3,\"typeName\":\"DECIMAL\"}",
+ "dataType" :
+ {
+ "precision" : 18,
+ "scale" : 0,
+ "type" : "DECIMAL"
+ },
+ "name" : "ID"
+ }
+ ],
+ "name" : "T2"
+ }
+ ],
+ "pushdownRequest" :
+ {
+ "type" : "select",
+ "selectList" :
+ [
+ {
+ "columnNr" : 0,
+ "name" : "ID",
+ "tableName" : "T1",
+ "type" : "column"
+ },
+ {
+ "columnNr" : 0,
+ "name" : "ID",
+ "tableName" : "T2",
+ "type" : "column"
+ }
+ ],
+ "from" :
+ {
+ "type": "join",
+ "join_type": "full_outer",
+ "left":
+ {
+ "name" : "T1",
+ "type" : "table"
+ },
+ "right":
+ {
+ "name" : "T2",
+ "type" : "table"
+ },
+ "condition":
+ {
+ "left" :
+ {
+ "columnNr" : 0,
+ "name" : "ID",
+ "tableName" : "T1",
+ "type" : "column"
+ },
+ "right" :
+ {
+ "columnNr" : 0,
+ "name" : "ID",
+ "tableName" : "T2",
+ "type" : "column"
+ },
+ "type" : "predicate_equal"
+ }
+ }
+ },
+ "type" : "pushdown"
+ }
+ ],
+ "expectedPushdownResponse":
+ {
+ "Exasol":
+ [
+ "SELECT \"T1\".\"ID\", \"T2\".\"ID\" FROM \"LS\".\"T1\" FULL OUTER JOIN \"LS\".\"T2\" ON \"T1\".\"ID\" = \"T2\".\"ID\""
+ ],
+ "Oracle":
+ [
+ "SELECT \"T1\".\"ID\", \"T2\".\"ID\" FROM \"LS\".\"T1\" FULL OUTER JOIN \"LS\".\"T2\" ON \"T1\".\"ID\" = \"T2\".\"ID\""
+ ],
+ "PostgreSQL":
+ [
+ "SELECT \"t1\".\"id\", \"t2\".\"id\" FROM \"ls\".\"t1\" FULL OUTER JOIN \"ls\".\"t2\" ON \"t1\".\"id\" = \"t2\".\"id\""
+ ],
+ "Hive":
+ [
+ "SELECT `T1`.`ID`, `T2`.`ID` FROM `LS`.`T1` FULL OUTER JOIN `LS`.`T2` ON `T1`.`ID` = `T2`.`ID`"
+ ]
+ }
+ }
+ ]
+}
diff --git a/jdbc-adapter/virtualschema-jdbc-adapter/src/test/resources/integration/vschema_complex_inner_join.json b/jdbc-adapter/virtualschema-jdbc-adapter/src/test/resources/integration/vschema_complex_inner_join.json
new file mode 100644
index 000000000..e771d2791
--- /dev/null
+++ b/jdbc-adapter/virtualschema-jdbc-adapter/src/test/resources/integration/vschema_complex_inner_join.json
@@ -0,0 +1,240 @@
+{
+ "testSchema" :
+ [
+ "create table t1(id int, val int)",
+ "create table t2(id int, val int)"
+ ],
+ "testCases" :
+ [
+ {
+ "testQuery": "select a.id, b.id, sum(a.val), sum(b.val) from vs.t1 a inner join vs.t2 b on a.id=b.id group by a.id, b.id having sum(a.val) > 0 order by a.id limit 1000",
+ "expectedPushdownRequest":
+ [
+ {
+ "involvedTables" :
+ [
+ {
+ "columns" :
+ [
+ {
+ "adapterNotes" : "{\"jdbcDataType\":3,\"typeName\":\"DECIMAL\"}",
+ "dataType" :
+ {
+ "precision" : 18,
+ "scale" : 0,
+ "type" : "DECIMAL"
+ },
+ "name" : "ID"
+ },
+ {
+ "adapterNotes" : "{\"jdbcDataType\":3,\"typeName\":\"DECIMAL\"}",
+ "dataType" :
+ {
+ "precision" : 18,
+ "scale" : 0,
+ "type" : "DECIMAL"
+ },
+ "name" : "VAL"
+ }
+ ],
+ "name" : "T1"
+ },
+ {
+ "columns" :
+ [
+ {
+ "adapterNotes" : "{\"jdbcDataType\":3,\"typeName\":\"DECIMAL\"}",
+ "dataType" :
+ {
+ "precision" : 18,
+ "scale" : 0,
+ "type" : "DECIMAL"
+ },
+ "name" : "ID"
+ },
+ {
+ "adapterNotes" : "{\"jdbcDataType\":3,\"typeName\":\"DECIMAL\"}",
+ "dataType" :
+ {
+ "precision" : 18,
+ "scale" : 0,
+ "type" : "DECIMAL"
+ },
+ "name" : "VAL"
+ }
+ ],
+ "name" : "T2"
+ }
+ ],
+ "pushdownRequest" :
+ {
+ "type" : "select",
+ "selectList" :
+ [
+ {
+ "columnNr" : 0,
+ "name" : "ID",
+ "tableAlias" : "A",
+ "tableName" : "T1",
+ "type" : "column"
+ },
+ {
+ "columnNr" : 0,
+ "name" : "ID",
+ "tableAlias" : "B",
+ "tableName" : "T2",
+ "type" : "column"
+ },
+ {
+ "type" : "function_aggregate",
+ "name" : "sum",
+ "arguments" :
+ [
+ {
+ "columnNr" : 1,
+ "name" : "VAL",
+ "tableAlias" : "A",
+ "tableName" : "T1",
+ "type" : "column"
+ }
+ ]
+ },
+ {
+ "type" : "function_aggregate",
+ "name" : "sum",
+ "arguments" :
+ [
+ {
+ "columnNr" : 1,
+ "name" : "VAL",
+ "tableAlias" : "B",
+ "tableName" : "T2",
+ "type" : "column"
+ }
+ ]
+ }
+ ],
+ "from" :
+ {
+ "type": "join",
+ "join_type": "inner",
+ "left":
+ {
+ "name" : "T1",
+ "type" : "table",
+ "alias": "A"
+ },
+ "right":
+ {
+ "name" : "T2",
+ "type" : "table",
+ "alias": "B"
+ },
+ "condition":
+ {
+ "left" :
+ {
+ "columnNr" : 0,
+ "name" : "ID",
+ "tableName" : "T1",
+ "tableAlias" : "A",
+ "type" : "column"
+ },
+ "right" :
+ {
+ "columnNr" : 0,
+ "name" : "ID",
+ "tableName" : "T2",
+ "tableAlias" : "B",
+ "type" : "column"
+ },
+ "type" : "predicate_equal"
+ }
+ },
+ "groupBy" :
+ [
+ {
+ "columnNr" : 0,
+ "name" : "ID",
+ "tableAlias" : "A",
+ "tableName" : "T1",
+ "type" : "column"
+ },
+ {
+ "columnNr" : 0,
+ "name" : "ID",
+ "tableAlias" : "B",
+ "tableName" : "T2",
+ "type" : "column"
+ }
+ ],
+ "having" :
+ {
+ "type" : "predicate_less",
+ "left" :
+ {
+ "type" : "literal_exactnumeric",
+ "value" : "0"
+ },
+ "right" :
+ {
+ "type" : "function_aggregate",
+ "name" : "sum",
+ "arguments" :
+ [
+ {
+ "columnNr" : 1,
+ "name" : "VAL",
+ "tableAlias" : "A",
+ "tableName" : "T1",
+ "type" : "column"
+ }
+ ]
+ }
+ },
+ "orderBy" :
+ [
+ {
+ "expression" :
+ {
+ "columnNr" : 0,
+ "name" : "ID",
+ "tableName" : "T1",
+ "tableAlias" : "A",
+ "type" : "column"
+ },
+ "isAscending" : true,
+ "nullsLast" : true,
+ "type" : "order_by_element"
+ }
+ ],
+ "limit" :
+ {
+ "numElements" : 1000
+ }
+ },
+ "type" : "pushdown"
+ }
+ ],
+ "expectedPushdownResponse":
+ {
+ "Exasol":
+ [
+ "SELECT \"A\".\"ID\", \"B\".\"ID\", SUM(\"A\".\"VAL\"), SUM(\"B\".\"VAL\") FROM \"LS\".\"T1\" \"A\" INNER JOIN \"LS\".\"T2\" \"B\" ON \"A\".\"ID\" = \"B\".\"ID\" GROUP BY \"A\".\"ID\", \"B\".\"ID\" HAVING 0 < SUM(\"A\".\"VAL\") ORDER BY \"A\".\"ID\" LIMIT 1000"
+ ],
+ "Oracle":
+ [
+ "SELECT LIMIT_SUBSELECT.* FROM ( SELECT \"A\".\"ID\", \"B\".\"ID\", CAST(SUM(\"A\".\"VAL\") AS FLOAT), CAST(SUM(\"B\".\"VAL\") AS FLOAT) FROM \"LS\".\"T1\" \"A\" INNER JOIN \"LS\".\"T2\" \"B\" ON \"A\".\"ID\" = \"B\".\"ID\" GROUP BY \"A\".\"ID\", \"B\".\"ID\" HAVING 0 < SUM(\"A\".\"VAL\") ORDER BY \"A\".\"ID\" ) LIMIT_SUBSELECT WHERE ROWNUM <= 1000"
+ ],
+ "PostgreSQL":
+ [
+ "SELECT \"a\".\"id\", \"b\".\"id\", SUM(\"a\".\"val\"), SUM(\"b\".\"val\") FROM \"ls\".\"t1\" \"a\" INNER JOIN \"ls\".\"t2\" \"b\" ON \"a\".\"id\" = \"b\".\"id\" GROUP BY \"a\".\"id\", \"b\".\"id\" HAVING 0 < SUM(\"a\".\"val\") ORDER BY \"a\".\"id\" LIMIT 1000"
+ ],
+ "Hive":
+ [
+ "SELECT `A`.`ID`, `B`.`ID`, SUM(`A`.`VAL`), SUM(`B`.`VAL`) FROM `LS`.`T1` `A` INNER JOIN `LS`.`T2` `B` ON `A`.`ID` = `B`.`ID` GROUP BY `A`.`ID`, `B`.`ID` HAVING 0 < SUM(`A`.`VAL`) ORDER BY `A`.`ID` NULLS LAST LIMIT 1000"
+ ]
+ }
+ }
+ ]
+}
diff --git a/jdbc-adapter/virtualschema-jdbc-adapter/src/test/resources/integration/vschema_full_pushdown.json b/jdbc-adapter/virtualschema-jdbc-adapter/src/test/resources/integration/vschema_full_pushdown.json
new file mode 100644
index 000000000..1ac3f82db
--- /dev/null
+++ b/jdbc-adapter/virtualschema-jdbc-adapter/src/test/resources/integration/vschema_full_pushdown.json
@@ -0,0 +1,1348 @@
+{
+ "testSchema" :
+ [
+ "create table t1(a int, b int)",
+ "create table t2(x int, y int)"
+ ],
+ "testCases" :
+ [
+ {
+ "testQuery": "select b+1 from vs.t1",
+ "testDescription": "Full pushdown with select-list in case with only from and select-list",
+ "expectedPushdownRequest":
+ [
+ {
+ "involvedTables" :
+ [
+ {
+ "columns" :
+ [
+ {
+ "adapterNotes" : "{\"jdbcDataType\":3,\"typeName\":\"DECIMAL\"}",
+ "dataType" :
+ {
+ "precision" : 18,
+ "scale" : 0,
+ "type" : "DECIMAL"
+ },
+ "name" : "A"
+ },
+ {
+ "adapterNotes" : "{\"jdbcDataType\":3,\"typeName\":\"DECIMAL\"}",
+ "dataType" :
+ {
+ "precision" : 18,
+ "scale" : 0,
+ "type" : "DECIMAL"
+ },
+ "name" : "B"
+ }
+ ],
+ "name" : "T1"
+ }
+ ],
+ "pushdownRequest" :
+ {
+ "type" : "select",
+ "selectList":
+ [
+ {
+ "numArgs": 2,
+ "infix": true,
+ "type": "function_scalar",
+ "arguments":
+ [
+ {
+ "type": "column",
+ "tableName": "T1",
+ "name": "B",
+ "columnNr": 1
+ },
+ {
+ "type": "literal_exactnumeric",
+ "value": "1"
+ }
+ ],
+ "name": "ADD"
+ }
+ ],
+ "from" :
+ {
+ "type" : "table",
+ "name" : "T1"
+ }
+ },
+ "type" : "pushdown"
+ }
+ ],
+ "expectedPushdownResponse":
+ {
+ "Exasol":
+ [
+ "SELECT (\"B\" + 1) FROM \"LS\".\"T1\""
+ ],
+ "PostgreSQL":
+ [
+ "SELECT (\"b\" + 1) FROM \"ls\".\"t1\""
+ ],
+ "Oracle":
+ [
+ "SELECT CAST((\"B\" + 1) AS FLOAT) FROM \"LS\".\"T1\""
+ ],
+ "Hive":
+ [
+ "SELECT (`B` + 1) FROM `LS`.`T1`"
+ ]
+ }
+ },
+ {
+ "testQuery": "select b+1 from vs.t1 where t1.b>7",
+ "testDescription": "Full pushdown with select-list and WHERE-clause",
+ "expectedPushdownRequest":
+ [
+ {
+ "involvedTables" :
+ [
+ {
+ "columns" :
+ [
+ {
+ "adapterNotes" : "{\"jdbcDataType\":3,\"typeName\":\"DECIMAL\"}",
+ "dataType" :
+ {
+ "precision" : 18,
+ "scale" : 0,
+ "type" : "DECIMAL"
+ },
+ "name" : "A"
+ },
+ {
+ "adapterNotes" : "{\"jdbcDataType\":3,\"typeName\":\"DECIMAL\"}",
+ "dataType" :
+ {
+ "precision" : 18,
+ "scale" : 0,
+ "type" : "DECIMAL"
+ },
+ "name" : "B"
+ }
+ ],
+ "name" : "T1"
+ }
+ ],
+ "pushdownRequest" :
+ {
+ "type" : "select",
+ "selectList":
+ [
+ {
+ "numArgs": 2,
+ "infix": true,
+ "type": "function_scalar",
+ "arguments":
+ [
+ {
+ "type": "column",
+ "tableName": "T1",
+ "name": "B",
+ "columnNr": 1
+ },
+ {
+ "type": "literal_exactnumeric",
+ "value": "1"
+ }
+ ],
+ "name": "ADD"
+ }
+ ],
+ "from" :
+ {
+ "type" : "table",
+ "name" : "T1"
+ },
+ "filter":
+ {
+ "right":
+ {
+ "type": "column",
+ "tableName": "T1",
+ "name": "B",
+ "columnNr": 1
+ },
+ "type": "predicate_less",
+ "left":
+ {
+ "type": "literal_exactnumeric",
+ "value": "7"
+ }
+ },
+ "filter_expr_string_for_debug": "77",
+ "testDescription": "Full pushdown with select-list, join and WHERE-clause",
+ "expectedPushdownRequest":
+ [
+ {
+ "involvedTables" :
+ [
+ {
+ "columns" :
+ [
+ {
+ "adapterNotes" : "{\"jdbcDataType\":3,\"typeName\":\"DECIMAL\"}",
+ "dataType" :
+ {
+ "precision" : 18,
+ "scale" : 0,
+ "type" : "DECIMAL"
+ },
+ "name" : "A"
+ },
+ {
+ "adapterNotes" : "{\"jdbcDataType\":3,\"typeName\":\"DECIMAL\"}",
+ "dataType" :
+ {
+ "precision" : 18,
+ "scale" : 0,
+ "type" : "DECIMAL"
+ },
+ "name" : "B"
+ }
+ ],
+ "name" : "T1"
+ },
+ {
+ "columns" :
+ [
+ {
+ "adapterNotes" : "{\"jdbcDataType\":3,\"typeName\":\"DECIMAL\"}",
+ "dataType" :
+ {
+ "precision" : 18,
+ "scale" : 0,
+ "type" : "DECIMAL"
+ },
+ "name" : "X"
+ },
+ {
+ "adapterNotes" : "{\"jdbcDataType\":3,\"typeName\":\"DECIMAL\"}",
+ "dataType" :
+ {
+ "precision" : 18,
+ "scale" : 0,
+ "type" : "DECIMAL"
+ },
+ "name" : "Y"
+ }
+ ],
+ "name" : "T2"
+ }
+ ],
+ "pushdownRequest" :
+ {
+ "type" : "select",
+ "selectList":
+ [
+ {
+ "numArgs": 2,
+ "infix": true,
+ "type": "function_scalar",
+ "arguments":
+ [
+ {
+ "type": "column",
+ "tableName": "T1",
+ "name": "B",
+ "columnNr": 1
+ },
+ {
+ "type": "literal_exactnumeric",
+ "value": "1"
+ }
+ ],
+ "name": "ADD"
+ }
+ ],
+ "from":
+ {
+ "type": "join",
+ "join_type": "inner",
+ "right":
+ {
+ "type": "table",
+ "name": "T2"
+ },
+ "left":
+ {
+ "type": "table",
+ "name": "T1"
+ },
+ "condition":
+ {
+ "right":
+ {
+ "type": "column",
+ "tableName": "T2",
+ "name": "X",
+ "columnNr": 0
+ },
+ "type": "predicate_equal",
+ "left":
+ {
+ "type": "column",
+ "tableName": "T1",
+ "name": "A",
+ "columnNr": 0
+ }
+ }
+ },
+ "filter":
+ {
+ "right":
+ {
+ "type": "column",
+ "tableName": "T1",
+ "name": "B",
+ "columnNr": 1
+ },
+ "type": "predicate_less",
+ "left":
+ {
+ "type": "literal_exactnumeric",
+ "value": "7"
+ }
+ },
+ "filter_expr_string_for_debug": "77 order by t2.y limit 3 offset 1",
+ "testDescription": "Full pushdown with select-list, join and WHERE-clause, ORDER BY and LIMIT",
+ "expectedPushdownRequest":
+ [
+ {
+ "involvedTables" :
+ [
+ {
+ "columns" :
+ [
+ {
+ "adapterNotes" : "{\"jdbcDataType\":3,\"typeName\":\"DECIMAL\"}",
+ "dataType" :
+ {
+ "precision" : 18,
+ "scale" : 0,
+ "type" : "DECIMAL"
+ },
+ "name" : "A"
+ },
+ {
+ "adapterNotes" : "{\"jdbcDataType\":3,\"typeName\":\"DECIMAL\"}",
+ "dataType" :
+ {
+ "precision" : 18,
+ "scale" : 0,
+ "type" : "DECIMAL"
+ },
+ "name" : "B"
+ }
+ ],
+ "name" : "T1"
+ },
+ {
+ "columns" :
+ [
+ {
+ "adapterNotes" : "{\"jdbcDataType\":3,\"typeName\":\"DECIMAL\"}",
+ "dataType" :
+ {
+ "precision" : 18,
+ "scale" : 0,
+ "type" : "DECIMAL"
+ },
+ "name" : "X"
+ },
+ {
+ "adapterNotes" : "{\"jdbcDataType\":3,\"typeName\":\"DECIMAL\"}",
+ "dataType" :
+ {
+ "precision" : 18,
+ "scale" : 0,
+ "type" : "DECIMAL"
+ },
+ "name" : "Y"
+ }
+ ],
+ "name" : "T2"
+ }
+ ],
+ "pushdownRequest" :
+ {
+ "type" : "select",
+ "selectList":
+ [
+ {
+ "numArgs": 2,
+ "infix": true,
+ "type": "function_scalar",
+ "arguments":
+ [
+ {
+ "type": "column",
+ "tableName": "T1",
+ "name": "B",
+ "columnNr": 1
+ },
+ {
+ "type": "literal_exactnumeric",
+ "value": "1"
+ }
+ ],
+ "name": "ADD"
+ }
+ ],
+ "from":
+ {
+ "type": "join",
+ "join_type": "inner",
+ "right":
+ {
+ "type": "table",
+ "name": "T2"
+ },
+ "left":
+ {
+ "type": "table",
+ "name": "T1"
+ },
+ "condition":
+ {
+ "right":
+ {
+ "type": "column",
+ "tableName": "T2",
+ "name": "X",
+ "columnNr": 0
+ },
+ "type": "predicate_equal",
+ "left":
+ {
+ "type": "column",
+ "tableName": "T1",
+ "name": "A",
+ "columnNr": 0
+ }
+ }
+ },
+ "filter":
+ {
+ "right":
+ {
+ "type": "column",
+ "tableName": "T1",
+ "name": "B",
+ "columnNr": 1
+ },
+ "type": "predicate_less",
+ "left":
+ {
+ "type": "literal_exactnumeric",
+ "value": "7"
+ }
+ },
+ "filter_expr_string_for_debug": "7 1"
+ ],
+ "Hive":
+ [
+ "SELECT (`T1`.`B` + 1) FROM `LS`.`T1` INNER JOIN `LS`.`T2` ON `T1`.`A` = `T2`.`X` WHERE 7 < `T1`.`B` ORDER BY `T2`.`Y` NULLS LAST LIMIT 3 OFFSET 1"
+ ]
+ }
+ },
+ {
+ "testQuery": "select sum(b+1) from vs.t1 join vs.t2 on a=x where t1.b>7",
+ "testDescription": "Full pushdown with select-list with aggregation, join and WHERE-clause",
+ "expectedPushdownRequest":
+ [
+ {
+ "involvedTables" :
+ [
+ {
+ "columns" :
+ [
+ {
+ "adapterNotes" : "{\"jdbcDataType\":3,\"typeName\":\"DECIMAL\"}",
+ "dataType" :
+ {
+ "precision" : 18,
+ "scale" : 0,
+ "type" : "DECIMAL"
+ },
+ "name" : "A"
+ },
+ {
+ "adapterNotes" : "{\"jdbcDataType\":3,\"typeName\":\"DECIMAL\"}",
+ "dataType" :
+ {
+ "precision" : 18,
+ "scale" : 0,
+ "type" : "DECIMAL"
+ },
+ "name" : "B"
+ }
+ ],
+ "name" : "T1"
+ },
+ {
+ "columns" :
+ [
+ {
+ "adapterNotes" : "{\"jdbcDataType\":3,\"typeName\":\"DECIMAL\"}",
+ "dataType" :
+ {
+ "precision" : 18,
+ "scale" : 0,
+ "type" : "DECIMAL"
+ },
+ "name" : "X"
+ },
+ {
+ "adapterNotes" : "{\"jdbcDataType\":3,\"typeName\":\"DECIMAL\"}",
+ "dataType" :
+ {
+ "precision" : 18,
+ "scale" : 0,
+ "type" : "DECIMAL"
+ },
+ "name" : "Y"
+ }
+ ],
+ "name" : "T2"
+ }
+ ],
+ "pushdownRequest" :
+ {
+ "type" : "select",
+ "selectList":
+ [
+ {
+ "type": "function_aggregate",
+ "arguments":
+ [
+ {
+ "numArgs": 2,
+ "infix": true,
+ "type": "function_scalar",
+ "arguments":
+ [
+ {
+ "type": "column",
+ "tableName": "T1",
+ "name": "B",
+ "columnNr": 1
+ },
+ {
+ "type": "literal_exactnumeric",
+ "value": "1"
+ }
+ ],
+ "name": "ADD"
+ }
+ ],
+ "name": "sum"
+ }
+ ],
+ "from":
+ {
+ "type": "join",
+ "join_type": "inner",
+ "right":
+ {
+ "type": "table",
+ "name": "T2"
+ },
+ "left":
+ {
+ "type": "table",
+ "name": "T1"
+ },
+ "condition":
+ {
+ "right":
+ {
+ "type": "column",
+ "tableName": "T2",
+ "name": "X",
+ "columnNr": 0
+ },
+ "type": "predicate_equal",
+ "left":
+ {
+ "type": "column",
+ "tableName": "T1",
+ "name": "A",
+ "columnNr": 0
+ }
+ }
+ },
+ "filter":
+ {
+ "right":
+ {
+ "type": "column",
+ "tableName": "T1",
+ "name": "B",
+ "columnNr": 1
+ },
+ "type": "predicate_less",
+ "left":
+ {
+ "type": "literal_exactnumeric",
+ "value": "7"
+ }
+ },
+ "filter_expr_string_for_debug": "77 group by a,y",
+ "testDescription": "Full pushdown with select-list with aggregation, join and WHERE-clause, GROUP BY",
+ "expectedPushdownRequest":
+ [
+ {
+ "involvedTables" :
+ [
+ {
+ "columns" :
+ [
+ {
+ "adapterNotes" : "{\"jdbcDataType\":3,\"typeName\":\"DECIMAL\"}",
+ "dataType" :
+ {
+ "precision" : 18,
+ "scale" : 0,
+ "type" : "DECIMAL"
+ },
+ "name" : "A"
+ },
+ {
+ "adapterNotes" : "{\"jdbcDataType\":3,\"typeName\":\"DECIMAL\"}",
+ "dataType" :
+ {
+ "precision" : 18,
+ "scale" : 0,
+ "type" : "DECIMAL"
+ },
+ "name" : "B"
+ }
+ ],
+ "name" : "T1"
+ },
+ {
+ "columns" :
+ [
+ {
+ "adapterNotes" : "{\"jdbcDataType\":3,\"typeName\":\"DECIMAL\"}",
+ "dataType" :
+ {
+ "precision" : 18,
+ "scale" : 0,
+ "type" : "DECIMAL"
+ },
+ "name" : "X"
+ },
+ {
+ "adapterNotes" : "{\"jdbcDataType\":3,\"typeName\":\"DECIMAL\"}",
+ "dataType" :
+ {
+ "precision" : 18,
+ "scale" : 0,
+ "type" : "DECIMAL"
+ },
+ "name" : "Y"
+ }
+ ],
+ "name" : "T2"
+ }
+ ],
+ "pushdownRequest" :
+ {
+ "type" : "select",
+ "selectList":
+ [
+ {
+ "type": "function_aggregate",
+ "arguments":
+ [
+ {
+ "numArgs": 2,
+ "infix": true,
+ "type": "function_scalar",
+ "arguments":
+ [
+ {
+ "type": "column",
+ "tableName": "T1",
+ "name": "B",
+ "columnNr": 1
+ },
+ {
+ "type": "literal_exactnumeric",
+ "value": "1"
+ }
+ ],
+ "name": "ADD"
+ }
+ ],
+ "name": "sum"
+ }
+ ],
+ "from":
+ {
+ "type": "join",
+ "join_type": "inner",
+ "right":
+ {
+ "type": "table",
+ "name": "T2"
+ },
+ "left":
+ {
+ "type": "table",
+ "name": "T1"
+ },
+ "condition":
+ {
+ "right":
+ {
+ "type": "column",
+ "tableName": "T2",
+ "name": "X",
+ "columnNr": 0
+ },
+ "type": "predicate_equal",
+ "left":
+ {
+ "type": "column",
+ "tableName": "T1",
+ "name": "A",
+ "columnNr": 0
+ }
+ }
+ },
+ "filter":
+ {
+ "right":
+ {
+ "type": "column",
+ "tableName": "T1",
+ "name": "B",
+ "columnNr": 1
+ },
+ "type": "predicate_less",
+ "left":
+ {
+ "type": "literal_exactnumeric",
+ "value": "7"
+ }
+ },
+ "filter_expr_string_for_debug": "77 group by a,y having sum(x) > 0",
+ "testDescription": "Full pushdown with select-list with aggregation, join and WHERE-clause, GROUP BY, HAVING",
+ "expectedPushdownRequest":
+ [
+ {
+ "involvedTables" :
+ [
+ {
+ "columns" :
+ [
+ {
+ "adapterNotes" : "{\"jdbcDataType\":3,\"typeName\":\"DECIMAL\"}",
+ "dataType" :
+ {
+ "precision" : 18,
+ "scale" : 0,
+ "type" : "DECIMAL"
+ },
+ "name" : "A"
+ },
+ {
+ "adapterNotes" : "{\"jdbcDataType\":3,\"typeName\":\"DECIMAL\"}",
+ "dataType" :
+ {
+ "precision" : 18,
+ "scale" : 0,
+ "type" : "DECIMAL"
+ },
+ "name" : "B"
+ }
+ ],
+ "name" : "T1"
+ },
+ {
+ "columns" :
+ [
+ {
+ "adapterNotes" : "{\"jdbcDataType\":3,\"typeName\":\"DECIMAL\"}",
+ "dataType" :
+ {
+ "precision" : 18,
+ "scale" : 0,
+ "type" : "DECIMAL"
+ },
+ "name" : "X"
+ },
+ {
+ "adapterNotes" : "{\"jdbcDataType\":3,\"typeName\":\"DECIMAL\"}",
+ "dataType" :
+ {
+ "precision" : 18,
+ "scale" : 0,
+ "type" : "DECIMAL"
+ },
+ "name" : "Y"
+ }
+ ],
+ "name" : "T2"
+ }
+ ],
+ "pushdownRequest" :
+ {
+ "type" : "select",
+ "selectList":
+ [
+ {
+ "type": "function_aggregate",
+ "arguments":
+ [
+ {
+ "numArgs": 2,
+ "infix": true,
+ "type": "function_scalar",
+ "arguments":
+ [
+ {
+ "type": "column",
+ "tableName": "T1",
+ "name": "B",
+ "columnNr": 1
+ },
+ {
+ "type": "literal_exactnumeric",
+ "value": "1"
+ }
+ ],
+ "name": "ADD"
+ }
+ ],
+ "name": "sum"
+ }
+ ],
+ "from":
+ {
+ "type": "join",
+ "join_type": "inner",
+ "right":
+ {
+ "type": "table",
+ "name": "T2"
+ },
+ "left":
+ {
+ "type": "table",
+ "name": "T1"
+ },
+ "condition":
+ {
+ "right":
+ {
+ "type": "column",
+ "tableName": "T2",
+ "name": "X",
+ "columnNr": 0
+ },
+ "type": "predicate_equal",
+ "left":
+ {
+ "type": "column",
+ "tableName": "T1",
+ "name": "A",
+ "columnNr": 0
+ }
+ }
+ },
+ "filter":
+ {
+ "right":
+ {
+ "type": "column",
+ "tableName": "T1",
+ "name": "B",
+ "columnNr": 1
+ },
+ "type": "predicate_less",
+ "left":
+ {
+ "type": "literal_exactnumeric",
+ "value": "7"
+ }
+ },
+ "filter_expr_string_for_debug": "77 group by a,y having sum(x) > 0 order by sum(y+1) limit 3 offset 1",
+ "testDescription": "Full pushdown with select-list with aggregation, join and WHERE-clause, GROUP BY, HAVING, ORDER BY and LIMIT",
+ "expectedPushdownRequest":
+ [
+ {
+ "involvedTables" :
+ [
+ {
+ "columns" :
+ [
+ {
+ "adapterNotes" : "{\"jdbcDataType\":3,\"typeName\":\"DECIMAL\"}",
+ "dataType" :
+ {
+ "precision" : 18,
+ "scale" : 0,
+ "type" : "DECIMAL"
+ },
+ "name" : "A"
+ },
+ {
+ "adapterNotes" : "{\"jdbcDataType\":3,\"typeName\":\"DECIMAL\"}",
+ "dataType" :
+ {
+ "precision" : 18,
+ "scale" : 0,
+ "type" : "DECIMAL"
+ },
+ "name" : "B"
+ }
+ ],
+ "name" : "T1"
+ },
+ {
+ "columns" :
+ [
+ {
+ "adapterNotes" : "{\"jdbcDataType\":3,\"typeName\":\"DECIMAL\"}",
+ "dataType" :
+ {
+ "precision" : 18,
+ "scale" : 0,
+ "type" : "DECIMAL"
+ },
+ "name" : "X"
+ },
+ {
+ "adapterNotes" : "{\"jdbcDataType\":3,\"typeName\":\"DECIMAL\"}",
+ "dataType" :
+ {
+ "precision" : 18,
+ "scale" : 0,
+ "type" : "DECIMAL"
+ },
+ "name" : "Y"
+ }
+ ],
+ "name" : "T2"
+ }
+ ],
+ "pushdownRequest" :
+ {
+ "type" : "select",
+ "selectList":
+ [
+ {
+ "type": "function_aggregate",
+ "arguments":
+ [
+ {
+ "numArgs": 2,
+ "infix": true,
+ "type": "function_scalar",
+ "arguments":
+ [
+ {
+ "type": "column",
+ "tableName": "T1",
+ "name": "B",
+ "columnNr": 1
+ },
+ {
+ "type": "literal_exactnumeric",
+ "value": "1"
+ }
+ ],
+ "name": "ADD"
+ }
+ ],
+ "name": "sum"
+ }
+ ],
+ "from":
+ {
+ "type": "join",
+ "join_type": "inner",
+ "right":
+ {
+ "type": "table",
+ "name": "T2"
+ },
+ "left":
+ {
+ "type": "table",
+ "name": "T1"
+ },
+ "condition":
+ {
+ "right":
+ {
+ "type": "column",
+ "tableName": "T2",
+ "name": "X",
+ "columnNr": 0
+ },
+ "type": "predicate_equal",
+ "left":
+ {
+ "type": "column",
+ "tableName": "T1",
+ "name": "A",
+ "columnNr": 0
+ }
+ }
+ },
+ "filter":
+ {
+ "right":
+ {
+ "type": "column",
+ "tableName": "T1",
+ "name": "B",
+ "columnNr": 1
+ },
+ "type": "predicate_less",
+ "left":
+ {
+ "type": "literal_exactnumeric",
+ "value": "7"
+ }
+ },
+ "filter_expr_string_for_debug": "7 1"
+ ],
+ "Hive":
+ [
+ "SELECT SUM((`T1`.`B` + 1)) FROM `LS`.`T1` INNER JOIN `LS`.`T2` ON `T1`.`A` = `T2`.`X` WHERE 7 < `T1`.`B` GROUP BY `T1`.`A`, `T2`.`Y` HAVING 0 < SUM(`T2`.`X`) ORDER BY SUM((`T2`.`Y` + 1)) NULLS LAST LIMIT 3 OFFSET 1"
+ ]
+ }
+ }
+ ]
+}
diff --git a/jdbc-adapter/virtualschema-jdbc-adapter/src/test/resources/integration/vschema_multiple_tables_inner_join.json b/jdbc-adapter/virtualschema-jdbc-adapter/src/test/resources/integration/vschema_multiple_tables_inner_join.json
new file mode 100644
index 000000000..a839ba666
--- /dev/null
+++ b/jdbc-adapter/virtualschema-jdbc-adapter/src/test/resources/integration/vschema_multiple_tables_inner_join.json
@@ -0,0 +1,357 @@
+{
+ "testSchema": [
+ "create table t1(id int)",
+ "create table t2(id int)",
+ "create table t3(id int)",
+ "create table t4(id int)"
+ ],
+ "testCases": [
+ {
+ "testQuery": "select * from vs.t1 a inner join vs.t2 b on a.id=b.id inner join vs.t3 c on c.id=a.id",
+ "expectedPushdownRequest": [
+ {
+ "involvedTables": [
+ {
+ "columns": [
+ {
+ "adapterNotes": "{\"jdbcDataType\":3,\"typeName\":\"DECIMAL\"}",
+ "dataType": {
+ "precision": 18,
+ "scale": 0,
+ "type": "DECIMAL"
+ },
+ "name": "ID"
+ }
+ ],
+ "name": "T1"
+ },
+ {
+ "columns": [
+ {
+ "adapterNotes": "{\"jdbcDataType\":3,\"typeName\":\"DECIMAL\"}",
+ "dataType": {
+ "precision": 18,
+ "scale": 0,
+ "type": "DECIMAL"
+ },
+ "name": "ID"
+ }
+ ],
+ "name": "T2"
+ },
+ {
+ "columns": [
+ {
+ "adapterNotes": "{\"jdbcDataType\":3,\"typeName\":\"DECIMAL\"}",
+ "dataType": {
+ "precision": 18,
+ "scale": 0,
+ "type": "DECIMAL"
+ },
+ "name": "ID"
+ }
+ ],
+ "name": "T3"
+ }
+ ],
+ "pushdownRequest": {
+ "type": "select",
+ "selectList" :
+ [
+ {
+ "columnNr" : 0,
+ "name" : "ID",
+ "tableAlias" : "A",
+ "tableName" : "T1",
+ "type" : "column"
+ },
+ {
+ "columnNr" : 0,
+ "name" : "ID",
+ "tableAlias" : "B",
+ "tableName" : "T2",
+ "type" : "column"
+ },
+ {
+ "columnNr" : 0,
+ "name" : "ID",
+ "tableAlias" : "C",
+ "tableName" : "T3",
+ "type" : "column"
+ }
+ ],
+ "from": {
+ "type" : "join",
+ "join_type": "inner",
+ "left": {
+ "type": "join",
+ "join_type": "inner",
+ "left": {
+ "name": "T1",
+ "type": "table",
+ "alias": "A"
+ },
+ "right": {
+ "name": "T2",
+ "type": "table",
+ "alias": "B"
+ },
+ "condition": {
+ "left": {
+ "columnNr": 0,
+ "name": "ID",
+ "tableName": "T1",
+ "tableAlias": "A",
+ "type": "column"
+ },
+ "right": {
+ "columnNr": 0,
+ "name": "ID",
+ "tableName": "T2",
+ "tableAlias": "B",
+ "type": "column"
+ },
+ "type": "predicate_equal"
+ }
+ },
+ "right" : {
+ "name": "T3",
+ "type": "table",
+ "alias": "C"
+ },
+ "condition" : {
+ "left": {
+ "columnNr": 0,
+ "name": "ID",
+ "tableName": "T3",
+ "tableAlias": "C",
+ "type": "column"
+ },
+ "right": {
+ "columnNr": 0,
+ "name": "ID",
+ "tableName": "T1",
+ "tableAlias": "A",
+ "type": "column"
+ },
+ "type": "predicate_equal"
+ }
+ }
+ },
+ "type": "pushdown"
+ }
+ ],
+ "expectedPushdownResponse": {
+ "Exasol": [
+ "SELECT \"A\".\"ID\", \"B\".\"ID\", \"C\".\"ID\" FROM \"LS\".\"T1\" \"A\" INNER JOIN \"LS\".\"T2\" \"B\" ON \"A\".\"ID\" = \"B\".\"ID\" INNER JOIN \"LS\".\"T3\" \"C\" ON \"C\".\"ID\" = \"A\".\"ID\""
+ ],
+ "PostgreSQL": [
+ "SELECT \"a\".\"id\", \"b\".\"id\", \"c\".\"id\" FROM \"ls\".\"t1\" \"a\" INNER JOIN \"ls\".\"t2\" \"b\" ON \"a\".\"id\" = \"b\".\"id\" INNER JOIN \"ls\".\"t3\" \"c\" ON \"c\".\"id\" = \"a\".\"id\""
+ ],
+ "Oracle": [
+ "SELECT \"A\".\"ID\", \"B\".\"ID\", \"C\".\"ID\" FROM \"LS\".\"T1\" \"A\" INNER JOIN \"LS\".\"T2\" \"B\" ON \"A\".\"ID\" = \"B\".\"ID\" INNER JOIN \"LS\".\"T3\" \"C\" ON \"C\".\"ID\" = \"A\".\"ID\""
+ ],
+ "Hive": [
+ "SELECT `A`.`ID`, `B`.`ID`, `C`.`ID` FROM `LS`.`T1` `A` INNER JOIN `LS`.`T2` `B` ON `A`.`ID` = `B`.`ID` INNER JOIN `LS`.`T3` `C` ON `C`.`ID` = `A`.`ID`"
+ ]
+ }
+ },
+ {
+ "testQuery": "select * from vs.t1 a inner join vs.t2 b on a.id=b.id inner join vs.t3 c on a.id=c.id inner join vs.t4 d on c.id=d.id",
+ "expectedPushdownRequest": [
+ {
+ "involvedTables": [
+ {
+ "columns": [
+ {
+ "adapterNotes": "{\"jdbcDataType\":3,\"typeName\":\"DECIMAL\"}",
+ "dataType": {
+ "precision": 18,
+ "scale": 0,
+ "type": "DECIMAL"
+ },
+ "name": "ID"
+ }
+ ],
+ "name": "T1"
+ },
+ {
+ "columns": [
+ {
+ "adapterNotes": "{\"jdbcDataType\":3,\"typeName\":\"DECIMAL\"}",
+ "dataType": {
+ "precision": 18,
+ "scale": 0,
+ "type": "DECIMAL"
+ },
+ "name": "ID"
+ }
+ ],
+ "name": "T2"
+ },
+ {
+ "columns": [
+ {
+ "adapterNotes": "{\"jdbcDataType\":3,\"typeName\":\"DECIMAL\"}",
+ "dataType": {
+ "precision": 18,
+ "scale": 0,
+ "type": "DECIMAL"
+ },
+ "name": "ID"
+ }
+ ],
+ "name": "T3"
+ },
+ {
+ "columns": [
+ {
+ "adapterNotes": "{\"jdbcDataType\":3,\"typeName\":\"DECIMAL\"}",
+ "dataType": {
+ "precision": 18,
+ "scale": 0,
+ "type": "DECIMAL"
+ },
+ "name": "ID"
+ }
+ ],
+ "name": "T4"
+ }
+ ],
+ "pushdownRequest": {
+ "type": "select",
+ "selectList" :
+ [
+ {
+ "columnNr" : 0,
+ "name" : "ID",
+ "tableAlias" : "A",
+ "tableName" : "T1",
+ "type" : "column"
+ },
+ {
+ "columnNr" : 0,
+ "name" : "ID",
+ "tableAlias" : "B",
+ "tableName" : "T2",
+ "type" : "column"
+ },
+ {
+ "columnNr" : 0,
+ "name" : "ID",
+ "tableAlias" : "C",
+ "tableName" : "T3",
+ "type" : "column"
+ },
+ {
+ "columnNr" : 0,
+ "name" : "ID",
+ "tableAlias" : "D",
+ "tableName" : "T4",
+ "type" : "column"
+ }
+ ],
+ "from": {
+ "type" : "join",
+ "join_type": "inner",
+ "left": {
+ "type": "join",
+ "join_type": "inner",
+ "left": {
+ "type": "join",
+ "join_type": "inner",
+ "left": {
+ "name": "T1",
+ "type": "table",
+ "alias": "A"
+ },
+ "right": {
+ "name": "T2",
+ "type": "table",
+ "alias": "B"
+ },
+ "condition": {
+ "left": {
+ "columnNr": 0,
+ "name": "ID",
+ "tableName": "T1",
+ "tableAlias": "A",
+ "type": "column"
+ },
+ "right": {
+ "columnNr": 0,
+ "name": "ID",
+ "tableName": "T2",
+ "tableAlias": "B",
+ "type": "column"
+ },
+ "type": "predicate_equal"
+ }
+ },
+ "right": {
+ "name": "T3",
+ "type": "table",
+ "alias": "C"
+ },
+ "condition": {
+ "left": {
+ "columnNr": 0,
+ "name": "ID",
+ "tableName": "T1",
+ "tableAlias": "A",
+ "type": "column"
+ },
+ "right": {
+ "columnNr": 0,
+ "name": "ID",
+ "tableName": "T3",
+ "tableAlias": "C",
+ "type": "column"
+ },
+ "type": "predicate_equal"
+ }
+ },
+ "right" : {
+ "name": "T4",
+ "type": "table",
+ "alias": "D"
+ },
+ "condition" : {
+ "left": {
+ "columnNr": 0,
+ "name": "ID",
+ "tableName": "T3",
+ "tableAlias": "C",
+ "type": "column"
+ },
+ "right": {
+ "columnNr": 0,
+ "name": "ID",
+ "tableName": "T4",
+ "tableAlias": "D",
+ "type": "column"
+ },
+ "type": "predicate_equal"
+ }
+ }
+ },
+ "type": "pushdown"
+ }
+ ],
+ "expectedPushdownResponse": {
+ "Exasol": [
+ "SELECT \"A\".\"ID\", \"B\".\"ID\", \"C\".\"ID\", \"D\".\"ID\" FROM \"LS\".\"T1\" \"A\" INNER JOIN \"LS\".\"T2\" \"B\" ON \"A\".\"ID\" = \"B\".\"ID\" INNER JOIN \"LS\".\"T3\" \"C\" ON \"A\".\"ID\" = \"C\".\"ID\" INNER JOIN \"LS\".\"T4\" \"D\" ON \"C\".\"ID\" = \"D\".\"ID\""
+ ],
+ "PostgreSQL": [
+ "SELECT \"a\".\"id\", \"b\".\"id\", \"c\".\"id\", \"d\".\"id\" FROM \"ls\".\"t1\" \"a\" INNER JOIN \"ls\".\"t2\" \"b\" ON \"a\".\"id\" = \"b\".\"id\" INNER JOIN \"ls\".\"t3\" \"c\" ON \"a\".\"id\" = \"c\".\"id\" INNER JOIN \"ls\".\"t4\" \"d\" ON \"c\".\"id\" = \"d\".\"id\""
+ ],
+ "Oracle": [
+ "SELECT \"A\".\"ID\", \"B\".\"ID\", \"C\".\"ID\", \"D\".\"ID\" FROM \"LS\".\"T1\" \"A\" INNER JOIN \"LS\".\"T2\" \"B\" ON \"A\".\"ID\" = \"B\".\"ID\" INNER JOIN \"LS\".\"T3\" \"C\" ON \"A\".\"ID\" = \"C\".\"ID\" INNER JOIN \"LS\".\"T4\" \"D\" ON \"C\".\"ID\" = \"D\".\"ID\""
+ ],
+ "Hive": [
+ "SELECT `A`.`ID`, `B`.`ID`, `C`.`ID`, `D`.`ID` FROM `LS`.`T1` `A` INNER JOIN `LS`.`T2` `B` ON `A`.`ID` = `B`.`ID` INNER JOIN `LS`.`T3` `C` ON `A`.`ID` = `C`.`ID` INNER JOIN `LS`.`T4` `D` ON `C`.`ID` = `D`.`ID`"
+ ]
+ }
+ }
+ ]
+}
\ No newline at end of file
diff --git a/jdbc-adapter/virtualschema-jdbc-adapter/src/test/resources/integration/vschema_select_list_inner_join.json b/jdbc-adapter/virtualschema-jdbc-adapter/src/test/resources/integration/vschema_select_list_inner_join.json
new file mode 100644
index 000000000..1177dead4
--- /dev/null
+++ b/jdbc-adapter/virtualschema-jdbc-adapter/src/test/resources/integration/vschema_select_list_inner_join.json
@@ -0,0 +1,415 @@
+{
+ "testSchema" :
+ [
+ "create table t1(id int)",
+ "create table t2(id int)"
+ ],
+ "testCases" :
+ [
+ {
+ "testQuery": "select nullifzero(vs.t1.id - vs.t2.id) from vs.t1 inner join vs.t2 on vs.t1.id=vs.t2.id",
+ "expectedPushdownRequest":
+ [
+ {
+ "involvedTables" :
+ [
+ {
+ "columns" :
+ [
+ {
+ "adapterNotes" : "{\"jdbcDataType\":3,\"typeName\":\"DECIMAL\"}",
+ "dataType" :
+ {
+ "precision" : 18,
+ "scale" : 0,
+ "type" : "DECIMAL"
+ },
+ "name" : "ID"
+ }
+ ],
+ "name" : "T1"
+ },
+ {
+ "columns" :
+ [
+ {
+ "adapterNotes" : "{\"jdbcDataType\":3,\"typeName\":\"DECIMAL\"}",
+ "dataType" :
+ {
+ "precision" : 18,
+ "scale" : 0,
+ "type" : "DECIMAL"
+ },
+ "name" : "ID"
+ }
+ ],
+ "name" : "T2"
+ }
+ ],
+ "pushdownRequest" :
+ {
+ "type" : "select",
+ "selectList" :
+ [
+ {
+ "arguments" :
+ [
+ {
+ "arguments" :
+ [
+ {
+ "columnNr" : 0,
+ "name" : "ID",
+ "tableName" : "T1",
+ "type" : "column"
+ },
+ {
+ "columnNr" : 0,
+ "name" : "ID",
+ "tableName" : "T2",
+ "type" : "column"
+ }
+ ],
+ "infix" : true,
+ "name" : "SUB",
+ "numArgs" : 2,
+ "type" : "function_scalar"
+ }
+ ],
+ "name" : "NULLIFZERO",
+ "numArgs" : 1,
+ "type" : "function_scalar"
+ }
+ ],
+ "from" :
+ {
+ "type": "join",
+ "join_type": "inner",
+ "left":
+ {
+ "name" : "T1",
+ "type" : "table"
+ },
+ "right":
+ {
+ "name" : "T2",
+ "type" : "table"
+ },
+ "condition":
+ {
+ "left" :
+ {
+ "columnNr" : 0,
+ "name" : "ID",
+ "tableName" : "T1",
+ "type" : "column"
+ },
+ "right" :
+ {
+ "columnNr" : 0,
+ "name" : "ID",
+ "tableName" : "T2",
+ "type" : "column"
+ },
+ "type" : "predicate_equal"
+ }
+ }
+ },
+ "type" : "pushdown"
+ }
+ ],
+ "expectedPushdownResponse":
+ {
+ "Exasol":
+ [
+ "SELECT NULLIFZERO((\"T1\".\"ID\" - \"T2\".\"ID\")) FROM \"LS\".\"T1\" INNER JOIN \"LS\".\"T2\" ON \"T1\".\"ID\" = \"T2\".\"ID\""
+ ],
+ "PostgreSQL":
+ [
+ "SELECT NULLIFZERO((\"t1\".\"id\" - \"t2\".\"id\")) FROM \"ls\".\"t1\" INNER JOIN \"ls\".\"t2\" ON \"t1\".\"id\" = \"t2\".\"id\""
+ ],
+ "Oracle":
+ [
+ "SELECT NULLIF((\"T1\".\"ID\" - \"T2\".\"ID\"), 0) FROM \"LS\".\"T1\" INNER JOIN \"LS\".\"T2\" ON \"T1\".\"ID\" = \"T2\".\"ID\""
+ ],
+ "Hive":
+ [
+ "SELECT NULLIFZERO((`T1`.`ID` - `T2`.`ID`)) FROM `LS`.`T1` INNER JOIN `LS`.`T2` ON `T1`.`ID` = `T2`.`ID`"
+ ]
+ }
+ },
+ {
+ "testQuery": "select nullifzero(a.id - b.id) from vs.t1 a inner join vs.t2 b on a.id=b.id",
+ "expectedPushdownRequest":
+ [
+ {
+ "involvedTables" :
+ [
+ {
+ "columns" :
+ [
+ {
+ "adapterNotes" : "{\"jdbcDataType\":3,\"typeName\":\"DECIMAL\"}",
+ "dataType" :
+ {
+ "precision" : 18,
+ "scale" : 0,
+ "type" : "DECIMAL"
+ },
+ "name" : "ID"
+ }
+ ],
+ "name" : "T1"
+ },
+ {
+ "columns" :
+ [
+ {
+ "adapterNotes" : "{\"jdbcDataType\":3,\"typeName\":\"DECIMAL\"}",
+ "dataType" :
+ {
+ "precision" : 18,
+ "scale" : 0,
+ "type" : "DECIMAL"
+ },
+ "name" : "ID"
+ }
+ ],
+ "name" : "T2"
+ }
+ ],
+ "pushdownRequest" :
+ {
+ "type" : "select",
+ "selectList" :
+ [
+ {
+ "arguments" :
+ [
+ {
+ "arguments" :
+ [
+ {
+ "columnNr" : 0,
+ "name" : "ID",
+ "tableName" : "T1",
+ "tableAlias": "A",
+ "type" : "column"
+ },
+ {
+ "columnNr" : 0,
+ "name" : "ID",
+ "tableName" : "T2",
+ "tableAlias": "B",
+ "type" : "column"
+ }
+ ],
+ "infix" : true,
+ "name" : "SUB",
+ "numArgs" : 2,
+ "type" : "function_scalar"
+ }
+ ],
+ "name" : "NULLIFZERO",
+ "numArgs" : 1,
+ "type" : "function_scalar"
+ }
+ ],
+ "from" :
+ {
+ "type": "join",
+ "join_type": "inner",
+ "left":
+ {
+ "name" : "T1",
+ "type" : "table",
+ "alias": "A"
+ },
+ "right":
+ {
+ "name" : "T2",
+ "type" : "table",
+ "alias": "B"
+ },
+ "condition":
+ {
+ "left" :
+ {
+ "columnNr" : 0,
+ "name" : "ID",
+ "tableName" : "T1",
+ "tableAlias" : "A",
+ "type" : "column"
+ },
+ "right" :
+ {
+ "columnNr" : 0,
+ "name" : "ID",
+ "tableName" : "T2",
+ "tableAlias" : "B",
+ "type" : "column"
+ },
+ "type" : "predicate_equal"
+ }
+ }
+ },
+ "type" : "pushdown"
+ }
+ ],
+ "expectedPushdownResponse":
+ {
+ "Exasol":
+ [
+ "SELECT NULLIFZERO((\"A\".\"ID\" - \"B\".\"ID\")) FROM \"LS\".\"T1\" \"A\" INNER JOIN \"LS\".\"T2\" \"B\" ON \"A\".\"ID\" = \"B\".\"ID\""
+ ],
+ "PostgreSQL":
+ [
+ "SELECT NULLIFZERO((\"a\".\"id\" - \"b\".\"id\")) FROM \"ls\".\"t1\" \"a\" INNER JOIN \"ls\".\"t2\" \"b\" ON \"a\".\"id\" = \"b\".\"id\""
+ ],
+ "Oracle":
+ [
+ "SELECT NULLIF((\"A\".\"ID\" - \"B\".\"ID\"), 0) FROM \"LS\".\"T1\" \"A\" INNER JOIN \"LS\".\"T2\" \"B\" ON \"A\".\"ID\" = \"B\".\"ID\""
+ ],
+ "Hive":
+ [
+ "SELECT NULLIFZERO((`A`.`ID` - `B`.`ID`)) FROM `LS`.`T1` `A` INNER JOIN `LS`.`T2` `B` ON `A`.`ID` = `B`.`ID`"
+ ]
+ }
+ },
+ {
+ "testQuery": "select nullifzero(a.id - vs.t2.id) from vs.t1 a inner join vs.t2 on a.id=vs.t2.id",
+ "expectedPushdownRequest":
+ [
+ {
+ "involvedTables" :
+ [
+ {
+ "columns" :
+ [
+ {
+ "adapterNotes" : "{\"jdbcDataType\":3,\"typeName\":\"DECIMAL\"}",
+ "dataType" :
+ {
+ "precision" : 18,
+ "scale" : 0,
+ "type" : "DECIMAL"
+ },
+ "name" : "ID"
+ }
+ ],
+ "name" : "T1"
+ },
+ {
+ "columns" :
+ [
+ {
+ "adapterNotes" : "{\"jdbcDataType\":3,\"typeName\":\"DECIMAL\"}",
+ "dataType" :
+ {
+ "precision" : 18,
+ "scale" : 0,
+ "type" : "DECIMAL"
+ },
+ "name" : "ID"
+ }
+ ],
+ "name" : "T2"
+ }
+ ],
+ "pushdownRequest" :
+ {
+ "type" : "select",
+ "selectList" :
+ [
+ {
+ "arguments" :
+ [
+ {
+ "arguments" :
+ [
+ {
+ "columnNr" : 0,
+ "name" : "ID",
+ "tableName" : "T1",
+ "tableAlias": "A",
+ "type" : "column"
+ },
+ {
+ "columnNr" : 0,
+ "name" : "ID",
+ "tableName" : "T2",
+ "type" : "column"
+ }
+ ],
+ "infix" : true,
+ "name" : "SUB",
+ "numArgs" : 2,
+ "type" : "function_scalar"
+ }
+ ],
+ "name" : "NULLIFZERO",
+ "numArgs" : 1,
+ "type" : "function_scalar"
+ }
+ ],
+ "from" :
+ {
+ "type": "join",
+ "join_type": "inner",
+ "left":
+ {
+ "name" : "T1",
+ "type" : "table",
+ "alias": "A"
+ },
+ "right":
+ {
+ "name" : "T2",
+ "type" : "table"
+ },
+ "condition":
+ {
+ "left" :
+ {
+ "columnNr" : 0,
+ "name" : "ID",
+ "tableName" : "T1",
+ "tableAlias" : "A",
+ "type" : "column"
+ },
+ "right" :
+ {
+ "columnNr" : 0,
+ "name" : "ID",
+ "tableName" : "T2",
+ "type" : "column"
+ },
+ "type" : "predicate_equal"
+ }
+ }
+ },
+ "type" : "pushdown"
+ }
+ ],
+ "expectedPushdownResponse":
+ {
+ "Exasol":
+ [
+ "SELECT NULLIFZERO((\"A\".\"ID\" - \"T2\".\"ID\")) FROM \"LS\".\"T1\" \"A\" INNER JOIN \"LS\".\"T2\" ON \"A\".\"ID\" = \"T2\".\"ID\""
+ ],
+ "PostgreSQL":
+ [
+ "SELECT NULLIFZERO((\"a\".\"id\" - \"t2\".\"id\")) FROM \"ls\".\"t1\" \"a\" INNER JOIN \"ls\".\"t2\" ON \"a\".\"id\" = \"t2\".\"id\""
+ ],
+ "Oracle":
+ [
+ "SELECT NULLIF((\"A\".\"ID\" - \"T2\".\"ID\"), 0) FROM \"LS\".\"T1\" \"A\" INNER JOIN \"LS\".\"T2\" ON \"A\".\"ID\" = \"T2\".\"ID\""
+ ],
+ "Hive":
+ [
+ "SELECT NULLIFZERO((`A`.`ID` - `T2`.`ID`)) FROM `LS`.`T1` `A` INNER JOIN `LS`.`T2` ON `A`.`ID` = `T2`.`ID`"
+ ]
+ }
+ }
+ ]
+}
diff --git a/jdbc-adapter/virtualschema-jdbc-adapter/src/test/resources/integration/vschema_simple_inner_join.json b/jdbc-adapter/virtualschema-jdbc-adapter/src/test/resources/integration/vschema_simple_inner_join.json
index dfb61df8f..8ba8ea334 100644
--- a/jdbc-adapter/virtualschema-jdbc-adapter/src/test/resources/integration/vschema_simple_inner_join.json
+++ b/jdbc-adapter/virtualschema-jdbc-adapter/src/test/resources/integration/vschema_simple_inner_join.json
@@ -36,7 +36,8 @@
"adapterNotes" : "{\"jdbcDataType\":3,\"typeName\":\"DECIMAL\"}",
"dataType" :
{
- "precision" : 18, "scale" : 0,
+ "precision" : 18,
+ "scale" : 0,
"type" : "DECIMAL"
},
"name" : "ID"
@@ -48,6 +49,21 @@
"pushdownRequest" :
{
"type" : "select",
+ "selectList" :
+ [
+ {
+ "columnNr" : 0,
+ "name" : "ID",
+ "tableName" : "T1",
+ "type" : "column"
+ },
+ {
+ "columnNr" : 0,
+ "name" : "ID",
+ "tableName" : "T2",
+ "type" : "column"
+ }
+ ],
"from" :
{
"type": "join",
@@ -89,9 +105,260 @@
{
"Exasol":
[
- "SELECT * FROM \"LS\".\"T1\" INNER JOIN \"LS\".\"T2\" ON \"T1\".\"ID\" = \"T2\".\"ID\""
+ "SELECT \"T1\".\"ID\", \"T2\".\"ID\" FROM \"LS\".\"T1\" INNER JOIN \"LS\".\"T2\" ON \"T1\".\"ID\" = \"T2\".\"ID\""
+ ],
+ "PostgreSQL":
+ [
+ "SELECT \"t1\".\"id\", \"t2\".\"id\" FROM \"ls\".\"t1\" INNER JOIN \"ls\".\"t2\" ON \"t1\".\"id\" = \"t2\".\"id\""
+ ],
+ "Oracle":
+ [
+ "SELECT \"T1\".\"ID\", \"T2\".\"ID\" FROM \"LS\".\"T1\" INNER JOIN \"LS\".\"T2\" ON \"T1\".\"ID\" = \"T2\".\"ID\""
+ ],
+ "Hive":
+ [
+ "SELECT `T1`.`ID`, `T2`.`ID` FROM `LS`.`T1` INNER JOIN `LS`.`T2` ON `T1`.`ID` = `T2`.`ID`"
+ ]
+ }
+ },
+ {
+ "testQuery": "select * from vs.t1 a inner join vs.t2 b on a.id=b.id",
+ "expectedPushdownRequest":
+ [
+ {
+ "involvedTables" :
+ [
+ {
+ "columns" :
+ [
+ {
+ "adapterNotes" : "{\"jdbcDataType\":3,\"typeName\":\"DECIMAL\"}",
+ "dataType" :
+ {
+ "precision" : 18,
+ "scale" : 0,
+ "type" : "DECIMAL"
+ },
+ "name" : "ID"
+ }
+ ],
+ "name" : "T1"
+ },
+ {
+ "columns" :
+ [
+ {
+ "adapterNotes" : "{\"jdbcDataType\":3,\"typeName\":\"DECIMAL\"}",
+ "dataType" :
+ {
+ "precision" : 18,
+ "scale" : 0,
+ "type" : "DECIMAL"
+ },
+ "name" : "ID"
+ }
+ ],
+ "name" : "T2"
+ }
+ ],
+ "pushdownRequest" :
+ {
+ "type" : "select",
+ "selectList" :
+ [
+ {
+ "columnNr" : 0,
+ "name" : "ID",
+ "tableAlias" : "A",
+ "tableName" : "T1",
+ "type" : "column"
+ },
+ {
+ "columnNr" : 0,
+ "name" : "ID",
+ "tableAlias" : "B",
+ "tableName" : "T2",
+ "type" : "column"
+ }
+ ],
+ "from" :
+ {
+ "type": "join",
+ "join_type": "inner",
+ "left":
+ {
+ "name" : "T1",
+ "type" : "table",
+ "alias": "A"
+ },
+ "right":
+ {
+ "name" : "T2",
+ "type" : "table",
+ "alias": "B"
+ },
+ "condition":
+ {
+ "left" :
+ {
+ "columnNr" : 0,
+ "name" : "ID",
+ "tableName" : "T1",
+ "tableAlias" : "A",
+ "type" : "column"
+ },
+ "right" :
+ {
+ "columnNr" : 0,
+ "name" : "ID",
+ "tableName" : "T2",
+ "tableAlias" : "B",
+ "type" : "column"
+ },
+ "type" : "predicate_equal"
+ }
+ }
+ },
+ "type" : "pushdown"
+ }
+ ],
+ "expectedPushdownResponse":
+ {
+ "Exasol":
+ [
+ "SELECT \"A\".\"ID\", \"B\".\"ID\" FROM \"LS\".\"T1\" \"A\" INNER JOIN \"LS\".\"T2\" \"B\" ON \"A\".\"ID\" = \"B\".\"ID\""
+ ],
+ "PostgreSQL":
+ [
+ "SELECT \"a\".\"id\", \"b\".\"id\" FROM \"ls\".\"t1\" \"a\" INNER JOIN \"ls\".\"t2\" \"b\" ON \"a\".\"id\" = \"b\".\"id\""
+ ],
+ "Oracle":
+ [
+ "SELECT \"A\".\"ID\", \"B\".\"ID\" FROM \"LS\".\"T1\" \"A\" INNER JOIN \"LS\".\"T2\" \"B\" ON \"A\".\"ID\" = \"B\".\"ID\""
+ ],
+ "Hive":
+ [
+ "SELECT `A`.`ID`, `B`.`ID` FROM `LS`.`T1` `A` INNER JOIN `LS`.`T2` `B` ON `A`.`ID` = `B`.`ID`"
+ ]
+ }
+ },
+ {
+ "testQuery": "select * from vs.t1 a inner join vs.t2 on a.id=vs.t2.id",
+ "expectedPushdownRequest":
+ [
+ {
+ "involvedTables" :
+ [
+ {
+ "columns" :
+ [
+ {
+ "adapterNotes" : "{\"jdbcDataType\":3,\"typeName\":\"DECIMAL\"}",
+ "dataType" :
+ {
+ "precision" : 18,
+ "scale" : 0,
+ "type" : "DECIMAL"
+ },
+ "name" : "ID"
+ }
+ ],
+ "name" : "T1"
+ },
+ {
+ "columns" :
+ [
+ {
+ "adapterNotes" : "{\"jdbcDataType\":3,\"typeName\":\"DECIMAL\"}",
+ "dataType" :
+ {
+ "precision" : 18,
+ "scale" : 0,
+ "type" : "DECIMAL"
+ },
+ "name" : "ID"
+ }
+ ],
+ "name" : "T2"
+ }
+ ],
+ "pushdownRequest" :
+ {
+ "type" : "select",
+ "selectList" :
+ [
+ {
+ "columnNr" : 0,
+ "name" : "ID",
+ "tableAlias" : "A",
+ "tableName" : "T1",
+ "type" : "column"
+ },
+ {
+ "columnNr" : 0,
+ "name" : "ID",
+ "tableName" : "T2",
+ "type" : "column"
+ }
+ ],
+ "from" :
+ {
+ "type": "join",
+ "join_type": "inner",
+ "left":
+ {
+ "name" : "T1",
+ "type" : "table",
+ "alias": "A"
+ },
+ "right":
+ {
+ "name" : "T2",
+ "type" : "table"
+ },
+ "condition":
+ {
+ "left" :
+ {
+ "columnNr" : 0,
+ "name" : "ID",
+ "tableName" : "T1",
+ "tableAlias" : "A",
+ "type" : "column"
+ },
+ "right" :
+ {
+ "columnNr" : 0,
+ "name" : "ID",
+ "tableName" : "T2",
+ "type" : "column"
+ },
+ "type" : "predicate_equal"
+ }
+ }
+ },
+ "type" : "pushdown"
+ }
+ ],
+ "expectedPushdownResponse":
+ {
+ "Exasol":
+ [
+ "SELECT \"A\".\"ID\", \"T2\".\"ID\" FROM \"LS\".\"T1\" \"A\" INNER JOIN \"LS\".\"T2\" ON \"A\".\"ID\" = \"T2\".\"ID\""
+ ],
+ "PostgreSQL":
+ [
+ "SELECT \"a\".\"id\", \"t2\".\"id\" FROM \"ls\".\"t1\" \"a\" INNER JOIN \"ls\".\"t2\" ON \"a\".\"id\" = \"t2\".\"id\""
+ ],
+ "Oracle":
+ [
+ "SELECT \"A\".\"ID\", \"T2\".\"ID\" FROM \"LS\".\"T1\" \"A\" INNER JOIN \"LS\".\"T2\" ON \"A\".\"ID\" = \"T2\".\"ID\""
+ ],
+ "Hive":
+ [
+ "SELECT `A`.`ID`, `T2`.`ID` FROM `LS`.`T1` `A` INNER JOIN `LS`.`T2` ON `A`.`ID` = `T2`.`ID`"
]
}
}
]
-}
\ No newline at end of file
+}
diff --git a/jdbc-adapter/virtualschema-jdbc-adapter/src/test/resources/integration/vschema_simple_left_outer_join.json b/jdbc-adapter/virtualschema-jdbc-adapter/src/test/resources/integration/vschema_simple_left_outer_join.json
index 9db423bd7..fda08c271 100644
--- a/jdbc-adapter/virtualschema-jdbc-adapter/src/test/resources/integration/vschema_simple_left_outer_join.json
+++ b/jdbc-adapter/virtualschema-jdbc-adapter/src/test/resources/integration/vschema_simple_left_outer_join.json
@@ -28,22 +28,7 @@
}
],
"name" : "T"
- }
- ],
- "pushdownRequest" :
- {
- "type" : "select",
- "from" :
- {
- "name" : "T",
- "type" : "table"
- }
- },
- "type" : "pushdown"
- },
- {
- "involvedTables" :
- [
+ },
{
"columns" :
[
@@ -62,12 +47,55 @@
],
"pushdownRequest" :
{
- "from" :
+ "type": "select",
+ "selectList":
+ [
+ {
+ "type": "column",
+ "tableName": "U",
+ "name": "Y",
+ "columnNr": 0
+ },
+ {
+ "type": "column",
+ "tableName": "T",
+ "name": "X",
+ "columnNr": 0
+ }
+ ],
+ "from":
{
- "name" : "U",
- "type" : "table"
- },
- "type" : "select"
+ "type": "join",
+ "join_type": "left_outer",
+ "left":
+ {
+ "type": "table",
+ "name": "U"
+ },
+ "right":
+ {
+ "type": "table",
+ "name": "T"
+ },
+ "condition":
+ {
+ "type": "predicate_equal",
+ "left":
+ {
+ "type": "column",
+ "tableName": "T",
+ "name": "X",
+ "columnNr": 0
+ },
+ "right":
+ {
+ "type": "column",
+ "tableName": "U",
+ "name": "Y",
+ "columnNr": 0
+ }
+ }
+ }
},
"type" : "pushdown"
}
@@ -76,10 +104,21 @@
{
"Exasol":
[
- "SELECT * FROM \"LS\".\"U\"",
- "SELECT * FROM \"LS\".\"T\""
+ "SELECT \"U\".\"Y\", \"T\".\"X\" FROM \"LS\".\"U\" LEFT OUTER JOIN \"LS\".\"T\" ON \"T\".\"X\" = \"U\".\"Y\""
+ ],
+ "PostgreSQL":
+ [
+ "SELECT \"u\".\"y\", \"t\".\"x\" FROM \"ls\".\"u\" LEFT OUTER JOIN \"ls\".\"t\" ON \"t\".\"x\" = \"u\".\"y\""
+ ],
+ "Oracle":
+ [
+ "SELECT \"U\".\"Y\", \"T\".\"X\" FROM \"LS\".\"U\" LEFT OUTER JOIN \"LS\".\"T\" ON \"T\".\"X\" = \"U\".\"Y\""
+ ],
+ "Hive":
+ [
+ "SELECT `U`.`Y`, `T`.`X` FROM `LS`.`U` LEFT OUTER JOIN `LS`.`T` ON `T`.`X` = `U`.`Y`"
]
}
}
]
-}
\ No newline at end of file
+}
diff --git a/jdbc-adapter/virtualschema-jdbc-adapter/src/test/resources/integration/vschema_simple_select.json b/jdbc-adapter/virtualschema-jdbc-adapter/src/test/resources/integration/vschema_simple_select.json
index 9a42f01fa..a9f4fe2c2 100644
--- a/jdbc-adapter/virtualschema-jdbc-adapter/src/test/resources/integration/vschema_simple_select.json
+++ b/jdbc-adapter/virtualschema-jdbc-adapter/src/test/resources/integration/vschema_simple_select.json
@@ -47,6 +47,18 @@
"Exasol":
[
"SELECT * FROM \"LS\".\"T\""
+ ],
+ "PostgreSQL":
+ [
+ "SELECT * FROM \"ls\".\"t\""
+ ],
+ "Oracle":
+ [
+ "SELECT * FROM \"LS\".\"T\""
+ ],
+ "Hive":
+ [
+ "SELECT * FROM `LS`.`T`"
]
}
},
@@ -64,7 +76,8 @@
"adapterNotes" : "{\"jdbcDataType\":3,\"typeName\":\"DECIMAL\"}",
"dataType" :
{
- "precision" : 18, "scale" : 0,
+ "precision" : 18,
+ "scale" : 0,
"type" : "DECIMAL"
},
"name" : "Y"
@@ -90,6 +103,18 @@
"Exasol":
[
"SELECT * FROM \"LS\".\"U\""
+ ],
+ "PostgreSQL":
+ [
+ "SELECT * FROM \"ls\".\"u\""
+ ],
+ "Oracle":
+ [
+ "SELECT * FROM \"LS\".\"U\""
+ ],
+ "Hive":
+ [
+ "SELECT * FROM `LS`.`U`"
]
}
}
diff --git a/jdbc-adapter/virtualschema-jdbc-adapter/src/test/resources/integration/vschema_table_alias_pushdown.json b/jdbc-adapter/virtualschema-jdbc-adapter/src/test/resources/integration/vschema_table_alias_pushdown.json
index 2028d1056..b5191b4e8 100644
--- a/jdbc-adapter/virtualschema-jdbc-adapter/src/test/resources/integration/vschema_table_alias_pushdown.json
+++ b/jdbc-adapter/virtualschema-jdbc-adapter/src/test/resources/integration/vschema_table_alias_pushdown.json
@@ -66,6 +66,18 @@
"Exasol":
[
"SELECT \"X\" FROM \"LS\".\"T1\""
+ ],
+ "PostgreSQL":
+ [
+ "SELECT \"x\" FROM \"ls\".\"t1\""
+ ],
+ "Oracle":
+ [
+ "SELECT \"X\" FROM \"LS\".\"T1\""
+ ],
+ "Hive":
+ [
+ "SELECT `X` FROM `LS`.`T1`"
]
}
},
@@ -130,7 +142,19 @@
{
"Exasol":
[
- "SELECT \"X\" FROM \"LS\".\"T1\""
+ "SELECT \"X\" FROM \"LS\".\"T1\" \"WITHALIAS\""
+ ],
+ "PostgreSQL":
+ [
+ "SELECT \"x\" FROM \"ls\".\"t1\" \"withalias\""
+ ],
+ "Oracle":
+ [
+ "SELECT \"X\" FROM \"LS\".\"T1\" \"WITHALIAS\""
+ ],
+ "Hive":
+ [
+ "SELECT `X` FROM `LS`.`T1` `WITHALIAS`"
]
}
},
@@ -174,7 +198,19 @@
{
"Exasol":
[
- "SELECT * FROM \"LS\".\"T2\""
+ "SELECT * FROM \"LS\".\"T2\" \"WITHALIAS\""
+ ],
+ "PostgreSQL":
+ [
+ "SELECT * FROM \"ls\".\"t2\" \"withalias\""
+ ],
+ "Oracle":
+ [
+ "SELECT * FROM \"LS\".\"T2\" \"WITHALIAS\""
+ ],
+ "Hive":
+ [
+ "SELECT * FROM `LS`.`T2` `WITHALIAS`"
]
}
},
@@ -210,33 +246,7 @@
}
],
"name" : "T1"
- }
- ],
- "pushdownRequest" :
- {
- "type" : "select",
- "selectList":
- [
- {
- "type": "column",
- "tableName": "T1",
- "tableAlias": "T1ALIAS",
- "name": "X",
- "columnNr": 0
- }
- ],
- "from" :
- {
- "name" : "T1",
- "alias": "T1ALIAS",
- "type" : "table"
- }
- },
- "type" : "pushdown"
- },
- {
- "involvedTables" :
- [
+ },
{
"columns" :
[
@@ -255,12 +265,60 @@
],
"pushdownRequest" :
{
- "type" : "select",
- "from" :
+ "type": "select",
+ "selectList":
+ [
+ {
+ "type": "column",
+ "tableAlias": "T1ALIAS",
+ "tableName": "T1",
+ "name": "X",
+ "columnNr": 0
+ },
+ {
+ "type": "column",
+ "tableAlias": "T2ALIAS",
+ "tableName": "T2",
+ "name": "X",
+ "columnNr": 0
+ }
+ ],
+ "from":
{
- "name" : "T2",
- "alias": "T2ALIAS",
- "type" : "table"
+ "type": "join",
+ "join_type": "inner",
+ "right":
+ {
+ "alias": "T2ALIAS",
+ "type": "table",
+ "name": "T2"
+ },
+ "left":
+ {
+ "alias": "T1ALIAS",
+ "type": "table",
+ "name": "T1"
+ },
+ "condition":
+ {
+ "right":
+ {
+ "type": "column",
+ "tableAlias": "T2ALIAS",
+ "tableName": "T2",
+ "name": "X",
+ "columnNr": 0
+ },
+ "type": "predicate_equal",
+ "left":
+ {
+ "type": "column",
+ "tableAlias": "T1ALIAS",
+ "tableName": "T1",
+ "name": "X",
+ "columnNr": 0
+ }
+ }
}
},
"type" : "pushdown"
@@ -270,8 +328,19 @@
{
"Exasol":
[
- "SELECT \"X\" FROM \"LS\".\"T1\"",
- "SELECT * FROM \"LS\".\"T2\""
+ "SELECT \"T1ALIAS\".\"X\", \"T2ALIAS\".\"X\" FROM \"LS\".\"T1\" \"T1ALIAS\" INNER JOIN \"LS\".\"T2\" \"T2ALIAS\" ON \"T1ALIAS\".\"X\" = \"T2ALIAS\".\"X\""
+ ],
+ "PostgreSQL":
+ [
+ "SELECT \"t1alias\".\"x\", \"t2alias\".\"x\" FROM \"ls\".\"t1\" \"t1alias\" INNER JOIN \"ls\".\"t2\" \"t2alias\" ON \"t1alias\".\"x\" = \"t2alias\".\"x\""
+ ],
+ "Oracle":
+ [
+ "SELECT \"T1ALIAS\".\"X\", \"T2ALIAS\".\"X\" FROM \"LS\".\"T1\" \"T1ALIAS\" INNER JOIN \"LS\".\"T2\" \"T2ALIAS\" ON \"T1ALIAS\".\"X\" = \"T2ALIAS\".\"X\""
+ ],
+ "Hive":
+ [
+ "SELECT `T1ALIAS`.`X`, `T2ALIAS`.`X` FROM `LS`.`T1` `T1ALIAS` INNER JOIN `LS`.`T2` `T2ALIAS` ON `T1ALIAS`.`X` = `T2ALIAS`.`X`"
]
}
}