You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tajo.apache.org by hy...@apache.org on 2014/03/25 04:20:14 UTC
[2/3] git commit: TAJO-644: Support quoted identifiers. (hyunsik)
TAJO-644: Support quoted identifiers. (hyunsik)
Project: http://git-wip-us.apache.org/repos/asf/tajo/repo
Commit: http://git-wip-us.apache.org/repos/asf/tajo/commit/37fef799
Tree: http://git-wip-us.apache.org/repos/asf/tajo/tree/37fef799
Diff: http://git-wip-us.apache.org/repos/asf/tajo/diff/37fef799
Branch: refs/heads/master
Commit: 37fef799b161dbe2f9cea1284c4818b92f7fddbc
Parents: 3ba2624
Author: Hyunsik Choi <hy...@apache.org>
Authored: Sun Mar 23 23:29:31 2014 +0900
Committer: Hyunsik Choi <hy...@apache.org>
Committed: Sun Mar 23 23:29:31 2014 +0900
----------------------------------------------------------------------
CHANGES.txt | 4 +-
.../tajo/algebra/ColumnReferenceExpr.java | 8 +--
.../tajo/algebra/QualifiedAsteriskExpr.java | 2 +-
.../tajo/catalog/AbstractCatalogClient.java | 2 +-
.../org/apache/tajo/catalog/CatalogUtil.java | 23 ++++++-
.../java/org/apache/tajo/catalog/Column.java | 4 +-
.../java/org/apache/tajo/catalog/IndexDesc.java | 4 +-
.../java/org/apache/tajo/catalog/Schema.java | 14 ++--
.../java/org/apache/tajo/catalog/TableDesc.java | 7 +-
.../tajo/catalog/store/HCatalogStore.java | 2 +-
.../org/apache/tajo/catalog/CatalogServer.java | 64 +++++++++---------
.../tajo/catalog/store/AbstractDBStore.java | 16 ++---
.../org/apache/tajo/catalog/store/MemStore.java | 4 +-
.../java/org/apache/tajo/client/TajoClient.java | 31 +++++----
.../apache/tajo/engine/parser/HiveQLLexer.g4 | 4 +-
.../org/apache/tajo/engine/parser/SQLLexer.g4 | 9 ++-
.../org/apache/tajo/engine/parser/SQLParser.g4 | 7 +-
.../apache/tajo/engine/planner/LogicalPlan.java | 8 +--
.../tajo/engine/planner/NamedExprsManager.java | 6 +-
.../org/apache/tajo/engine/planner/Target.java | 2 +-
.../tajo/engine/planner/logical/ScanNode.java | 2 +-
.../planner/logical/TableSubQueryNode.java | 3 +-
.../apache/tajo/engine/query/QueryContext.java | 3 +-
.../org/apache/tajo/master/GlobalEngine.java | 4 +-
.../tajo/master/TajoMasterClientService.java | 2 +-
.../java/org/apache/tajo/QueryTestCaseBase.java | 4 +-
.../org/apache/tajo/client/TestTajoClient.java | 42 ++++++------
.../apache/tajo/engine/eval/ExprTestBase.java | 7 +-
.../apache/tajo/engine/eval/TestPredicates.java | 5 +-
.../tajo/engine/eval/TestSQLExpression.java | 12 ++++
.../engine/function/TestDateTimeFunctions.java | 29 ++++++--
.../engine/planner/TestLogicalOptimizer.java | 8 +--
.../tajo/engine/planner/TestLogicalPlanner.java | 2 +-
.../tajo/engine/planner/TestPlannerUtil.java | 8 +--
.../planner/physical/TestBNLJoinExec.java | 12 ++--
.../planner/physical/TestBSTIndexExec.java | 10 +--
.../planner/physical/TestExternalSortExec.java | 10 +--
.../planner/physical/TestHashAntiJoinExec.java | 12 ++--
.../planner/physical/TestHashJoinExec.java | 12 ++--
.../planner/physical/TestHashSemiJoinExec.java | 12 ++--
.../planner/physical/TestMergeJoinExec.java | 12 ++--
.../engine/planner/physical/TestNLJoinExec.java | 12 ++--
.../planner/physical/TestPhysicalPlanner.java | 8 +--
.../physical/TestProgressExternalSortExec.java | 10 +--
.../engine/planner/physical/TestSortExec.java | 6 +-
.../apache/tajo/engine/query/TestCTASQuery.java | 16 +++--
.../tajo/engine/query/TestCreateDatabase.java | 11 +--
.../tajo/engine/query/TestCreateTable.java | 70 ++++++++++++++++++++
.../tajo/engine/query/TestInsertQuery.java | 18 ++---
.../tajo/engine/query/TestTablePartitions.java | 21 +++---
.../java/org/apache/tajo/jdbc/TestTajoJdbc.java | 2 +-
.../querymaster/TestQueryUnitStatusUpdate.java | 3 +-
.../tajo/worker/TestRangeRetrieverHandler.java | 2 +-
.../dataset/TestCreateTable/table2/table2.tbl | 3 +
.../org/apache/tajo/jdbc/TestTajoResultSet.java | 63 ------------------
.../quoted_identifier_mixed_chars_1.sql | 1 +
.../quoted_identifier_mixed_chars_2.sql | 1 +
.../quoted_identifier_mixed_chars_3.sql | 22 ++++++
.../quoted_identifier_mixed_chars_ddl_1.sql | 1 +
.../quoted_identifier_mixed_chars_ddl_2.sql | 1 +
.../quoted_identifier_non_ascii_1.sql | 1 +
.../quoted_identifier_non_ascii_2.sql | 1 +
.../quoted_identifier_non_ascii_3.sql | 1 +
.../quoted_identifier_non_ascii_ddl.sql | 1 +
.../quoted_identifier_mixed_chars_1.result | 5 ++
.../quoted_identifier_mixed_chars_2.result | 5 ++
.../quoted_identifier_mixed_chars_3.result | 8 +++
.../quoted_identifier_non_ascii_1.result | 5 ++
.../quoted_identifier_non_ascii_2.result | 5 ++
.../quoted_identifier_non_ascii_3.result | 5 ++
.../results/TestTajoJdbc/getTables1.result | 2 +-
.../results/TestTajoJdbc/getTables2.result | 2 +-
.../apache/tajo/jdbc/TajoDatabaseMetaData.java | 35 +++++-----
73 files changed, 463 insertions(+), 316 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/tajo/blob/37fef799/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index 7b379b3..a935225 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -132,7 +132,9 @@ Release 0.8.0 - unreleased
IMPROVEMENTS
- TAJO-553: Add a method to the TajoClient to get finished query lists.
+ TAJO-644: Support quoted identifiers. (hyunsik)
+
+ TAJO-553: Add a method to the TajoClient to get finished query lists.
(Ilhyun Suh via jihoon)
TAJO-670: Change daemon's hostname to canonical hostname
http://git-wip-us.apache.org/repos/asf/tajo/blob/37fef799/tajo-algebra/src/main/java/org/apache/tajo/algebra/ColumnReferenceExpr.java
----------------------------------------------------------------------
diff --git a/tajo-algebra/src/main/java/org/apache/tajo/algebra/ColumnReferenceExpr.java b/tajo-algebra/src/main/java/org/apache/tajo/algebra/ColumnReferenceExpr.java
index e1369df..58f7b81 100644
--- a/tajo-algebra/src/main/java/org/apache/tajo/algebra/ColumnReferenceExpr.java
+++ b/tajo-algebra/src/main/java/org/apache/tajo/algebra/ColumnReferenceExpr.java
@@ -32,8 +32,8 @@ public class ColumnReferenceExpr extends Expr {
public ColumnReferenceExpr(String qualifier, String columnName) {
super(OpType.Column);
- this.qualifier = qualifier.toLowerCase();
- this.name = columnName.toLowerCase();
+ this.qualifier = qualifier;
+ this.name = columnName;
}
public boolean hasQualifier() {
@@ -41,7 +41,7 @@ public class ColumnReferenceExpr extends Expr {
}
public void setQualifier(String qualifier) {
- this.qualifier = qualifier.toLowerCase();
+ this.qualifier = qualifier;
}
public String getQualifier() {
@@ -53,7 +53,7 @@ public class ColumnReferenceExpr extends Expr {
}
public void setName(String qualifiedName) {
- String [] parts = qualifiedName.toLowerCase().split("\\.");
+ String [] parts = qualifiedName.split("\\.");
if (parts.length > 1) {
qualifier = qualifiedName.substring(0, qualifiedName.lastIndexOf("."));
http://git-wip-us.apache.org/repos/asf/tajo/blob/37fef799/tajo-algebra/src/main/java/org/apache/tajo/algebra/QualifiedAsteriskExpr.java
----------------------------------------------------------------------
diff --git a/tajo-algebra/src/main/java/org/apache/tajo/algebra/QualifiedAsteriskExpr.java b/tajo-algebra/src/main/java/org/apache/tajo/algebra/QualifiedAsteriskExpr.java
index ab8e677..d26deb9 100644
--- a/tajo-algebra/src/main/java/org/apache/tajo/algebra/QualifiedAsteriskExpr.java
+++ b/tajo-algebra/src/main/java/org/apache/tajo/algebra/QualifiedAsteriskExpr.java
@@ -39,7 +39,7 @@ public class QualifiedAsteriskExpr extends Expr {
}
public void setQualifier(String qualifier) {
- this.qualifier = qualifier.toLowerCase();
+ this.qualifier = qualifier;
}
@Override
http://git-wip-us.apache.org/repos/asf/tajo/blob/37fef799/tajo-catalog/tajo-catalog-client/src/main/java/org/apache/tajo/catalog/AbstractCatalogClient.java
----------------------------------------------------------------------
diff --git a/tajo-catalog/tajo-catalog-client/src/main/java/org/apache/tajo/catalog/AbstractCatalogClient.java b/tajo-catalog/tajo-catalog-client/src/main/java/org/apache/tajo/catalog/AbstractCatalogClient.java
index 6ee788c..6fb385e 100644
--- a/tajo-catalog/tajo-catalog-client/src/main/java/org/apache/tajo/catalog/AbstractCatalogClient.java
+++ b/tajo-catalog/tajo-catalog-client/src/main/java/org/apache/tajo/catalog/AbstractCatalogClient.java
@@ -408,7 +408,7 @@ public abstract class AbstractCatalogClient implements CatalogService {
GetIndexByColumnRequest.Builder builder = GetIndexByColumnRequest.newBuilder();
builder.setTableIdentifier(CatalogUtil.buildTableIdentifier(databaseName, tableName));
- builder.setColumnName(CatalogUtil.normalizeIdentifier(columnName));
+ builder.setColumnName(columnName);
CatalogProtocolService.BlockingInterface stub = getStub(client);
return stub.existIndexByColumn(null, builder.build()).getValue();
http://git-wip-us.apache.org/repos/asf/tajo/blob/37fef799/tajo-catalog/tajo-catalog-common/src/main/java/org/apache/tajo/catalog/CatalogUtil.java
----------------------------------------------------------------------
diff --git a/tajo-catalog/tajo-catalog-common/src/main/java/org/apache/tajo/catalog/CatalogUtil.java b/tajo-catalog/tajo-catalog-common/src/main/java/org/apache/tajo/catalog/CatalogUtil.java
index 05a18bd..2ddbb17 100644
--- a/tajo-catalog/tajo-catalog-common/src/main/java/org/apache/tajo/catalog/CatalogUtil.java
+++ b/tajo-catalog/tajo-catalog-common/src/main/java/org/apache/tajo/catalog/CatalogUtil.java
@@ -47,7 +47,26 @@ public class CatalogUtil {
* @return The normalized identifier
*/
public static String normalizeIdentifier(String identifier) {
- return identifier.toLowerCase();
+ return isDelimited(identifier) ? stripQuote(identifier).toLowerCase() : identifier.toLowerCase();
+ }
+
+ public static String stripQuote(String str) {
+ return str.substring(1, str.length() - 1);
+ }
+
+ public static boolean isDelimited(String identifier) {
+ boolean openQuote = identifier.charAt(0) == '"';
+ boolean closeQuote = identifier.charAt(identifier.length() - 1) == '"';
+
+ if (openQuote ^ closeQuote || identifier.length() < 2) {
+ throw new IllegalArgumentException("Invalid Identifier: " + identifier);
+ }
+
+ if (openQuote && closeQuote && identifier.length() == 2) {
+ throw new IllegalArgumentException("zero-length delimited identifier: " + identifier);
+ }
+
+ return openQuote && closeQuote && identifier.length() > 2;
}
public static boolean isFQColumnName(String tableName) {
@@ -60,7 +79,7 @@ public class CatalogUtil {
}
public static String [] splitFQTableName(String qualifiedName) {
- String [] splitted = CatalogUtil.splitTableName(CatalogUtil.normalizeIdentifier(qualifiedName));
+ String [] splitted = CatalogUtil.splitTableName(qualifiedName);
if (splitted.length == 1) {
throw new IllegalArgumentException("createTable() requires a qualified table name, but it is \""
+ qualifiedName + "\".");
http://git-wip-us.apache.org/repos/asf/tajo/blob/37fef799/tajo-catalog/tajo-catalog-common/src/main/java/org/apache/tajo/catalog/Column.java
----------------------------------------------------------------------
diff --git a/tajo-catalog/tajo-catalog-common/src/main/java/org/apache/tajo/catalog/Column.java b/tajo-catalog/tajo-catalog-common/src/main/java/org/apache/tajo/catalog/Column.java
index b75cd1c..2e29536 100644
--- a/tajo-catalog/tajo-catalog-common/src/main/java/org/apache/tajo/catalog/Column.java
+++ b/tajo-catalog/tajo-catalog-common/src/main/java/org/apache/tajo/catalog/Column.java
@@ -40,7 +40,7 @@ public class Column implements ProtoObject<ColumnProto>, GsonObject {
* @param dataType Data Type with length
*/
public Column(String name, DataType dataType) {
- this.name = CatalogUtil.normalizeIdentifier(name);
+ this.name = name;
this.dataType = dataType;
}
@@ -64,7 +64,7 @@ public class Column implements ProtoObject<ColumnProto>, GsonObject {
}
public Column(ColumnProto proto) {
- name = CatalogUtil.normalizeIdentifier(proto.getName());
+ name = proto.getName();
dataType = proto.getDataType();
}
http://git-wip-us.apache.org/repos/asf/tajo/blob/37fef799/tajo-catalog/tajo-catalog-common/src/main/java/org/apache/tajo/catalog/IndexDesc.java
----------------------------------------------------------------------
diff --git a/tajo-catalog/tajo-catalog-common/src/main/java/org/apache/tajo/catalog/IndexDesc.java b/tajo-catalog/tajo-catalog-common/src/main/java/org/apache/tajo/catalog/IndexDesc.java
index ef65b36..d77408a 100644
--- a/tajo-catalog/tajo-catalog-common/src/main/java/org/apache/tajo/catalog/IndexDesc.java
+++ b/tajo-catalog/tajo-catalog-common/src/main/java/org/apache/tajo/catalog/IndexDesc.java
@@ -45,9 +45,9 @@ public class IndexDesc implements ProtoObject<IndexDescProto>, Cloneable {
public IndexDesc(String idxName, String databaseName, String tableName, Column column,
IndexMethod type, boolean isUnique, boolean isClustered, boolean isAscending) {
this();
- this.indexName = idxName.toLowerCase();
+ this.indexName = idxName;
this.databaseName = databaseName;
- this.tableName = tableName.toLowerCase();
+ this.tableName = tableName;
this.column = column;
this.indexMethod = type;
this.isUnique = isUnique;
http://git-wip-us.apache.org/repos/asf/tajo/blob/37fef799/tajo-catalog/tajo-catalog-common/src/main/java/org/apache/tajo/catalog/Schema.java
----------------------------------------------------------------------
diff --git a/tajo-catalog/tajo-catalog-common/src/main/java/org/apache/tajo/catalog/Schema.java b/tajo-catalog/tajo-catalog-common/src/main/java/org/apache/tajo/catalog/Schema.java
index 0c812f1..b2dde3d 100644
--- a/tajo-catalog/tajo-catalog-common/src/main/java/org/apache/tajo/catalog/Schema.java
+++ b/tajo-catalog/tajo-catalog-common/src/main/java/org/apache/tajo/catalog/Schema.java
@@ -147,7 +147,7 @@ public class Schema implements ProtoObject<SchemaProto>, Cloneable, GsonObject {
* @return The Column matched to a given qualified name
*/
private Column getColumnByQName(String qualifiedName) {
- Integer cid = fieldsByQualifiedName.get(qualifiedName.toLowerCase());
+ Integer cid = fieldsByQualifiedName.get(qualifiedName);
return cid != null ? fields.get(cid) : null;
}
@@ -161,7 +161,7 @@ public class Schema implements ProtoObject<SchemaProto>, Cloneable, GsonObject {
* @return The Column matched to a given name.
*/
private Column getColumnByName(String columnName) {
- String normalized = columnName.toLowerCase();
+ String normalized = columnName;
List<Integer> list = fieldsByName.get(normalized);
if (list == null || list.size() == 0) {
@@ -213,7 +213,7 @@ public class Schema implements ProtoObject<SchemaProto>, Cloneable, GsonObject {
public int getColumnIdByName(String colName) {
for (Column col : fields) {
- if (col.getSimpleName().equals(colName.toLowerCase())) {
+ if (col.getSimpleName().equals(colName)) {
String qualifiedName = col.getQualifiedName();
return fieldsByQualifiedName.get(qualifiedName);
}
@@ -226,10 +226,10 @@ public class Schema implements ProtoObject<SchemaProto>, Cloneable, GsonObject {
}
public boolean contains(String name) {
- if (fieldsByQualifiedName.containsKey(name.toLowerCase())) {
+ if (fieldsByQualifiedName.containsKey(name)) {
return true;
}
- if (fieldsByName.containsKey(name.toLowerCase())) {
+ if (fieldsByName.containsKey(name)) {
if (fieldsByName.size() > 1) {
throw new RuntimeException("Ambiguous Column name");
}
@@ -258,7 +258,7 @@ public class Schema implements ProtoObject<SchemaProto>, Cloneable, GsonObject {
}
public boolean containsByQualifiedName(String qualifiedName) {
- return fieldsByQualifiedName.containsKey(qualifiedName.toLowerCase());
+ return fieldsByQualifiedName.containsKey(qualifiedName);
}
public boolean containsByName(String colName) {
@@ -281,7 +281,7 @@ public class Schema implements ProtoObject<SchemaProto>, Cloneable, GsonObject {
}
public synchronized Schema addColumn(String name, DataType dataType) {
- String normalized = name.toLowerCase();
+ String normalized = name;
if(fieldsByQualifiedName.containsKey(normalized)) {
LOG.error("Already exists column " + normalized);
throw new AlreadyExistsFieldException(normalized);
http://git-wip-us.apache.org/repos/asf/tajo/blob/37fef799/tajo-catalog/tajo-catalog-common/src/main/java/org/apache/tajo/catalog/TableDesc.java
----------------------------------------------------------------------
diff --git a/tajo-catalog/tajo-catalog-common/src/main/java/org/apache/tajo/catalog/TableDesc.java b/tajo-catalog/tajo-catalog-common/src/main/java/org/apache/tajo/catalog/TableDesc.java
index 30102eb..4251116 100644
--- a/tajo-catalog/tajo-catalog-common/src/main/java/org/apache/tajo/catalog/TableDesc.java
+++ b/tajo-catalog/tajo-catalog-common/src/main/java/org/apache/tajo/catalog/TableDesc.java
@@ -56,7 +56,7 @@ public class TableDesc implements ProtoObject<TableDescProto>, GsonObject, Clone
public TableDesc(String tableName, Schema schema, TableMeta meta,
Path path, boolean external) {
this();
- this.tableName = tableName.toLowerCase();
+ this.tableName = tableName;
this.schema = schema;
this.meta = meta;
this.uri = path;
@@ -64,7 +64,7 @@ public class TableDesc implements ProtoObject<TableDescProto>, GsonObject, Clone
}
public TableDesc(String tableName, Schema schema, TableMeta meta, Path path) {
- this(CatalogUtil.normalizeIdentifier(tableName), schema, meta, path, true);
+ this(tableName, schema, meta, path, true);
}
public TableDesc(String tableName, Schema schema, StoreType type, Options options, Path path) {
@@ -83,8 +83,7 @@ public class TableDesc implements ProtoObject<TableDescProto>, GsonObject, Clone
}
public void setName(String tableId) {
- // tajo deems all identifiers as lowcase characters
- this.tableName = tableId.toLowerCase();
+ this.tableName = tableId;
}
public String getName() {
http://git-wip-us.apache.org/repos/asf/tajo/blob/37fef799/tajo-catalog/tajo-catalog-drivers/tajo-hcatalog/src/main/java/org/apache/tajo/catalog/store/HCatalogStore.java
----------------------------------------------------------------------
diff --git a/tajo-catalog/tajo-catalog-drivers/tajo-hcatalog/src/main/java/org/apache/tajo/catalog/store/HCatalogStore.java b/tajo-catalog/tajo-catalog-drivers/tajo-hcatalog/src/main/java/org/apache/tajo/catalog/store/HCatalogStore.java
index 50726a6..6ef255f 100644
--- a/tajo-catalog/tajo-catalog-drivers/tajo-hcatalog/src/main/java/org/apache/tajo/catalog/store/HCatalogStore.java
+++ b/tajo-catalog/tajo-catalog-drivers/tajo-hcatalog/src/main/java/org/apache/tajo/catalog/store/HCatalogStore.java
@@ -377,7 +377,7 @@ public class HCatalogStore extends CatalogConstants implements CatalogStore {
HCatalogStoreClientPool.HCatalogStoreClient client = null;
TableDesc tableDesc = new TableDesc(tableDescProto);
- String [] splitted = CatalogUtil.splitFQTableName(CatalogUtil.normalizeIdentifier(tableDesc.getName()));
+ String [] splitted = CatalogUtil.splitFQTableName(tableDesc.getName());
String databaseName = splitted[0];
String tableName = splitted[1];
http://git-wip-us.apache.org/repos/asf/tajo/blob/37fef799/tajo-catalog/tajo-catalog-server/src/main/java/org/apache/tajo/catalog/CatalogServer.java
----------------------------------------------------------------------
diff --git a/tajo-catalog/tajo-catalog-server/src/main/java/org/apache/tajo/catalog/CatalogServer.java b/tajo-catalog/tajo-catalog-server/src/main/java/org/apache/tajo/catalog/CatalogServer.java
index d4ee769..a171fb4 100644
--- a/tajo-catalog/tajo-catalog-server/src/main/java/org/apache/tajo/catalog/CatalogServer.java
+++ b/tajo-catalog/tajo-catalog-server/src/main/java/org/apache/tajo/catalog/CatalogServer.java
@@ -209,7 +209,7 @@ public class CatalogServer extends AbstractService {
@Override
public BoolProto createTablespace(RpcController controller, CreateTablespaceRequest request) throws ServiceException {
- final String tablespaceName = CatalogUtil.normalizeIdentifier(request.getTablespaceName());
+ final String tablespaceName = request.getTablespaceName();
final String uri = request.getTablespaceUri();
wlock.lock();
@@ -232,7 +232,7 @@ public class CatalogServer extends AbstractService {
@Override
public BoolProto dropTablespace(RpcController controller, StringProto request) throws ServiceException {
- String tablespaceName = CatalogUtil.normalizeIdentifier(request.getValue());
+ String tablespaceName = request.getValue();
wlock.lock();
try {
@@ -253,7 +253,7 @@ public class CatalogServer extends AbstractService {
@Override
public BoolProto existTablespace(RpcController controller, StringProto request) throws ServiceException {
- String tablespaceName = CatalogUtil.normalizeIdentifier(request.getValue());
+ String tablespaceName = request.getValue();
rlock.lock();
try {
@@ -285,8 +285,8 @@ public class CatalogServer extends AbstractService {
@Override
public BoolProto createDatabase(RpcController controller, CreateDatabaseRequest request) throws ServiceException {
- String databaseName = CatalogUtil.normalizeIdentifier(request.getDatabaseName());
- String tablespaceName = CatalogUtil.normalizeIdentifier(request.getTablespaceName());
+ String databaseName = request.getDatabaseName();
+ String tablespaceName = request.getTablespaceName();
wlock.lock();
try {
@@ -307,7 +307,7 @@ public class CatalogServer extends AbstractService {
@Override
public BoolProto dropDatabase(RpcController controller, StringProto request) throws ServiceException {
- String databaseName = CatalogUtil.normalizeIdentifier(request.getValue());
+ String databaseName = request.getValue();
wlock.lock();
try {
@@ -328,7 +328,7 @@ public class CatalogServer extends AbstractService {
@Override
public BoolProto existDatabase(RpcController controller, StringProto request) throws ServiceException {
- String databaseName = CatalogUtil.normalizeIdentifier(request.getValue());
+ String databaseName = request.getValue();
rlock.lock();
try {
@@ -361,8 +361,8 @@ public class CatalogServer extends AbstractService {
@Override
public TableDescProto getTableDesc(RpcController controller,
TableIdentifierProto request) throws ServiceException {
- String databaseName = CatalogUtil.normalizeIdentifier(request.getDatabaseName());
- String tableName = CatalogUtil.normalizeIdentifier(request.getTableName());
+ String databaseName = request.getDatabaseName();
+ String tableName = request.getTableName();
rlock.lock();
try {
@@ -375,7 +375,7 @@ public class CatalogServer extends AbstractService {
if (contain) {
return store.getTable(databaseName, tableName);
} else {
- throw new NoSuchTableException(databaseName);
+ throw new NoSuchTableException(tableName);
}
} else {
throw new NoSuchDatabaseException(databaseName);
@@ -392,7 +392,7 @@ public class CatalogServer extends AbstractService {
public StringListProto getAllTableNames(RpcController controller, StringProto request)
throws ServiceException {
- String databaseName = CatalogUtil.normalizeIdentifier(request.getValue());
+ String databaseName = request.getValue();
rlock.lock();
try {
@@ -425,7 +425,7 @@ public class CatalogServer extends AbstractService {
public BoolProto createTable(RpcController controller, TableDescProto request)throws ServiceException {
String [] splitted =
- CatalogUtil.splitFQTableName(CatalogUtil.normalizeIdentifier(request.getTableName()));
+ CatalogUtil.splitFQTableName(request.getTableName());
String databaseName = splitted[0];
String tableName = splitted[1];
@@ -459,8 +459,8 @@ public class CatalogServer extends AbstractService {
@Override
public BoolProto dropTable(RpcController controller, TableIdentifierProto request) throws ServiceException {
- String databaseName = CatalogUtil.normalizeIdentifier(request.getDatabaseName());
- String tableName = CatalogUtil.normalizeIdentifier(request.getTableName());
+ String databaseName = request.getDatabaseName();
+ String tableName = request.getTableName();
wlock.lock();
try {
@@ -490,8 +490,8 @@ public class CatalogServer extends AbstractService {
@Override
public BoolProto existsTable(RpcController controller, TableIdentifierProto request)
throws ServiceException {
- String databaseName = CatalogUtil.normalizeIdentifier(request.getDatabaseName());
- String tableName = CatalogUtil.normalizeIdentifier(request.getTableName());
+ String databaseName = request.getDatabaseName();
+ String tableName = request.getTableName();
rlock.lock();
try {
@@ -520,8 +520,8 @@ public class CatalogServer extends AbstractService {
public PartitionMethodProto getPartitionMethodByTableName(RpcController controller,
TableIdentifierProto request)
throws ServiceException {
- String databaseName = CatalogUtil.normalizeIdentifier(request.getDatabaseName());
- String tableName = CatalogUtil.normalizeIdentifier(request.getTableName());
+ String databaseName = request.getDatabaseName();
+ String tableName = request.getTableName();
rlock.lock();
try {
@@ -554,8 +554,8 @@ public class CatalogServer extends AbstractService {
@Override
public BoolProto existPartitionMethod(RpcController controller, TableIdentifierProto request)
throws ServiceException {
- String databaseName = CatalogUtil.normalizeIdentifier(request.getDatabaseName());
- String tableName = CatalogUtil.normalizeIdentifier(request.getTableName());
+ String databaseName = request.getDatabaseName();
+ String tableName = request.getTableName();
rlock.lock();
try {
@@ -646,8 +646,8 @@ public class CatalogServer extends AbstractService {
@Override
public BoolProto existIndexByName(RpcController controller, IndexNameProto request) throws ServiceException {
- String databaseName = CatalogUtil.normalizeIdentifier(request.getDatabaseName());
- String indexName = CatalogUtil.normalizeIdentifier(request.getIndexName());
+ String databaseName = request.getDatabaseName();
+ String indexName = request.getIndexName();
rlock.lock();
try {
@@ -665,9 +665,9 @@ public class CatalogServer extends AbstractService {
throws ServiceException {
TableIdentifierProto identifier = request.getTableIdentifier();
- String databaseName = CatalogUtil.normalizeIdentifier(identifier.getDatabaseName());
- String tableName = CatalogUtil.normalizeIdentifier(identifier.getTableName());
- String columnName = CatalogUtil.normalizeIdentifier(request.getColumnName());
+ String databaseName = identifier.getDatabaseName();
+ String tableName = identifier.getTableName();
+ String columnName = request.getColumnName();
rlock.lock();
try {
@@ -685,8 +685,8 @@ public class CatalogServer extends AbstractService {
public IndexDescProto getIndexByName(RpcController controller, IndexNameProto request)
throws ServiceException {
- String databaseName = CatalogUtil.normalizeIdentifier(request.getDatabaseName());
- String indexName = CatalogUtil.normalizeIdentifier(request.getIndexName());
+ String databaseName = request.getDatabaseName();
+ String indexName = request.getIndexName();
rlock.lock();
try {
@@ -707,9 +707,9 @@ public class CatalogServer extends AbstractService {
throws ServiceException {
TableIdentifierProto identifier = request.getTableIdentifier();
- String databaseName = CatalogUtil.normalizeIdentifier(identifier.getDatabaseName());
- String tableName = CatalogUtil.normalizeIdentifier(identifier.getTableName());
- String columnName = CatalogUtil.normalizeIdentifier(request.getColumnName());
+ String databaseName = identifier.getDatabaseName();
+ String tableName = identifier.getTableName();
+ String columnName = request.getColumnName();
rlock.lock();
try {
@@ -729,8 +729,8 @@ public class CatalogServer extends AbstractService {
public BoolProto dropIndex(RpcController controller, IndexNameProto request)
throws ServiceException {
- String databaseName = CatalogUtil.normalizeIdentifier(request.getDatabaseName());
- String indexName = CatalogUtil.normalizeIdentifier(request.getIndexName());
+ String databaseName = request.getDatabaseName();
+ String indexName = request.getIndexName();
wlock.lock();
try {
http://git-wip-us.apache.org/repos/asf/tajo/blob/37fef799/tajo-catalog/tajo-catalog-server/src/main/java/org/apache/tajo/catalog/store/AbstractDBStore.java
----------------------------------------------------------------------
diff --git a/tajo-catalog/tajo-catalog-server/src/main/java/org/apache/tajo/catalog/store/AbstractDBStore.java b/tajo-catalog/tajo-catalog-server/src/main/java/org/apache/tajo/catalog/store/AbstractDBStore.java
index 98c289e..d10f545 100644
--- a/tajo-catalog/tajo-catalog-server/src/main/java/org/apache/tajo/catalog/store/AbstractDBStore.java
+++ b/tajo-catalog/tajo-catalog-server/src/main/java/org/apache/tajo/catalog/store/AbstractDBStore.java
@@ -572,7 +572,7 @@ public abstract class AbstractDBStore extends CatalogConstants implements Catalo
conn = getConnection();
conn.setAutoCommit(false);
- String [] splitted = CatalogUtil.splitTableName(CatalogUtil.normalizeIdentifier(table.getTableName()));
+ String [] splitted = CatalogUtil.splitTableName(table.getTableName());
if (splitted.length == 1) {
throw new IllegalArgumentException("createTable() requires a qualified table name, but it is \""
+ table.getTableName() + "\".");
@@ -1106,8 +1106,8 @@ public abstract class AbstractDBStore extends CatalogConstants implements Catalo
LOG.debug(ADD_PARTITION_SQL);
}
- String databaseName = CatalogUtil.normalizeIdentifier(partitionsProto.getTableIdentifier().getDatabaseName());
- String tableName = CatalogUtil.normalizeIdentifier(partitionsProto.getTableIdentifier().getTableName());
+ String databaseName = partitionsProto.getTableIdentifier().getDatabaseName();
+ String tableName = partitionsProto.getTableIdentifier().getTableName();
int databaseId = getDatabaseId(databaseName);
int tableId = getTableId(databaseId, databaseName, tableName);
@@ -1157,8 +1157,8 @@ public abstract class AbstractDBStore extends CatalogConstants implements Catalo
LOG.debug(sql);
}
- String databaseName = CatalogUtil.normalizeIdentifier(proto.getTableIdentifier().getDatabaseName());
- String tableName = CatalogUtil.normalizeIdentifier(proto.getTableIdentifier().getTableName());
+ String databaseName = proto.getTableIdentifier().getDatabaseName();
+ String tableName = proto.getTableIdentifier().getTableName();
int databaseId = getDatabaseId(databaseName);
int tableId = getTableId(databaseId, databaseName, tableName);
@@ -1353,9 +1353,9 @@ public abstract class AbstractDBStore extends CatalogConstants implements Catalo
Connection conn = null;
PreparedStatement pstmt = null;
- String databaseName = CatalogUtil.normalizeIdentifier(proto.getTableIdentifier().getDatabaseName());
- String tableName = CatalogUtil.normalizeIdentifier(proto.getTableIdentifier().getTableName());
- String columnName = CatalogUtil.extractSimpleName(CatalogUtil.normalizeIdentifier(proto.getColumn().getName()));
+ String databaseName = proto.getTableIdentifier().getDatabaseName();
+ String tableName = proto.getTableIdentifier().getTableName();
+ String columnName = CatalogUtil.extractSimpleName(proto.getColumn().getName());
try {
int databaseId = getDatabaseId(databaseName);
http://git-wip-us.apache.org/repos/asf/tajo/blob/37fef799/tajo-catalog/tajo-catalog-server/src/main/java/org/apache/tajo/catalog/store/MemStore.java
----------------------------------------------------------------------
diff --git a/tajo-catalog/tajo-catalog-server/src/main/java/org/apache/tajo/catalog/store/MemStore.java b/tajo-catalog/tajo-catalog-server/src/main/java/org/apache/tajo/catalog/store/MemStore.java
index 9fc9d2a..ef98ee2 100644
--- a/tajo-catalog/tajo-catalog-server/src/main/java/org/apache/tajo/catalog/store/MemStore.java
+++ b/tajo-catalog/tajo-catalog-server/src/main/java/org/apache/tajo/catalog/store/MemStore.java
@@ -121,7 +121,7 @@ public class MemStore implements CatalogStore {
@Override
public void createTable(CatalogProtos.TableDescProto request) throws CatalogException {
- String [] splitted = CatalogUtil.splitTableName(CatalogUtil.normalizeIdentifier(request.getTableName()));
+ String [] splitted = CatalogUtil.splitTableName(request.getTableName());
if (splitted.length == 1) {
throw new IllegalArgumentException("createTable() requires a qualified table name, but it is \""
+ request.getTableName() + "\".");
@@ -131,7 +131,7 @@ public class MemStore implements CatalogStore {
Map<String, CatalogProtos.TableDescProto> database = checkAndGetDatabaseNS(databases, databaseName);
- String tbName = CatalogUtil.normalizeIdentifier(tableName);
+ String tbName = tableName;
if (database.containsKey(tbName)) {
throw new AlreadyExistsTableException(tbName);
}
http://git-wip-us.apache.org/repos/asf/tajo/blob/37fef799/tajo-client/src/main/java/org/apache/tajo/client/TajoClient.java
----------------------------------------------------------------------
diff --git a/tajo-client/src/main/java/org/apache/tajo/client/TajoClient.java b/tajo-client/src/main/java/org/apache/tajo/client/TajoClient.java
index bf77f03..9d7c4ee 100644
--- a/tajo-client/src/main/java/org/apache/tajo/client/TajoClient.java
+++ b/tajo-client/src/main/java/org/apache/tajo/client/TajoClient.java
@@ -77,7 +77,7 @@ public class TajoClient implements Closeable {
this(conf, NetUtils.createSocketAddr(conf.getVar(ConfVars.TAJO_MASTER_CLIENT_RPC_ADDRESS)), null);
}
- public TajoClient(TajoConf conf, String baseDatabase) throws IOException {
+ public TajoClient(TajoConf conf, @Nullable String baseDatabase) throws IOException {
this(conf, NetUtils.createSocketAddr(conf.getVar(ConfVars.TAJO_MASTER_CLIENT_RPC_ADDRESS)), baseDatabase);
}
@@ -89,7 +89,7 @@ public class TajoClient implements Closeable {
//Don't share connection pool per client
connPool = RpcConnectionPool.newPool(conf, getClass().getSimpleName(), workerNum);
userInfo = UserGroupInformation.getCurrentUser();
- this.baseDatabase = baseDatabase;
+ this.baseDatabase = baseDatabase != null ? CatalogUtil.normalizeIdentifier(baseDatabase) : null;
}
public boolean isConnected() {
@@ -197,7 +197,8 @@ public class TajoClient implements Closeable {
checkSessionAndGet(client);
TajoMasterClientProtocolService.BlockingInterface tajoMasterService = client.getStub();
- return tajoMasterService.selectDatabase(null, convertSessionedString(databaseName)).getValue();
+ return tajoMasterService.selectDatabase(null,
+ convertSessionedString(CatalogUtil.normalizeIdentifier(databaseName))).getValue();
}
}.withRetries();
}
@@ -501,7 +502,8 @@ public class TajoClient implements Closeable {
public Boolean call(NettyClientBase client) throws ServiceException {
checkSessionAndGet(client);
TajoMasterClientProtocolService.BlockingInterface tajoMasterService = client.getStub();
- return tajoMasterService.createDatabase(null, convertSessionedString(databaseName)).getValue();
+ return tajoMasterService.createDatabase(null,
+ convertSessionedString(CatalogUtil.normalizeIdentifier(databaseName))).getValue();
}
}.withRetries();
}
@@ -511,7 +513,8 @@ public class TajoClient implements Closeable {
public Boolean call(NettyClientBase client) throws ServiceException {
checkSessionAndGet(client);
TajoMasterClientProtocolService.BlockingInterface tajoMasterService = client.getStub();
- return tajoMasterService.existDatabase(null, convertSessionedString(databaseName)).getValue();
+ return tajoMasterService.existDatabase(null,
+ convertSessionedString(CatalogUtil.normalizeIdentifier(databaseName))).getValue();
}
}.withRetries();
}
@@ -521,7 +524,8 @@ public class TajoClient implements Closeable {
public Boolean call(NettyClientBase client) throws ServiceException {
checkSessionAndGet(client);
TajoMasterClientProtocolService.BlockingInterface tajoMasterService = client.getStub();
- return tajoMasterService.dropDatabase(null, convertSessionedString(databaseName)).getValue();
+ return tajoMasterService.dropDatabase(null,
+ convertSessionedString(CatalogUtil.normalizeIdentifier(databaseName))).getValue();
}
}.withRetries();
}
@@ -550,7 +554,8 @@ public class TajoClient implements Closeable {
public Boolean call(NettyClientBase client) throws ServiceException {
checkSessionAndGet(client);
TajoMasterClientProtocolService.BlockingInterface tajoMasterService = client.getStub();
- return tajoMasterService.existTable(null, convertSessionedString(name)).getValue();
+ return tajoMasterService.existTable(null,
+ convertSessionedString(CatalogUtil.normalizeIdentifier(name))).getValue();
}
}.withRetries();
}
@@ -566,7 +571,7 @@ public class TajoClient implements Closeable {
CreateTableRequest.Builder builder = CreateTableRequest.newBuilder();
builder.setSessionId(sessionId);
- builder.setName(name);
+ builder.setName(CatalogUtil.normalizeIdentifier(name));
builder.setSchema(schema.getProto());
builder.setMeta(meta.getProto());
builder.setPath(path.toUri().toString());
@@ -600,7 +605,7 @@ public class TajoClient implements Closeable {
DropTableRequest.Builder builder = DropTableRequest.newBuilder();
builder.setSessionId(sessionId);
- builder.setName(tableName);
+ builder.setName(CatalogUtil.normalizeIdentifier(tableName));
builder.setPurge(purge);
return tajoMasterService.dropTable(null, builder.build()).getValue();
}
@@ -666,12 +671,14 @@ public class TajoClient implements Closeable {
public List<String> call(NettyClientBase client) throws ServiceException {
checkSessionAndGet(client);
+ final String normalizedDBName = databaseName == null ? null : CatalogUtil.normalizeIdentifier(databaseName);
+
TajoMasterClientProtocolService.BlockingInterface tajoMasterService = client.getStub();
GetTableListRequest.Builder builder = GetTableListRequest.newBuilder();
builder.setSessionId(sessionId);
- if (databaseName != null) {
- builder.setDatabaseName(databaseName);
+ if (normalizedDBName != null) {
+ builder.setDatabaseName(normalizedDBName);
}
GetTableListResponse res = tajoMasterService.getTableList(null, builder.build());
return res.getTablesList();
@@ -689,7 +696,7 @@ public class TajoClient implements Closeable {
GetTableDescRequest.Builder builder = GetTableDescRequest.newBuilder();
builder.setSessionId(sessionId);
- builder.setTableName(tableName);
+ builder.setTableName(CatalogUtil.normalizeIdentifier(tableName));
TableResponse res = tajoMasterService.getTableDesc(null, builder.build());
if (res.getResultCode() == ResultCode.OK) {
return CatalogUtil.newTableDesc(res.getTableDesc());
http://git-wip-us.apache.org/repos/asf/tajo/blob/37fef799/tajo-core/tajo-core-backend/src/main/antlr4/org/apache/tajo/engine/parser/HiveQLLexer.g4
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/main/antlr4/org/apache/tajo/engine/parser/HiveQLLexer.g4 b/tajo-core/tajo-core-backend/src/main/antlr4/org/apache/tajo/engine/parser/HiveQLLexer.g4
index 8eba9a4..f7b76ef 100644
--- a/tajo-core/tajo-core-backend/src/main/antlr4/org/apache/tajo/engine/parser/HiveQLLexer.g4
+++ b/tajo-core/tajo-core-backend/src/main/antlr4/org/apache/tajo/engine/parser/HiveQLLexer.g4
@@ -370,9 +370,7 @@ Number
;
Identifier
- :
- (Letter | Digit) (Letter | Digit | '_')*
- | '`' RegexComponent+ '`'
+ : (Letter | Digit) (Letter | Digit | '_')* { setText(getText().toLowerCase()); }
;
CharSetName
http://git-wip-us.apache.org/repos/asf/tajo/blob/37fef799/tajo-core/tajo-core-backend/src/main/antlr4/org/apache/tajo/engine/parser/SQLLexer.g4
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/main/antlr4/org/apache/tajo/engine/parser/SQLLexer.g4 b/tajo-core/tajo-core-backend/src/main/antlr4/org/apache/tajo/engine/parser/SQLLexer.g4
index 8966fd3..6eccd12 100644
--- a/tajo-core/tajo-core-backend/src/main/antlr4/org/apache/tajo/engine/parser/SQLLexer.g4
+++ b/tajo-core/tajo-core-backend/src/main/antlr4/org/apache/tajo/engine/parser/SQLLexer.g4
@@ -405,13 +405,12 @@ LineComment
===============================================================================
*/
-Identifier
- : Regular_Identifier
+Regular_Identifier
+ : ('a'..'z'|'A'..'Z'|'_') ('a'..'z'|'A'..'Z'|Digit|'_')* { setText(getText().toLowerCase()); }
;
-fragment
-Regular_Identifier
- : ('a'..'z'|'A'..'Z'|'_') ('a'..'z'|'A'..'Z'|Digit|'_')*
+Quoted_Identifier
+ : DOUBLE_QUOTE ( ESC_SEQ | ~('\\'|'"') )* DOUBLE_QUOTE { setText(getText().substring(1, getText().length()-1)); }
;
/*
http://git-wip-us.apache.org/repos/asf/tajo/blob/37fef799/tajo-core/tajo-core-backend/src/main/antlr4/org/apache/tajo/engine/parser/SQLParser.g4
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/main/antlr4/org/apache/tajo/engine/parser/SQLParser.g4 b/tajo-core/tajo-core-backend/src/main/antlr4/org/apache/tajo/engine/parser/SQLParser.g4
index 4dada45..ce78c98 100644
--- a/tajo-core/tajo-core-backend/src/main/antlr4/org/apache/tajo/engine/parser/SQLParser.g4
+++ b/tajo-core/tajo-core-backend/src/main/antlr4/org/apache/tajo/engine/parser/SQLParser.g4
@@ -198,8 +198,9 @@ drop_table_statement
*/
identifier
- : Identifier
+ : Regular_Identifier
| nonreserved_keywords
+ | Quoted_Identifier
;
nonreserved_keywords
@@ -1055,7 +1056,7 @@ table_or_query_name
;
table_name
- : identifier ( DOT identifier ( DOT identifier )? )?
+ : identifier (DOT identifier ( DOT identifier)? )?
;
query_specification
@@ -1076,7 +1077,7 @@ derived_column
;
qualified_asterisk
- : (tb_name=Identifier DOT)? MULTIPLY
+ : (tb_name=identifier DOT)? MULTIPLY
;
set_qualifier
http://git-wip-us.apache.org/repos/asf/tajo/blob/37fef799/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/planner/LogicalPlan.java
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/planner/LogicalPlan.java b/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/planner/LogicalPlan.java
index c3bca66..63dd428 100644
--- a/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/planner/LogicalPlan.java
+++ b/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/planner/LogicalPlan.java
@@ -144,7 +144,7 @@ public class LogicalPlan {
} else { // if a generated column name
generatedName = attachSeqIdToGeneratedColumnName(getGeneratedPrefixFromExpr(expr));
}
- return generatedName.toLowerCase();
+ return generatedName;
}
/**
@@ -578,15 +578,15 @@ public class LogicalPlan {
}
public boolean existsRelation(String name) {
- return nameToRelationMap.containsKey(CatalogUtil.normalizeIdentifier(name));
+ return nameToRelationMap.containsKey(name);
}
public RelationNode getRelation(String name) {
- return nameToRelationMap.get(CatalogUtil.normalizeIdentifier(name));
+ return nameToRelationMap.get(name);
}
public void addRelation(RelationNode relation) {
- nameToRelationMap.put(CatalogUtil.normalizeIdentifier(relation.getCanonicalName()), relation);
+ nameToRelationMap.put(relation.getCanonicalName(), relation);
}
public Collection<RelationNode> getRelations() {
http://git-wip-us.apache.org/repos/asf/tajo/blob/37fef799/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/planner/NamedExprsManager.java
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/planner/NamedExprsManager.java b/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/planner/NamedExprsManager.java
index 33f6fc6..90d829f 100644
--- a/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/planner/NamedExprsManager.java
+++ b/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/planner/NamedExprsManager.java
@@ -89,7 +89,7 @@ public class NamedExprsManager {
}
private static String normalizeName(String name) {
- return name.toLowerCase();
+ return name;
}
/**
@@ -121,7 +121,7 @@ public class NamedExprsManager {
}
public NamedExpr getNamedExpr(String name) {
- String normalized = name.toLowerCase();
+ String normalized = name;
return new NamedExpr(getExpr(name), normalized);
}
@@ -227,7 +227,7 @@ public class NamedExprsManager {
* @param evalNode EvalNode to be added.
*/
public void markAsEvaluated(String referenceName, EvalNode evalNode) throws PlanningException {
- String normalized = referenceName.toLowerCase();
+ String normalized = referenceName;
int refId = nameToIdMap.get(normalized);
evaluationStateMap.put(refId, true);
http://git-wip-us.apache.org/repos/asf/tajo/blob/37fef799/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/planner/Target.java
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/planner/Target.java b/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/planner/Target.java
index d83a394..6e4580d 100644
--- a/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/planner/Target.java
+++ b/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/planner/Target.java
@@ -43,7 +43,7 @@ public class Target implements Cloneable, GsonObject {
public Target(final EvalNode eval, final String alias) {
this.expr = eval;
// force lower case
- String normalized = alias.toLowerCase();
+ String normalized = alias;
// If an expr is a column reference and its alias is equivalent to column name, ignore a given alias.
if (eval instanceof FieldEval && eval.getName().equals(normalized)) {
http://git-wip-us.apache.org/repos/asf/tajo/blob/37fef799/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/planner/logical/ScanNode.java
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/planner/logical/ScanNode.java b/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/planner/logical/ScanNode.java
index 8e4911f..0f346b5 100644
--- a/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/planner/logical/ScanNode.java
+++ b/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/planner/logical/ScanNode.java
@@ -54,7 +54,7 @@ public class ScanNode extends RelationNode implements Projectable, Cloneable {
public void init(TableDesc desc, String alias) {
this.tableDesc = desc;
- this.alias = CatalogUtil.normalizeIdentifier(alias);
+ this.alias = alias;
if (!CatalogUtil.isFQTableName(this.tableDesc.getName())) {
throw new IllegalArgumentException("the name in TableDesc must be qualified, but it is \"" +
http://git-wip-us.apache.org/repos/asf/tajo/blob/37fef799/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/planner/logical/TableSubQueryNode.java
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/planner/logical/TableSubQueryNode.java b/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/planner/logical/TableSubQueryNode.java
index 2652030..b37a229 100644
--- a/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/planner/logical/TableSubQueryNode.java
+++ b/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/planner/logical/TableSubQueryNode.java
@@ -20,7 +20,6 @@ package org.apache.tajo.engine.planner.logical;
import com.google.common.base.Objects;
import com.google.gson.annotations.Expose;
-import org.apache.tajo.catalog.CatalogUtil;
import org.apache.tajo.catalog.Schema;
import org.apache.tajo.engine.planner.PlanString;
import org.apache.tajo.engine.planner.PlannerUtil;
@@ -37,7 +36,7 @@ public class TableSubQueryNode extends RelationNode implements Projectable {
}
public void init(String tableName, LogicalNode subQuery) {
- this.tableName = CatalogUtil.normalizeIdentifier(tableName);
+ this.tableName = tableName;
if (subQuery != null) {
this.subQuery = subQuery;
setOutSchema(SchemaUtil.clone(this.subQuery.getOutSchema()));
http://git-wip-us.apache.org/repos/asf/tajo/blob/37fef799/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/query/QueryContext.java
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/query/QueryContext.java b/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/query/QueryContext.java
index 5076b87..44c4ddc 100644
--- a/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/query/QueryContext.java
+++ b/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/query/QueryContext.java
@@ -19,7 +19,6 @@
package org.apache.tajo.engine.query;
import org.apache.hadoop.fs.Path;
-import org.apache.tajo.catalog.CatalogUtil;
import org.apache.tajo.catalog.Options;
import org.apache.tajo.catalog.partition.PartitionMethodDesc;
import org.apache.tajo.conf.TajoConf;
@@ -102,7 +101,7 @@ public class QueryContext extends Options {
* @param tableName The target table name
*/
public void setOutputTable(String tableName) {
- put(OUTPUT_TABLE_NAME, CatalogUtil.normalizeIdentifier(tableName));
+ put(OUTPUT_TABLE_NAME, tableName);
}
public String getOutputTable() {
http://git-wip-us.apache.org/repos/asf/tajo/blob/37fef799/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/master/GlobalEngine.java
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/master/GlobalEngine.java b/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/master/GlobalEngine.java
index d0e8dc4..fe3caeb 100644
--- a/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/master/GlobalEngine.java
+++ b/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/master/GlobalEngine.java
@@ -287,7 +287,7 @@ public class GlobalEngine extends AbstractService {
if(createTable.isExternal()){
Preconditions.checkState(createTable.hasPath(), "ERROR: LOCATION must be given.");
} else {
- Path tablePath = new Path(sm.getWarehouseDir(), createTable.getTableName().toLowerCase());
+ Path tablePath = new Path(sm.getWarehouseDir(), createTable.getTableName());
createTable.setPath(tablePath);
}
@@ -382,7 +382,7 @@ public class GlobalEngine extends AbstractService {
}
if (catalog.createDatabase(databaseName, tablespaceName)) {
- String normalized = CatalogUtil.normalizeIdentifier(databaseName);
+ String normalized = databaseName;
Path databaseDir = StorageUtil.concatPath(context.getConf().getVar(TajoConf.ConfVars.WAREHOUSE_DIR), normalized);
FileSystem fs = databaseDir.getFileSystem(context.getConf());
fs.mkdirs(databaseDir);
http://git-wip-us.apache.org/repos/asf/tajo/blob/37fef799/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/master/TajoMasterClientService.java
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/master/TajoMasterClientService.java b/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/master/TajoMasterClientService.java
index a504e7b..acbf839 100644
--- a/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/master/TajoMasterClientService.java
+++ b/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/master/TajoMasterClientService.java
@@ -234,7 +234,7 @@ public class TajoMasterClientService extends AbstractService {
public BoolProto selectDatabase(RpcController controller, SessionedStringProto request) throws ServiceException {
try {
String sessionId = request.getSessionId().getId();
- String databaseName = CatalogUtil.normalizeIdentifier(request.getValue());
+ String databaseName = request.getValue();
if (context.getCatalog().existDatabase(databaseName)) {
context.getSessionManager().getSession(sessionId).selectDatabase(databaseName);
http://git-wip-us.apache.org/repos/asf/tajo/blob/37fef799/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/QueryTestCaseBase.java
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/QueryTestCaseBase.java b/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/QueryTestCaseBase.java
index a5c5d78..e8c70ac 100644
--- a/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/QueryTestCaseBase.java
+++ b/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/QueryTestCaseBase.java
@@ -175,7 +175,7 @@ public class QueryTestCaseBase {
// if the current database is "default", shouldn't drop it.
if (!currentDatabase.equals(TajoConstants.DEFAULT_DATABASE_NAME)) {
for (String tableName : catalog.getAllTableNames(currentDatabase)) {
- client.updateQuery("DROP TABLE IF EXISTS " +tableName + " PURGE");
+ client.updateQuery("DROP TABLE IF EXISTS " + tableName + " PURGE");
}
client.selectDatabase(TajoConstants.DEFAULT_DATABASE_NAME);
@@ -185,7 +185,7 @@ public class QueryTestCaseBase {
}
public QueryTestCaseBase() {
- this.currentDatabase = getClass().getSimpleName();
+ this.currentDatabase = CatalogUtil.normalizeIdentifier(getClass().getSimpleName());
init();
}
http://git-wip-us.apache.org/repos/asf/tajo/blob/37fef799/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/client/TestTajoClient.java
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/client/TestTajoClient.java b/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/client/TestTajoClient.java
index 5949d1b..c8b11a8 100644
--- a/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/client/TestTajoClient.java
+++ b/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/client/TestTajoClient.java
@@ -110,13 +110,14 @@ public class TestTajoClient {
int currentNum = client.getAllDatabaseNames().size();
assertEquals(TajoConstants.DEFAULT_DATABASE_NAME, client.getCurrentDatabase());
- assertTrue(client.createDatabase("testcurrentdatabase"));
+ String databaseName = CatalogUtil.normalizeIdentifier("testcurrentdatabase");
+ assertTrue(client.createDatabase(databaseName));
assertEquals(currentNum + 1, client.getAllDatabaseNames().size());
assertEquals(TajoConstants.DEFAULT_DATABASE_NAME, client.getCurrentDatabase());
- assertTrue(client.selectDatabase("testcurrentdatabase"));
- assertEquals("testcurrentdatabase", client.getCurrentDatabase());
- assertTrue(client.selectDatabase("default"));
- assertTrue(client.dropDatabase("testcurrentdatabase"));
+ assertTrue(client.selectDatabase(databaseName));
+ assertEquals(databaseName, client.getCurrentDatabase());
+ assertTrue(client.selectDatabase(TajoConstants.DEFAULT_DATABASE_NAME));
+ assertTrue(client.dropDatabase(databaseName));
assertEquals(currentNum, client.getAllDatabaseNames().size());
}
@@ -139,19 +140,20 @@ public class TestTajoClient {
@Test
public final void testDropCurrentDatabase() throws IOException, ServiceException, InterruptedException {
int currentNum = client.getAllDatabaseNames().size();
- assertTrue(client.createDatabase("testdropcurrentdatabase"));
- assertTrue(client.selectDatabase("testdropcurrentdatabase"));
- assertEquals("testdropcurrentdatabase", client.getCurrentDatabase());
+ String databaseName = CatalogUtil.normalizeIdentifier("testdropcurrentdatabase");
+ assertTrue(client.createDatabase(databaseName));
+ assertTrue(client.selectDatabase(databaseName));
+ assertEquals(databaseName, client.getCurrentDatabase());
try {
- client.dropDatabase("testdropcurrentdatabase");
+ client.dropDatabase(databaseName);
assertFalse(true);
} catch (Throwable t) {
assertFalse(false);
}
- assertTrue(client.selectDatabase("default"));
- assertTrue(client.dropDatabase("testdropcurrentdatabase"));
+ assertTrue(client.selectDatabase(TajoConstants.DEFAULT_DATABASE_NAME));
+ assertTrue(client.dropDatabase(databaseName));
assertEquals(currentNum, client.getAllDatabaseNames().size());
}
@@ -204,7 +206,7 @@ public class TestTajoClient {
@Test
public final void testUpdateQuery() throws IOException, ServiceException {
- final String tableName = "testUpdateQuery";
+ final String tableName = CatalogUtil.normalizeIdentifier("testUpdateQuery");
Path tablePath = writeTmpTable(tableName);
assertFalse(client.existTable(tableName));
@@ -257,7 +259,7 @@ public class TestTajoClient {
@Test
public final void testCreateAndDropExternalTableByExecuteQuery() throws IOException, ServiceException {
TajoConf conf = cluster.getConfiguration();
- final String tableName = "testCreateAndDropExternalTableByExecuteQuery";
+ final String tableName = CatalogUtil.normalizeIdentifier("testCreateAndDropExternalTableByExecuteQuery");
Path tablePath = writeTmpTable(tableName);
assertFalse(client.existTable(tableName));
@@ -277,7 +279,7 @@ public class TestTajoClient {
@Test
public final void testCreateAndPurgeExternalTableByExecuteQuery() throws IOException, ServiceException {
TajoConf conf = cluster.getConfiguration();
- final String tableName = "testCreateAndPurgeExternalTableByExecuteQuery";
+ final String tableName = CatalogUtil.normalizeIdentifier("testCreateAndPurgeExternalTableByExecuteQuery");
Path tablePath = writeTmpTable(tableName);
assertFalse(client.existTable(tableName));
@@ -297,7 +299,7 @@ public class TestTajoClient {
@Test
public final void testCreateAndDropTableByExecuteQuery() throws IOException, ServiceException, SQLException {
TajoConf conf = cluster.getConfiguration();
- final String tableName = "testCreateAndDropTableByExecuteQuery";
+ final String tableName = CatalogUtil.normalizeIdentifier("testCreateAndDropTableByExecuteQuery");
assertFalse(client.existTable(tableName));
@@ -318,7 +320,7 @@ public class TestTajoClient {
@Test
public final void testCreateAndPurgeTableByExecuteQuery() throws IOException, ServiceException, SQLException {
TajoConf conf = cluster.getConfiguration();
- final String tableName = "testCreateAndPurgeTableByExecuteQuery";
+ final String tableName = CatalogUtil.normalizeIdentifier("testCreateAndPurgeTableByExecuteQuery");
assertFalse(client.existTable(tableName));
@@ -338,7 +340,7 @@ public class TestTajoClient {
@Test
public final void testDDLByExecuteQuery() throws IOException, ServiceException {
- final String tableName = "testDDLByExecuteQuery";
+ final String tableName = CatalogUtil.normalizeIdentifier("testDDLByExecuteQuery");
Path tablePath = writeTmpTable(tableName);
assertFalse(client.existTable(tableName));
@@ -371,7 +373,7 @@ public class TestTajoClient {
@Test
public final void testGetTableDesc() throws IOException, ServiceException, SQLException {
- final String tableName1 = "table3";
+ final String tableName1 = CatalogUtil.normalizeIdentifier("table3");
Path tablePath = writeTmpTable(tableName1);
LOG.error("Full path:" + tablePath.toUri().getRawPath());
FileSystem fs = tablePath.getFileSystem(conf);
@@ -546,7 +548,7 @@ public class TestTajoClient {
public final void testCreateAndDropTablePartitionedColumnByExecuteQuery() throws IOException,
ServiceException, SQLException {
TajoConf conf = cluster.getConfiguration();
- final String tableName = "testCreateAndDropTablePartitionedColumnByExecuteQuery";
+ final String tableName = CatalogUtil.normalizeIdentifier("testCreateAndDropTablePartitionedColumnByExecuteQuery");
assertFalse(client.existTable(tableName));
@@ -590,7 +592,7 @@ public class TestTajoClient {
@Test
public final void testGetFinishedQueryList() throws IOException,
ServiceException, SQLException {
- final String tableName = "testGetFinishedQueryList";
+ final String tableName = CatalogUtil.normalizeIdentifier("testGetFinishedQueryList");
String sql = "create table " + tableName + " (deptname text, score int4)";
client.updateQuery(sql);
http://git-wip-us.apache.org/repos/asf/tajo/blob/37fef799/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/eval/ExprTestBase.java
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/eval/ExprTestBase.java b/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/eval/ExprTestBase.java
index a89f2bb..d19b4d6 100644
--- a/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/eval/ExprTestBase.java
+++ b/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/eval/ExprTestBase.java
@@ -141,14 +141,17 @@ public class ExprTestBase {
public void testEval(Schema schema, String tableName, String csvTuple, String query, String [] expected)
throws IOException {
- testEval(schema, tableName, csvTuple, query, expected, ',', true);
+ testEval(schema, tableName != null ? CatalogUtil.normalizeIdentifier(tableName) : null, csvTuple, query,
+ expected, ',', true);
}
public void testEval(Schema schema, String tableName, String csvTuple, String query, String [] expected,
char delimiter, boolean condition) throws IOException {
LazyTuple lazyTuple;
VTuple vtuple = null;
- String qualifiedTableName = CatalogUtil.buildFQName(DEFAULT_DATABASE_NAME, tableName);
+ String qualifiedTableName =
+ CatalogUtil.buildFQName(DEFAULT_DATABASE_NAME,
+ tableName != null ? CatalogUtil.normalizeIdentifier(tableName) : null);
Schema inputSchema = null;
if (schema != null) {
inputSchema = SchemaUtil.clone(schema);
http://git-wip-us.apache.org/repos/asf/tajo/blob/37fef799/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/eval/TestPredicates.java
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/eval/TestPredicates.java b/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/eval/TestPredicates.java
index 39c7492..b10f2df 100644
--- a/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/eval/TestPredicates.java
+++ b/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/eval/TestPredicates.java
@@ -356,7 +356,8 @@ public class TestPredicates extends ExprTestBase {
@Test
public void testCreateTableWithUnsupportedStoreType() throws IOException {
- testSimpleEval("create table table1 (name text, age int) using RAW;", new String[] {"Unsupported store type :RAW"}, false);
+ testSimpleEval("create table table1 (name text, age int) using RAW;",
+ new String[] {"Wrong query statement or query plan: create table table1 (name text, age int) using RAW"},
+ false);
}
-
}
http://git-wip-us.apache.org/repos/asf/tajo/blob/37fef799/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/eval/TestSQLExpression.java
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/eval/TestSQLExpression.java b/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/eval/TestSQLExpression.java
index a7b0a9e..22a178f 100644
--- a/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/eval/TestSQLExpression.java
+++ b/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/eval/TestSQLExpression.java
@@ -29,6 +29,18 @@ import static org.apache.tajo.common.TajoDataTypes.Type.TEXT;
public class TestSQLExpression extends ExprTestBase {
+ @Test
+ public void testQuotedIdentifiers() throws IOException {
+ Schema schema = new Schema();
+ schema.addColumn("컬럼1", TEXT);
+ schema.addColumn("컬럼2", TEXT);
+ testEval(schema, "테이블1", "123,234", "select \"컬럼1\"::float, cast (\"컬럼2\" as float4) as a from \"테이블1\"",
+ new String[]{"123.0", "234.0"});
+ testEval(schema,
+ "테이블1", "123,234", "select char_length(\"컬럼1\"), \"컬럼2\"::float4 as \"별명1\" from \"테이블1\"",
+ new String[]{"3", "234.0"});
+ }
+
@Test(expected = NoSuchFunctionException.class)
public void testNoSuchFunction() throws IOException {
testSimpleEval("select test123('abc') col1 ", new String[]{"abc"});
http://git-wip-us.apache.org/repos/asf/tajo/blob/37fef799/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/function/TestDateTimeFunctions.java
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/function/TestDateTimeFunctions.java b/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/function/TestDateTimeFunctions.java
index b882e84..3f1decb 100644
--- a/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/function/TestDateTimeFunctions.java
+++ b/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/function/TestDateTimeFunctions.java
@@ -57,15 +57,24 @@ public class TestDateTimeFunctions extends ExprTestBase {
public void testExtract() throws IOException {
Schema schema2 = new Schema();
schema2.addColumn("col1", TIMESTAMP);
- testEval(schema2, "table1", "1970-01-17 10:09:37", "select extract(year from col1), extract(month from col1), extract(day from col1) from table1;", new String[]{"1970.0", "1.0", "17.0"});
+ testEval(schema2, "table1",
+ "1970-01-17 10:09:37",
+ "select extract(year from col1), extract(month from col1), extract(day from col1) from table1;",
+ new String[]{"1970.0", "1.0", "17.0"});
Schema schema3 = new Schema();
schema3.addColumn("col1", TIME);
- testEval(schema3, "table1", "10:09:37.5", "select extract(hour from col1), extract(minute from col1), extract(second from col1) from table1;", new String[]{"10.0", "9.0", "37.5"});
+ testEval(schema3, "table1",
+ "10:09:37.5",
+ "select extract(hour from col1), extract(minute from col1), extract(second from col1) from table1;",
+ new String[]{"10.0", "9.0", "37.5"});
Schema schema4 = new Schema();
schema4.addColumn("col1", DATE);
- testEval(schema4, "table1", "1970-01-17", "select extract(year from col1), extract(month from col1), extract(day from col1) from table1;", new String[]{"1970.0", "1.0", "17.0"});
+ testEval(schema4, "table1",
+ "1970-01-17",
+ "select extract(year from col1), extract(month from col1), extract(day from col1) from table1;",
+ new String[]{"1970.0", "1.0", "17.0"});
testSimpleEval("select extract(century from TIMESTAMP '1970-01-17 10:09:37');", new String[]{"19.0"});
@@ -144,15 +153,23 @@ public class TestDateTimeFunctions extends ExprTestBase {
public void testDatePart() throws IOException {
Schema schema2 = new Schema();
schema2.addColumn("col1", TIMESTAMP);
- testEval(schema2, "table1", "1970-01-17 10:09:37", "select date_part('year', col1), date_part('month', col1), date_part('day', col1) from table1;", new String[]{"1970.0", "1.0", "17.0"});
+ testEval(schema2, "table1",
+ "1970-01-17 10:09:37",
+ "select date_part('year', col1), date_part('month', col1), date_part('day', col1) from table1;",
+ new String[]{"1970.0", "1.0", "17.0"});
Schema schema3 = new Schema();
schema3.addColumn("col1", TIME);
- testEval(schema3, "table1", "10:09:37.5", "select date_part('hour', col1), date_part('minute', col1), date_part('second', col1) from table1;", new String[]{"10.0", "9.0", "37.5"});
+ testEval(schema3, "table1", "10:09:37.5",
+ "select date_part('hour', col1), date_part('minute', col1), date_part('second', col1) from table1;",
+ new String[]{"10.0", "9.0", "37.5"});
Schema schema4 = new Schema();
schema4.addColumn("col1", DATE);
- testEval(schema4, "table1", "1970-01-17", "select date_part('year', col1), date_part('month', col1), date_part('day', col1) from table1;", new String[]{"1970.0", "1.0", "17.0"});
+ testEval(schema4, "table1",
+ "1970-01-17",
+ "select date_part('year', col1), date_part('month', col1), date_part('day', col1) from table1;",
+ new String[]{"1970.0", "1.0", "17.0"});
testSimpleEval("select date_part('century', TIMESTAMP '1970-01-17 10:09:37');", new String[]{"19.0"});
http://git-wip-us.apache.org/repos/asf/tajo/blob/37fef799/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/planner/TestLogicalOptimizer.java
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/planner/TestLogicalOptimizer.java b/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/planner/TestLogicalOptimizer.java
index c4ef32b..5acd512 100644
--- a/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/planner/TestLogicalOptimizer.java
+++ b/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/planner/TestLogicalOptimizer.java
@@ -62,15 +62,15 @@ public class TestLogicalOptimizer {
Schema schema = new Schema();
schema.addColumn("name", Type.TEXT);
- schema.addColumn("empId", Type.INT4);
- schema.addColumn("deptName", Type.TEXT);
+ schema.addColumn("empid", Type.INT4);
+ schema.addColumn("deptname", Type.TEXT);
Schema schema2 = new Schema();
- schema2.addColumn("deptName", Type.TEXT);
+ schema2.addColumn("deptname", Type.TEXT);
schema2.addColumn("manager", Type.TEXT);
Schema schema3 = new Schema();
- schema3.addColumn("deptName", Type.TEXT);
+ schema3.addColumn("deptname", Type.TEXT);
schema3.addColumn("score", Type.INT4);
schema3.addColumn("phone", Type.INT4);
http://git-wip-us.apache.org/repos/asf/tajo/blob/37fef799/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/planner/TestLogicalPlanner.java
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/planner/TestLogicalPlanner.java b/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/planner/TestLogicalPlanner.java
index 65ade68..6dda611 100644
--- a/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/planner/TestLogicalPlanner.java
+++ b/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/planner/TestLogicalPlanner.java
@@ -262,7 +262,7 @@ public class TestLogicalPlanner {
static {
expectedJoinSchema = new Schema();
expectedJoinSchema.addColumn("name", Type.TEXT);
- expectedJoinSchema.addColumn("deptName", Type.TEXT);
+ expectedJoinSchema.addColumn("deptname", Type.TEXT);
expectedJoinSchema.addColumn("score", Type.INT4);
}
http://git-wip-us.apache.org/repos/asf/tajo/blob/37fef799/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/planner/TestPlannerUtil.java
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/planner/TestPlannerUtil.java b/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/planner/TestPlannerUtil.java
index a44f5f7..746f6fb 100644
--- a/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/planner/TestPlannerUtil.java
+++ b/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/planner/TestPlannerUtil.java
@@ -63,15 +63,15 @@ public class TestPlannerUtil {
Schema schema = new Schema();
schema.addColumn("name", Type.TEXT);
- schema.addColumn("empId", CatalogUtil.newSimpleDataType(Type.INT4));
- schema.addColumn("deptName", Type.TEXT);
+ schema.addColumn("empid", CatalogUtil.newSimpleDataType(Type.INT4));
+ schema.addColumn("deptname", Type.TEXT);
Schema schema2 = new Schema();
- schema2.addColumn("deptName", Type.TEXT);
+ schema2.addColumn("deptname", Type.TEXT);
schema2.addColumn("manager", Type.TEXT);
Schema schema3 = new Schema();
- schema3.addColumn("deptName", Type.TEXT);
+ schema3.addColumn("deptname", Type.TEXT);
schema3.addColumn("score", CatalogUtil.newSimpleDataType(Type.INT4));
TableMeta meta = CatalogUtil.newTableMeta(StoreType.CSV);
http://git-wip-us.apache.org/repos/asf/tajo/blob/37fef799/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/planner/physical/TestBNLJoinExec.java
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/planner/physical/TestBNLJoinExec.java b/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/planner/physical/TestBNLJoinExec.java
index 7092693..c79796b 100644
--- a/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/planner/physical/TestBNLJoinExec.java
+++ b/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/planner/physical/TestBNLJoinExec.java
@@ -78,10 +78,10 @@ public class TestBNLJoinExec {
sm = StorageManagerFactory.getStorageManager(conf, testDir);
Schema schema = new Schema();
- schema.addColumn("managerId", Type.INT4);
- schema.addColumn("empId", Type.INT4);
- schema.addColumn("memId", Type.INT4);
- schema.addColumn("deptName", Type.TEXT);
+ schema.addColumn("managerid", Type.INT4);
+ schema.addColumn("empid", Type.INT4);
+ schema.addColumn("memid", Type.INT4);
+ schema.addColumn("deptname", Type.TEXT);
TableMeta employeeMeta = CatalogUtil.newTableMeta(StoreType.CSV);
Path employeePath = new Path(testDir, "employee.csv");
@@ -100,8 +100,8 @@ public class TestBNLJoinExec {
catalog.createTable(employee);
Schema peopleSchema = new Schema();
- peopleSchema.addColumn("empId", Type.INT4);
- peopleSchema.addColumn("fk_memId", Type.INT4);
+ peopleSchema.addColumn("empid", Type.INT4);
+ peopleSchema.addColumn("fk_memid", Type.INT4);
peopleSchema.addColumn("name", Type.TEXT);
peopleSchema.addColumn("age", Type.INT4);
TableMeta peopleMeta = CatalogUtil.newTableMeta(StoreType.CSV);
http://git-wip-us.apache.org/repos/asf/tajo/blob/37fef799/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/planner/physical/TestBSTIndexExec.java
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/planner/physical/TestBSTIndexExec.java b/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/planner/physical/TestBSTIndexExec.java
index bce9d8e..b74527a 100644
--- a/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/planner/physical/TestBSTIndexExec.java
+++ b/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/planner/physical/TestBSTIndexExec.java
@@ -95,14 +95,14 @@ public class TestBSTIndexExec {
idxPath = new Path(workDir, "test.idx");
Schema schema = new Schema();
- schema.addColumn("managerId", Type.INT4);
- schema.addColumn("empId", Type.INT4);
- schema.addColumn("deptName", Type.TEXT);
+ schema.addColumn("managerid", Type.INT4);
+ schema.addColumn("empid", Type.INT4);
+ schema.addColumn("deptname", Type.TEXT);
this.idxSchema = new Schema();
- idxSchema.addColumn("managerId", Type.INT4);
+ idxSchema.addColumn("managerid", Type.INT4);
SortSpec[] sortKeys = new SortSpec[1];
- sortKeys[0] = new SortSpec(idxSchema.getColumn("managerId"), true, false);
+ sortKeys[0] = new SortSpec(idxSchema.getColumn("managerid"), true, false);
this.comp = new TupleComparator(idxSchema, sortKeys);
this.writer = new BSTIndex(conf).getIndexWriter(idxPath,
http://git-wip-us.apache.org/repos/asf/tajo/blob/37fef799/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/planner/physical/TestExternalSortExec.java
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/planner/physical/TestExternalSortExec.java b/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/planner/physical/TestExternalSortExec.java
index a82eeb9..ff3befe 100644
--- a/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/planner/physical/TestExternalSortExec.java
+++ b/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/planner/physical/TestExternalSortExec.java
@@ -75,9 +75,9 @@ public class TestExternalSortExec {
sm = StorageManagerFactory.getStorageManager(conf, testDir);
Schema schema = new Schema();
- schema.addColumn("managerId", Type.INT4);
- schema.addColumn("empId", Type.INT4);
- schema.addColumn("deptName", Type.TEXT);
+ schema.addColumn("managerid", Type.INT4);
+ schema.addColumn("empid", Type.INT4);
+ schema.addColumn("deptname", Type.TEXT);
TableMeta employeeMeta = CatalogUtil.newTableMeta(StoreType.CSV);
Path employeePath = new Path(testDir, "employee.csv");
@@ -150,8 +150,8 @@ public class TestExternalSortExec {
long start = System.currentTimeMillis();
TupleComparator comparator = new TupleComparator(proj.getSchema(),
new SortSpec[]{
- new SortSpec(new Column("managerId", Type.INT4)),
- new SortSpec(new Column("empId", Type.INT4))
+ new SortSpec(new Column("managerid", Type.INT4)),
+ new SortSpec(new Column("empid", Type.INT4))
});
while ((tuple = exec.next()) != null) {
http://git-wip-us.apache.org/repos/asf/tajo/blob/37fef799/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/planner/physical/TestHashAntiJoinExec.java
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/planner/physical/TestHashAntiJoinExec.java b/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/planner/physical/TestHashAntiJoinExec.java
index 9d0a86a..1dbbcf0 100644
--- a/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/planner/physical/TestHashAntiJoinExec.java
+++ b/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/planner/physical/TestHashAntiJoinExec.java
@@ -74,10 +74,10 @@ public class TestHashAntiJoinExec {
sm = StorageManagerFactory.getStorageManager(conf, testDir);
Schema employeeSchema = new Schema();
- employeeSchema.addColumn("managerId", Type.INT4);
- employeeSchema.addColumn("empId", Type.INT4);
- employeeSchema.addColumn("memId", Type.INT4);
- employeeSchema.addColumn("deptName", Type.TEXT);
+ employeeSchema.addColumn("managerid", Type.INT4);
+ employeeSchema.addColumn("empid", Type.INT4);
+ employeeSchema.addColumn("memid", Type.INT4);
+ employeeSchema.addColumn("deptname", Type.TEXT);
TableMeta employeeMeta = CatalogUtil.newTableMeta(StoreType.CSV);
Path employeePath = new Path(testDir, "employee.csv");
@@ -101,8 +101,8 @@ public class TestHashAntiJoinExec {
catalog.createTable(employee);
Schema peopleSchema = new Schema();
- peopleSchema.addColumn("empId", Type.INT4);
- peopleSchema.addColumn("fk_memId", Type.INT4);
+ peopleSchema.addColumn("empid", Type.INT4);
+ peopleSchema.addColumn("fk_memid", Type.INT4);
peopleSchema.addColumn("name", Type.TEXT);
peopleSchema.addColumn("age", Type.INT4);
TableMeta peopleMeta = CatalogUtil.newTableMeta(StoreType.CSV);
http://git-wip-us.apache.org/repos/asf/tajo/blob/37fef799/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/planner/physical/TestHashJoinExec.java
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/planner/physical/TestHashJoinExec.java b/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/planner/physical/TestHashJoinExec.java
index da7fce0..66222da 100644
--- a/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/planner/physical/TestHashJoinExec.java
+++ b/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/planner/physical/TestHashJoinExec.java
@@ -77,10 +77,10 @@ public class TestHashJoinExec {
sm = StorageManagerFactory.getStorageManager(conf, testDir);
Schema employeeSchema = new Schema();
- employeeSchema.addColumn("managerId", Type.INT4);
- employeeSchema.addColumn("empId", Type.INT4);
- employeeSchema.addColumn("memId", Type.INT4);
- employeeSchema.addColumn("deptName", Type.TEXT);
+ employeeSchema.addColumn("managerid", Type.INT4);
+ employeeSchema.addColumn("empid", Type.INT4);
+ employeeSchema.addColumn("memid", Type.INT4);
+ employeeSchema.addColumn("deptname", Type.TEXT);
TableMeta employeeMeta = CatalogUtil.newTableMeta(StoreType.CSV);
Path employeePath = new Path(testDir, "employee.csv");
@@ -101,8 +101,8 @@ public class TestHashJoinExec {
catalog.createTable(employee);
Schema peopleSchema = new Schema();
- peopleSchema.addColumn("empId", Type.INT4);
- peopleSchema.addColumn("fk_memId", Type.INT4);
+ peopleSchema.addColumn("empid", Type.INT4);
+ peopleSchema.addColumn("fk_memid", Type.INT4);
peopleSchema.addColumn("name", Type.TEXT);
peopleSchema.addColumn("age", Type.INT4);
TableMeta peopleMeta = CatalogUtil.newTableMeta(StoreType.CSV);
http://git-wip-us.apache.org/repos/asf/tajo/blob/37fef799/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/planner/physical/TestHashSemiJoinExec.java
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/planner/physical/TestHashSemiJoinExec.java b/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/planner/physical/TestHashSemiJoinExec.java
index 75a27db..4e5de98 100644
--- a/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/planner/physical/TestHashSemiJoinExec.java
+++ b/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/planner/physical/TestHashSemiJoinExec.java
@@ -74,10 +74,10 @@ public class TestHashSemiJoinExec {
sm = StorageManagerFactory.getStorageManager(conf, testDir);
Schema employeeSchema = new Schema();
- employeeSchema.addColumn("managerId", Type.INT4);
- employeeSchema.addColumn("empId", Type.INT4);
- employeeSchema.addColumn("memId", Type.INT4);
- employeeSchema.addColumn("deptName", Type.TEXT);
+ employeeSchema.addColumn("managerid", Type.INT4);
+ employeeSchema.addColumn("empid", Type.INT4);
+ employeeSchema.addColumn("memid", Type.INT4);
+ employeeSchema.addColumn("deptname", Type.TEXT);
TableMeta employeeMeta = CatalogUtil.newTableMeta(StoreType.CSV);
Path employeePath = new Path(testDir, "employee.csv");
@@ -101,8 +101,8 @@ public class TestHashSemiJoinExec {
catalog.createTable(employee);
Schema peopleSchema = new Schema();
- peopleSchema.addColumn("empId", Type.INT4);
- peopleSchema.addColumn("fk_memId", Type.INT4);
+ peopleSchema.addColumn("empid", Type.INT4);
+ peopleSchema.addColumn("fk_memid", Type.INT4);
peopleSchema.addColumn("name", Type.TEXT);
peopleSchema.addColumn("age", Type.INT4);
TableMeta peopleMeta = CatalogUtil.newTableMeta(StoreType.CSV);
http://git-wip-us.apache.org/repos/asf/tajo/blob/37fef799/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/planner/physical/TestMergeJoinExec.java
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/planner/physical/TestMergeJoinExec.java b/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/planner/physical/TestMergeJoinExec.java
index 2ed057c..0e4fd9a 100644
--- a/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/planner/physical/TestMergeJoinExec.java
+++ b/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/planner/physical/TestMergeJoinExec.java
@@ -77,10 +77,10 @@ public class TestMergeJoinExec {
sm = StorageManagerFactory.getStorageManager(conf, testDir);
Schema employeeSchema = new Schema();
- employeeSchema.addColumn("managerId", Type.INT4);
- employeeSchema.addColumn("empId", Type.INT4);
- employeeSchema.addColumn("memId", Type.INT4);
- employeeSchema.addColumn("deptName", Type.TEXT);
+ employeeSchema.addColumn("managerid", Type.INT4);
+ employeeSchema.addColumn("empid", Type.INT4);
+ employeeSchema.addColumn("memid", Type.INT4);
+ employeeSchema.addColumn("deptname", Type.TEXT);
TableMeta employeeMeta = CatalogUtil.newTableMeta(StoreType.CSV);
Path employeePath = new Path(testDir, "employee.csv");
@@ -107,8 +107,8 @@ public class TestMergeJoinExec {
catalog.createTable(employee);
Schema peopleSchema = new Schema();
- peopleSchema.addColumn("empId", Type.INT4);
- peopleSchema.addColumn("fk_memId", Type.INT4);
+ peopleSchema.addColumn("empid", Type.INT4);
+ peopleSchema.addColumn("fk_memid", Type.INT4);
peopleSchema.addColumn("name", Type.TEXT);
peopleSchema.addColumn("age", Type.INT4);
TableMeta peopleMeta = CatalogUtil.newTableMeta(StoreType.CSV);