tajo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jihoon...@apache.org
Subject [28/52] [abbrv] tajo git commit: Merge branch 'master' of https://git-wip-us.apache.org/repos/asf/tajo into index_support
Date Wed, 22 Jul 2015 13:01:01 GMT
Merge branch 'master' of https://git-wip-us.apache.org/repos/asf/tajo into index_support


Project: http://git-wip-us.apache.org/repos/asf/tajo/repo
Commit: http://git-wip-us.apache.org/repos/asf/tajo/commit/0028d7aa
Tree: http://git-wip-us.apache.org/repos/asf/tajo/tree/0028d7aa
Diff: http://git-wip-us.apache.org/repos/asf/tajo/diff/0028d7aa

Branch: refs/heads/index_support
Commit: 0028d7aabd1146b512575561bea6d8f565f505ad
Parents: 15749c5 c50a5da
Author: Jihoon Son <jihoonson@apache.org>
Authored: Mon Jul 20 23:43:12 2015 +0900
Committer: Jihoon Son <jihoonson@apache.org>
Committed: Mon Jul 20 23:43:12 2015 +0900

----------------------------------------------------------------------
 .travis.yml                                     |   2 +-
 BUILDING                                        |   2 +-
 CHANGES                                         |  15 +
 dev-support/findbugs-exclude.xml                |  23 -
 .../tajo/catalog/AbstractCatalogClient.java     | 591 ++++++-----
 .../src/main/proto/CatalogProtocol.proto        | 166 +++-
 .../org/apache/tajo/catalog/CatalogService.java |  10 +-
 .../org/apache/tajo/catalog/CatalogUtil.java    |  17 +-
 .../org/apache/tajo/catalog/FunctionDesc.java   |   7 +-
 .../java/org/apache/tajo/catalog/Schema.java    |   4 +-
 .../org/apache/tajo/catalog/SchemaUtil.java     |  60 ++
 .../AlreadyExistsDatabaseException.java         |  30 -
 .../exception/AlreadyExistsFieldException.java  |  30 -
 .../AlreadyExistsFunctionException.java         |  27 -
 .../exception/AlreadyExistsIndexException.java  |  39 -
 .../AlreadyExistsPartitionException.java        |  37 -
 .../exception/AlreadyExistsTableException.java  |  35 -
 .../AlreadyExistsTablespaceException.java       |  30 -
 .../exception/AmbiguousFunctionException.java   |  30 +
 .../catalog/exception/CatalogException.java     |  33 +-
 .../catalog/exception/CatalogExceptionUtil.java |  45 +
 .../ColumnNameAlreadyExistException.java        |  31 -
 .../exception/DuplicateColumnException.java     |  29 +
 .../exception/DuplicateDatabaseException.java   |  28 +
 .../exception/DuplicateFunctionException.java   |  32 +
 .../exception/DuplicateIndexException.java      |  29 +
 .../exception/DuplicatePartitionException.java  |  30 +
 .../exception/DuplicateTableException.java      |  30 +
 .../exception/DuplicateTablespaceException.java |  28 +
 .../catalog/exception/InvalidNameException.java |  29 +
 .../exception/MetadataConnectionException.java  |  32 +
 .../exception/NoPartitionedTableException.java  |   2 -
 .../exception/NoSuchColumnException.java        |  34 -
 .../exception/NoSuchDatabaseException.java      |  30 -
 .../exception/NoSuchFunctionException.java      |  40 -
 .../catalog/exception/NoSuchIndexException.java |  34 -
 .../catalog/exception/NoSuchTableException.java |  34 -
 .../exception/NoSuchTablespaceException.java    |  29 -
 .../exception/UndefinedColumnException.java     |  30 +
 .../exception/UndefinedDatabaseException.java   |  30 +
 .../exception/UndefinedFunctionException.java   |  44 +
 .../exception/UndefinedIndexException.java      |  33 +
 .../exception/UndefinedPartitionException.java  |  30 +
 .../exception/UndefinedTableException.java      |  35 +
 .../exception/UndefinedTablespaceException.java |  29 +
 .../src/main/proto/CatalogProtos.proto          |  80 +-
 .../org/apache/tajo/catalog/TestSchema.java     |   4 +-
 .../tajo/catalog/store/HiveCatalogStore.java    |  67 +-
 .../tajo/catalog/store/HiveCatalogUtil.java     |  40 +-
 .../org/apache/tajo/catalog/CatalogServer.java  | 978 +++++++++++--------
 .../dictionary/ClusterTableDescriptor.java      |   6 +-
 .../InfoSchemaMetadataDictionary.java           |  10 +-
 .../tajo/catalog/store/AbstractDBStore.java     | 170 ++--
 .../apache/tajo/catalog/store/CatalogStore.java |   6 +-
 .../apache/tajo/catalog/store/DerbyStore.java   |   3 +-
 .../org/apache/tajo/catalog/store/MemStore.java |  45 +-
 .../catalog/store/XMLCatalogSchemaManager.java  |  39 +-
 .../org/apache/tajo/catalog/TestCatalog.java    |  11 +-
 .../org/apache/tajo/cli/tools/TajoAdmin.java    |  43 +-
 .../java/org/apache/tajo/cli/tsql/TajoCli.java  |  47 +-
 .../tsql/commands/ConnectDatabaseCommand.java   |   4 +-
 .../tajo/cli/tsql/commands/SetCommand.java      |   9 +-
 .../apache/tajo/client/CatalogAdminClient.java  |  45 +-
 .../tajo/client/CatalogAdminClientImpl.java     | 190 ++--
 .../org/apache/tajo/client/QueryClient.java     |  72 +-
 .../org/apache/tajo/client/QueryClientImpl.java | 461 +++++----
 .../org/apache/tajo/client/QueryStatus.java     |   2 +-
 .../apache/tajo/client/SessionConnection.java   | 221 +++--
 .../java/org/apache/tajo/client/TajoClient.java |   2 +-
 .../org/apache/tajo/client/TajoClientImpl.java  |  73 +-
 .../org/apache/tajo/client/TajoClientUtil.java  |   9 +-
 .../java/org/apache/tajo/jdbc/SQLStates.java    |  33 -
 tajo-client/src/main/proto/ClientProtos.proto   |  95 +-
 .../main/proto/QueryMasterClientProtocol.proto  |   6 +-
 .../main/proto/TajoMasterClientProtocol.proto   |  34 +-
 tajo-common/pom.xml                             |   2 +
 .../main/java/org/apache/tajo/SessionVars.java  |   2 +-
 .../exception/InvalidAddressException.java      |  25 -
 .../exception/NotImplementedException.java      |  49 -
 .../java/org/apache/tajo/common/type/IPv4.java  |   2 +-
 .../java/org/apache/tajo/conf/TajoConf.java     |  55 +-
 .../apache/tajo/exception/ErrorMessages.java    | 134 +++
 .../org/apache/tajo/exception/ErrorUtil.java    |  44 +
 .../apache/tajo/exception/ExceptionUtil.java    |  64 ++
 .../tajo/exception/InvalidAddressException.java |  25 +
 .../exception/InvalidDataTypeException.java     |  30 +
 .../apache/tajo/exception/ReturnStateUtil.java  | 200 ++++
 .../apache/tajo/exception/SQLExceptionUtil.java |  99 ++
 .../org/apache/tajo/exception/TajoError.java    |  53 +
 .../apache/tajo/exception/TajoException.java    |  44 +
 .../tajo/exception/TajoExceptionInterface.java  |  33 +
 .../tajo/exception/TajoInternalError.java       |  35 +
 .../tajo/exception/TajoRuntimeException.java    |  51 +
 .../exception/UndefinedOperatorException.java   |  28 +
 .../tajo/exception/UnimplementedException.java  |  18 +-
 .../tajo/exception/UnsupportedException.java    |  19 +-
 .../org/apache/tajo/storage/StorageService.java |   1 +
 .../java/org/apache/tajo/util/NumberUtil.java   |   4 +
 .../main/java/org/apache/tajo/util/Pair.java    |   5 +
 .../java/org/apache/tajo/util/StringUtils.java  |   9 +-
 .../main/java/org/apache/tajo/util/TUtil.java   |   9 +
 .../src/main/proto/PrimitiveProtos.proto        |  24 +
 tajo-common/src/main/proto/errors.proto         | 330 +++++++
 tajo-common/src/main/proto/stacktrace.proto     |  33 +
 .../org/apache/tajo/common/type/TestIPv4.java   |   2 +-
 tajo-core/pom.xml                               |  14 +-
 .../org/apache/tajo/benchmark/BenchmarkSet.java |   7 +-
 .../java/org/apache/tajo/benchmark/TPCH.java    |  13 +-
 .../apache/tajo/engine/parser/SQLAnalyzer.java  |  19 +-
 .../tajo/engine/parser/SQLSyntaxError.java      |  11 +-
 .../engine/planner/PhysicalPlannerImpl.java     |  24 +-
 .../tajo/engine/planner/enforce/Enforcer.java   |  13 +-
 .../tajo/engine/planner/global/DataChannel.java |   3 +-
 .../tajo/engine/planner/global/MasterPlan.java  |  11 +-
 .../global/builder/DistinctGroupbyBuilder.java  |   6 +-
 .../tajo/engine/planner/physical/ScanExec.java  |  10 +-
 .../planner/physical/SetTupleComparator.java    |  68 ++
 .../planner/physical/SortIntersectExec.java     |  91 ++
 .../apache/tajo/engine/query/TaskRequest.java   |  27 +-
 .../tajo/engine/query/TaskRequestImpl.java      |  87 +-
 .../org/apache/tajo/master/ContainerProxy.java  |  85 --
 .../org/apache/tajo/master/GlobalEngine.java    |  45 +-
 .../tajo/master/LaunchTaskRunnersEvent.java     |  46 -
 .../tajo/master/QueryCoordinatorService.java    |  77 +-
 .../org/apache/tajo/master/QueryInProgress.java | 102 +-
 .../org/apache/tajo/master/QueryManager.java    | 104 +-
 .../apache/tajo/master/TajoContainerProxy.java  | 177 ----
 .../java/org/apache/tajo/master/TajoMaster.java | 120 +--
 .../tajo/master/TajoMasterClientService.java    | 416 +++++---
 .../tajo/master/TaskRunnerGroupEvent.java       |  51 -
 .../apache/tajo/master/TaskRunnerLauncher.java  |  25 -
 .../master/cluster/WorkerConnectionInfo.java    |   4 +
 .../tajo/master/container/TajoContainer.java    | 173 ----
 .../tajo/master/container/TajoContainerId.java  | 171 ----
 .../master/container/TajoContainerIdPBImpl.java | 100 --
 .../master/container/TajoConverterUtils.java    |  87 --
 .../master/event/ContainerAllocationEvent.java  |  77 --
 .../event/ContainerAllocatorEventType.java      |  26 -
 .../tajo/master/event/ContainerEvent.java       |  37 -
 .../event/GrouppedContainerAllocatorEvent.java  |  45 -
 .../tajo/master/event/LocalTaskEvent.java       |  11 +-
 .../tajo/master/event/QueryStartEvent.java      |   9 +-
 .../event/StageContainerAllocationEvent.java    |  38 -
 .../tajo/master/event/StageEventType.java       |   2 -
 .../master/event/StageShuffleReportEvent.java   |   8 +-
 .../master/event/TaskAttemptAssignedEvent.java  |   9 +-
 .../tajo/master/event/TaskAttemptEventType.java |   1 +
 .../event/TaskAttemptStatusUpdateEvent.java     |   2 +-
 .../event/TaskAttemptToSchedulerEvent.java      |  26 +-
 .../tajo/master/event/TaskCompletionEvent.java  |   2 +-
 .../tajo/master/event/TaskFatalErrorEvent.java  |   2 +-
 .../tajo/master/event/TaskRequestEvent.java     |  35 +-
 .../apache/tajo/master/exec/DDLExecutor.java    |  89 +-
 .../exec/ExplainPlanPreprocessorForTest.java    |  87 +-
 .../NonForwardQueryResultSystemScanner.java     |  94 +-
 .../apache/tajo/master/exec/QueryExecutor.java  |  48 +
 .../org/apache/tajo/master/rm/NodeEvent.java    |  37 +
 .../apache/tajo/master/rm/NodeEventType.java    |  30 +
 .../tajo/master/rm/NodeLivelinessMonitor.java   |  56 ++
 .../tajo/master/rm/NodeReconnectEvent.java      |  35 +
 .../org/apache/tajo/master/rm/NodeState.java    |  44 +
 .../org/apache/tajo/master/rm/NodeStatus.java   | 295 ++++++
 .../apache/tajo/master/rm/NodeStatusEvent.java  |  58 ++
 .../apache/tajo/master/rm/TajoRMContext.java    |  42 +-
 .../tajo/master/rm/TajoResourceManager.java     | 185 ++++
 .../tajo/master/rm/TajoResourceTracker.java     | 197 ++--
 .../tajo/master/rm/TajoWorkerContainer.java     | 125 ---
 .../tajo/master/rm/TajoWorkerContainerId.java   |  94 --
 .../master/rm/TajoWorkerResourceManager.java    | 605 ------------
 .../java/org/apache/tajo/master/rm/Worker.java  | 290 ------
 .../org/apache/tajo/master/rm/WorkerEvent.java  |  37 -
 .../apache/tajo/master/rm/WorkerEventType.java  |  30 -
 .../tajo/master/rm/WorkerLivelinessMonitor.java |  56 --
 .../tajo/master/rm/WorkerReconnectEvent.java    |  35 -
 .../tajo/master/rm/WorkerResourceManager.java   | 115 ---
 .../org/apache/tajo/master/rm/WorkerState.java  |  44 -
 .../tajo/master/rm/WorkerStatusEvent.java       |  54 -
 .../scheduler/AbstractQueryScheduler.java       |  73 ++
 .../master/scheduler/QuerySchedulingInfo.java   |  60 +-
 .../apache/tajo/master/scheduler/QueueInfo.java | 101 ++
 .../tajo/master/scheduler/QueueState.java       |  50 +
 .../master/scheduler/SchedulingAlgorithms.java  |   6 +-
 .../master/scheduler/SimpleFifoScheduler.java   | 148 ---
 .../tajo/master/scheduler/SimpleScheduler.java  | 388 ++++++++
 .../master/scheduler/TajoResourceScheduler.java |  75 ++
 .../event/ResourceReserveSchedulerEvent.java    |  45 +
 .../master/scheduler/event/SchedulerEvent.java  |  27 +
 .../scheduler/event/SchedulerEventType.java     |  26 +
 .../metrics/WorkerResourceMetricsGaugeSet.java  |  16 +-
 .../tajo/querymaster/AbstractTaskScheduler.java |  17 +-
 .../tajo/querymaster/DefaultTaskScheduler.java  | 500 ++++++----
 .../java/org/apache/tajo/querymaster/Query.java |  25 +-
 .../apache/tajo/querymaster/QueryMaster.java    | 249 ++---
 .../querymaster/QueryMasterManagerService.java  | 180 ++--
 .../tajo/querymaster/QueryMasterTask.java       | 217 ++--
 .../apache/tajo/querymaster/Repartitioner.java  |   4 +-
 .../java/org/apache/tajo/querymaster/Stage.java | 247 ++---
 .../java/org/apache/tajo/querymaster/Task.java  |  29 +-
 .../apache/tajo/querymaster/TaskAttempt.java    |  34 +-
 .../resource/DefaultResourceCalculator.java     |   4 +-
 .../org/apache/tajo/resource/NodeResource.java  |   2 +-
 .../session/NoSuchSessionVariableException.java |   8 +-
 .../java/org/apache/tajo/session/Session.java   |   2 +-
 .../main/java/org/apache/tajo/util/JSPUtil.java |  33 +-
 .../apache/tajo/util/history/HistoryReader.java |   8 +-
 .../apache/tajo/util/history/HistoryWriter.java |  78 +-
 .../metrics/reporter/TajoMetricsReporter.java   |   6 +-
 .../tajo/webapp/QueryExecutorServlet.java       |  48 +-
 .../tajo/worker/AbstractResourceAllocator.java  |  69 --
 .../tajo/worker/ExecutionBlockContext.java      |  70 +-
 .../java/org/apache/tajo/worker/FetchImpl.java  |  12 +-
 .../org/apache/tajo/worker/LegacyTaskImpl.java  | 844 ----------------
 .../apache/tajo/worker/NodeResourceManager.java | 140 ++-
 .../apache/tajo/worker/NodeStatusUpdater.java   | 120 ++-
 .../apache/tajo/worker/ResourceAllocator.java   |  29 -
 .../tajo/worker/TajoResourceAllocator.java      | 415 --------
 .../java/org/apache/tajo/worker/TajoWorker.java |  96 +-
 .../tajo/worker/TajoWorkerClientService.java    |  14 +
 .../tajo/worker/TajoWorkerManagerService.java   |  79 +-
 .../main/java/org/apache/tajo/worker/Task.java  |  11 +-
 .../org/apache/tajo/worker/TaskContainer.java   |   1 -
 .../org/apache/tajo/worker/TaskExecutor.java    | 117 ++-
 .../org/apache/tajo/worker/TaskHistory.java     |   4 +-
 .../java/org/apache/tajo/worker/TaskImpl.java   |  31 +-
 .../org/apache/tajo/worker/TaskManager.java     | 161 ++-
 .../java/org/apache/tajo/worker/TaskRunner.java | 306 ------
 .../apache/tajo/worker/TaskRunnerHistory.java   | 152 ---
 .../apache/tajo/worker/TaskRunnerManager.java   | 238 -----
 .../tajo/worker/WorkerHeartbeatService.java     | 262 -----
 .../worker/event/ExecutionBlockErrorEvent.java  |  41 +
 .../worker/event/ExecutionBlockStartEvent.java  |  35 -
 .../worker/event/ExecutionBlockStopEvent.java   |  16 +-
 .../worker/event/NodeResourceAllocateEvent.java |  18 +-
 .../event/NodeResourceDeallocateEvent.java      |   8 +-
 .../tajo/worker/event/NodeResourceEvent.java    |  14 +-
 .../worker/event/QMResourceAllocateEvent.java   |  45 +
 .../tajo/worker/event/QueryStopEvent.java       |  35 +
 .../tajo/worker/event/TaskExecutorEvent.java    |  44 -
 .../tajo/worker/event/TaskManagerEvent.java     |  22 +-
 .../tajo/worker/event/TaskRunnerEvent.java      |  42 -
 .../tajo/worker/event/TaskRunnerStartEvent.java |  39 -
 .../tajo/worker/event/TaskRunnerStopEvent.java  |  29 -
 .../tajo/worker/event/TaskStartEvent.java       |  18 +-
 .../tajo/ws/rs/resources/ClusterResource.java   |   8 +-
 .../tajo/ws/rs/resources/QueryResource.java     |  12 +
 .../ws/rs/resources/QueryResultResource.java    |   6 +-
 .../tajo/ws/rs/resources/SessionsResource.java  |  15 +-
 .../responses/GetQueryResultDataResponse.java   |   8 +-
 .../ws/rs/responses/GetSubmitQueryResponse.java |   8 +-
 .../ws/rs/responses/NewSessionResponse.java     |  11 +-
 .../tajo/ws/rs/responses/WorkerResponse.java    |  53 +-
 .../src/main/proto/ContainerProtocol.proto      |  48 -
 .../main/proto/QueryCoordinatorProtocol.proto   | 117 +--
 .../src/main/proto/QueryMasterProtocol.proto    |  11 +-
 tajo-core/src/main/proto/ResourceProtos.proto   | 311 ++++++
 .../main/proto/ResourceTrackerProtocol.proto    |  39 +-
 .../src/main/proto/TajoWorkerProtocol.proto     | 348 +------
 .../main/resources/webapps/admin/cluster.jsp    |  99 +-
 .../src/main/resources/webapps/admin/index.jsp  |  34 +-
 .../src/main/resources/webapps/admin/query.jsp  |  57 +-
 .../resources/webapps/admin/query_executor.jsp  |   3 +-
 .../resources/webapps/admin/querydetail.jsp     |   4 +-
 .../main/resources/webapps/admin/querytasks.jsp |  34 +-
 .../src/main/resources/webapps/admin/task.jsp   |  18 +-
 .../src/main/resources/webapps/worker/index.jsp |  58 +-
 .../resources/webapps/worker/querydetail.jsp    |  21 +-
 .../main/resources/webapps/worker/queryplan.jsp |   2 +-
 .../resources/webapps/worker/querytasks.jsp     |  44 +-
 .../src/main/resources/webapps/worker/task.jsp  |  16 +-
 .../resources/webapps/worker/taskcontainers.jsp |  93 --
 .../resources/webapps/worker/taskdetail.jsp     |  39 +-
 .../resources/webapps/worker/taskhistory.jsp    |   6 +-
 .../src/main/resources/webapps/worker/tasks.jsp | 107 --
 .../apache/tajo/LocalTajoTestingUtility.java    |   3 +-
 .../java/org/apache/tajo/QueryTestCaseBase.java |  47 +-
 .../org/apache/tajo/TajoTestingCluster.java     |  27 +-
 .../org/apache/tajo/client/TestTajoClient.java  | 121 +--
 .../tajo/client/TestTajoClientFailures.java     |  75 ++
 .../apache/tajo/engine/eval/ExprTestBase.java   |  12 +-
 .../tajo/engine/eval/TestSQLExpression.java     |   8 +-
 .../function/TestConditionalExpressions.java    |  10 +-
 .../tajo/engine/planner/TestLogicalPlanner.java |   2 +-
 .../planner/physical/TestBNLJoinExec.java       |   2 +-
 .../physical/TestFullOuterHashJoinExec.java     |   2 +-
 .../physical/TestFullOuterMergeJoinExec.java    |   2 +-
 .../planner/physical/TestHashJoinExec.java      |   2 +-
 .../physical/TestLeftOuterHashJoinExec.java     |   2 +-
 .../planner/physical/TestMergeJoinExec.java     |   2 +-
 .../planner/physical/TestPhysicalPlanner.java   |   4 +-
 .../physical/TestRightOuterMergeJoinExec.java   |   2 +-
 .../planner/physical/TestSortIntersectExec.java | 294 ++++++
 .../tajo/engine/query/TestCreateTable.java      |  16 +
 .../tajo/engine/query/TestInnerJoinQuery.java   |   7 +-
 .../engine/query/TestInnerJoinWithSubQuery.java |   3 +-
 .../query/TestJoinOnPartitionedTables.java      |   4 +-
 .../apache/tajo/engine/query/TestJoinQuery.java |   9 +-
 .../engine/query/TestMultipleJoinTypes.java     |   4 +-
 .../tajo/engine/query/TestOuterJoinQuery.java   |   7 +-
 .../engine/query/TestOuterJoinWithSubQuery.java |   4 +-
 .../tajo/engine/query/TestTablePartitions.java  |  11 +
 .../java/org/apache/tajo/jdbc/TestSQLState.java |  91 ++
 .../java/org/apache/tajo/jdbc/TestTajoJdbc.java |   2 +-
 .../TestNonForwardQueryResultSystemScanner.java |  42 +-
 .../apache/tajo/master/TestRepartitioner.java   |  11 +-
 .../tajo/master/rm/TestTajoResourceManager.java | 454 ---------
 .../master/scheduler/TestFifoScheduler.java     | 115 ---
 .../master/scheduler/TestSimpleScheduler.java   | 301 ++++++
 .../apache/tajo/querymaster/TestKillQuery.java  | 161 +--
 .../apache/tajo/querymaster/TestQueryState.java |  38 +-
 .../tajo/querymaster/TestTaskStatusUpdate.java  |  10 +-
 .../tajo/util/metrics/TestSystemMetrics.java    |   1 +
 .../apache/tajo/worker/MockExecutionBlock.java  |   6 +-
 .../tajo/worker/MockNodeResourceManager.java    |  30 +-
 .../tajo/worker/MockNodeStatusUpdater.java      |  26 +-
 .../apache/tajo/worker/MockTaskExecutor.java    |  29 +-
 .../org/apache/tajo/worker/MockTaskManager.java |  24 +-
 .../apache/tajo/worker/MockWorkerContext.java   |  20 -
 .../org/apache/tajo/worker/TestFetcher.java     |  14 +-
 .../org/apache/tajo/worker/TestHistory.java     | 124 ---
 .../tajo/worker/TestNodeResourceManager.java    | 100 +-
 .../tajo/worker/TestNodeStatusUpdater.java      |  83 +-
 .../apache/tajo/worker/TestTaskExecutor.java    | 108 +-
 .../org/apache/tajo/worker/TestTaskManager.java |  75 +-
 .../tajo/ws/rs/resources/TestQueryResource.java |   7 +-
 .../rs/resources/TestQueryResultResource.java   |  13 +-
 .../ws/rs/resources/TestTablesResource.java     |   6 +-
 .../testBroadcastSubquery2.sql                  |   2 +-
 .../TestOuterJoinQuery/testLeftOuterJoin2.sql   |   2 +-
 .../testBroadcastTwoPartJoin.Hash.plan          |  16 +-
 ...stBroadcastTwoPartJoin.Hash_NoBroadcast.plan |  38 +-
 .../testBroadcastTwoPartJoin.Sort.plan          |  16 +-
 ...stBroadcastTwoPartJoin.Sort_NoBroadcast.plan |  38 +-
 .../testComplexJoinCondition1.Hash.plan         |  16 +-
 ...tComplexJoinCondition1.Hash_NoBroadcast.plan |  38 +-
 .../testComplexJoinCondition1.Sort.plan         |  16 +-
 ...tComplexJoinCondition1.Sort_NoBroadcast.plan |  38 +-
 .../testComplexJoinCondition2.Hash.plan         |  16 +-
 ...tComplexJoinCondition2.Hash_NoBroadcast.plan |  38 +-
 .../testComplexJoinCondition2.Sort.plan         |  16 +-
 ...tComplexJoinCondition2.Sort_NoBroadcast.plan |  38 +-
 .../testComplexJoinCondition3.Hash.plan         |  16 +-
 ...tComplexJoinCondition3.Hash_NoBroadcast.plan |  38 +-
 .../testComplexJoinCondition3.Sort.plan         |  16 +-
 ...tComplexJoinCondition3.Sort_NoBroadcast.plan |  38 +-
 .../testComplexJoinCondition4.Hash.plan         |  16 +-
 ...tComplexJoinCondition4.Hash_NoBroadcast.plan |  38 +-
 .../testComplexJoinCondition4.Sort.plan         |  16 +-
 ...tComplexJoinCondition4.Sort_NoBroadcast.plan |  38 +-
 .../testCrossJoin.2.Hash.plan                   |  16 +-
 .../testCrossJoin.2.Hash_NoBroadcast.plan       |  30 +-
 .../testCrossJoin.2.Sort.plan                   |  16 +-
 .../testCrossJoin.2.Sort_NoBroadcast.plan       |  30 +-
 .../TestInnerJoinQuery/testCrossJoin.3.result   |  32 +-
 .../TestInnerJoinQuery/testCrossJoin.5.result   |  36 +-
 .../testCrossJoinAndCaseWhen.Hash.plan          |  16 +-
 ...stCrossJoinAndCaseWhen.Hash_NoBroadcast.plan |  38 +-
 .../testCrossJoinAndCaseWhen.Sort.plan          |  16 +-
 ...stCrossJoinAndCaseWhen.Sort_NoBroadcast.plan |  38 +-
 .../testCrossJoinWithAsterisk1.Hash.plan        |  16 +-
 ...CrossJoinWithAsterisk1.Hash_NoBroadcast.plan |  30 +-
 .../testCrossJoinWithAsterisk1.Sort.plan        |  16 +-
 ...CrossJoinWithAsterisk1.Sort_NoBroadcast.plan |  30 +-
 .../testCrossJoinWithEmptyTable1.Hash.plan      |  16 +-
 ...ossJoinWithEmptyTable1.Hash_NoBroadcast.plan |  38 +-
 .../testCrossJoinWithEmptyTable1.Sort.plan      |  16 +-
 ...ossJoinWithEmptyTable1.Sort_NoBroadcast.plan |  38 +-
 ...sJoinWithThetaJoinConditionInWhere.Hash.plan |  16 +-
 ...taJoinConditionInWhere.Hash_NoBroadcast.plan |  30 +-
 ...sJoinWithThetaJoinConditionInWhere.Sort.plan |  16 +-
 ...taJoinConditionInWhere.Sort_NoBroadcast.plan |  30 +-
 .../testInnerJoinAndCaseWhen.Hash.plan          |  16 +-
 ...stInnerJoinAndCaseWhen.Hash_NoBroadcast.plan |  38 +-
 .../testInnerJoinAndCaseWhen.Sort.plan          |  16 +-
 ...stInnerJoinAndCaseWhen.Sort_NoBroadcast.plan |  38 +-
 .../testInnerJoinWithEmptyTable.Hash.plan       |  16 +-
 ...nnerJoinWithEmptyTable.Hash_NoBroadcast.plan |  38 +-
 .../testInnerJoinWithEmptyTable.Sort.plan       |  16 +-
 ...nnerJoinWithEmptyTable.Sort_NoBroadcast.plan |  38 +-
 .../testJoinAsterisk.Hash.plan                  |  16 +-
 .../testJoinAsterisk.Hash_NoBroadcast.plan      |  38 +-
 .../testJoinAsterisk.Sort.plan                  |  16 +-
 .../testJoinAsterisk.Sort_NoBroadcast.plan      |  38 +-
 .../testJoinCoReferredEvals1.Hash.plan          |  16 +-
 ...stJoinCoReferredEvals1.Hash_NoBroadcast.plan |  38 +-
 .../testJoinCoReferredEvals1.Sort.plan          |  16 +-
 ...stJoinCoReferredEvals1.Sort_NoBroadcast.plan |  38 +-
 .../testJoinOnMultipleDatabases.Hash.plan       | 110 +--
 ...oinOnMultipleDatabases.Hash_NoBroadcast.plan | 182 ++--
 .../testJoinOnMultipleDatabases.Sort.plan       | 110 +--
 ...oinOnMultipleDatabases.Sort_NoBroadcast.plan | 182 ++--
 .../testJoinWithMultipleJoinQual1.Hash.plan     |  16 +-
 ...nWithMultipleJoinQual1.Hash_NoBroadcast.plan |  38 +-
 .../testJoinWithMultipleJoinQual1.Sort.plan     |  16 +-
 ...nWithMultipleJoinQual1.Sort_NoBroadcast.plan |  38 +-
 .../TestInnerJoinQuery/testTPCHQ2Join.Hash.plan |  16 +-
 .../testTPCHQ2Join.Hash_NoBroadcast.plan        |  38 +-
 .../TestInnerJoinQuery/testTPCHQ2Join.Sort.plan |  16 +-
 .../testTPCHQ2Join.Sort_NoBroadcast.plan        |  38 +-
 .../testWhereClauseJoin1.Hash.plan              |  16 +-
 .../testWhereClauseJoin1.Hash_NoBroadcast.plan  |  38 +-
 .../testWhereClauseJoin1.Sort.plan              |  16 +-
 .../testWhereClauseJoin1.Sort_NoBroadcast.plan  |  38 +-
 .../testWhereClauseJoin2.Hash.plan              |  16 +-
 .../testWhereClauseJoin2.Hash_NoBroadcast.plan  |  38 +-
 .../testWhereClauseJoin2.Sort.plan              |  16 +-
 .../testWhereClauseJoin2.Sort_NoBroadcast.plan  |  38 +-
 .../testWhereClauseJoin3.Hash.plan              |  16 +-
 .../testWhereClauseJoin3.Hash_NoBroadcast.plan  |  38 +-
 .../testWhereClauseJoin3.Sort.plan              |  16 +-
 .../testWhereClauseJoin3.Sort_NoBroadcast.plan  |  38 +-
 .../testWhereClauseJoin5.Hash.plan              |  18 +-
 .../testWhereClauseJoin5.Hash_NoBroadcast.plan  |  38 +-
 .../testWhereClauseJoin5.Sort.plan              |  18 +-
 .../testWhereClauseJoin5.Sort_NoBroadcast.plan  |  38 +-
 .../testWhereClauseJoin6.Hash.plan              |  16 +-
 .../testWhereClauseJoin6.Hash_NoBroadcast.plan  |  38 +-
 .../testWhereClauseJoin6.Sort.plan              |  16 +-
 .../testWhereClauseJoin6.Sort_NoBroadcast.plan  |  38 +-
 .../testBroadcastSubquery.Hash.plan             |  84 +-
 .../testBroadcastSubquery.Hash_NoBroadcast.plan | 118 +--
 .../testBroadcastSubquery.Sort.plan             |  84 +-
 .../testBroadcastSubquery.Sort_NoBroadcast.plan | 118 +--
 .../testBroadcastSubquery2.Hash.plan            | 158 +--
 ...testBroadcastSubquery2.Hash_NoBroadcast.plan | 276 +++---
 .../testBroadcastSubquery2.Sort.plan            | 158 +--
 ...testBroadcastSubquery2.Sort_NoBroadcast.plan | 276 +++---
 .../testJoinWithMultipleJoinQual3.Hash.plan     |  58 +-
 ...nWithMultipleJoinQual3.Hash_NoBroadcast.plan | 134 +--
 .../testJoinWithMultipleJoinQual3.Sort.plan     |  58 +-
 ...nWithMultipleJoinQual3.Sort_NoBroadcast.plan | 134 +--
 .../testJoinWithMultipleJoinQual4.Hash.plan     |  58 +-
 ...nWithMultipleJoinQual4.Hash_NoBroadcast.plan | 134 +--
 .../testJoinWithMultipleJoinQual4.Sort.plan     |  58 +-
 ...nWithMultipleJoinQual4.Sort_NoBroadcast.plan | 134 +--
 .../TestJoinQuery/testWhereClauseJoin6.result   |   5 +
 .../testComplexJoinsWithCaseWhen.Hash.plan      |  16 +-
 ...mplexJoinsWithCaseWhen.Hash_NoBroadcast.plan |  38 +-
 .../testComplexJoinsWithCaseWhen.Sort.plan      |  16 +-
 ...mplexJoinsWithCaseWhen.Sort_NoBroadcast.plan |  38 +-
 .../testInnerAndOuterWithEmpty.1.Hash.plan      |  16 +-
 ...nerAndOuterWithEmpty.1.Hash_NoBroadcast.plan |  38 +-
 .../testInnerAndOuterWithEmpty.1.Sort.plan      |  16 +-
 ...nerAndOuterWithEmpty.1.Sort_NoBroadcast.plan |  38 +-
 .../testFullOuterJoin1.Hash.plan                |  38 +-
 .../testFullOuterJoin1.Hash_NoBroadcast.plan    |  38 +-
 .../testFullOuterJoin1.Sort.plan                |  38 +-
 .../testFullOuterJoin1.Sort_NoBroadcast.plan    |  38 +-
 ...lOuterJoinPredicationCaseByCase1.1.Hash.plan |  72 +-
 ...edicationCaseByCase1.1.Hash_NoBroadcast.plan |  72 +-
 ...lOuterJoinPredicationCaseByCase1.1.Sort.plan |  72 +-
 ...edicationCaseByCase1.1.Sort_NoBroadcast.plan |  72 +-
 .../testFullOuterJoinWithEmptyTable1.Hash.plan  |  38 +-
 ...terJoinWithEmptyTable1.Hash_NoBroadcast.plan |  38 +-
 .../testFullOuterJoinWithEmptyTable1.Sort.plan  |  38 +-
 ...terJoinWithEmptyTable1.Sort_NoBroadcast.plan |  38 +-
 .../testLeftOuterJoin3.Hash.plan                | 109 ++-
 .../testLeftOuterJoin3.Hash_NoBroadcast.plan    | 118 +--
 .../testLeftOuterJoin3.Sort.plan                | 109 ++-
 .../testLeftOuterJoin3.Sort_NoBroadcast.plan    | 118 +--
 ...tOuterJoinPredicationCaseByCase2.1.Hash.plan | 103 +-
 ...edicationCaseByCase2.1.Hash_NoBroadcast.plan | 114 +--
 ...tOuterJoinPredicationCaseByCase2.1.Sort.plan | 103 +-
 ...edicationCaseByCase2.1.Sort_NoBroadcast.plan | 114 +--
 .../testOuterJoinAndCaseWhen1.Hash.plan         | 109 ++-
 ...tOuterJoinAndCaseWhen1.Hash_NoBroadcast.plan | 118 +--
 .../testOuterJoinAndCaseWhen1.Sort.plan         | 109 ++-
 ...tOuterJoinAndCaseWhen1.Sort_NoBroadcast.plan | 118 +--
 ...terJoinWithEmptyIntermediateData.1.Hash.plan |  56 +-
 ...mptyIntermediateData.1.Hash_NoBroadcast.plan |  56 +-
 ...terJoinWithEmptyIntermediateData.1.Sort.plan |  56 +-
 ...mptyIntermediateData.1.Sort_NoBroadcast.plan |  56 +-
 .../testExplainSelectPhysical.2.result          |  32 +-
 .../results/TestTPCH/testQ2FourJoins.plan       |  38 +-
 .../resources/results/TestTPCH/testTPCHQ5.plan  | 142 +--
 .../testAlterTableAddDropPartition.result       |   2 +-
 .../TestTajoCli/testStopWhenError.result        |   2 +-
 .../testStopWhenErrorDeprecated.result          |   2 +-
 .../results/TestUnionQuery/testUnion12.result   |   3 +-
 .../results/TestUnionQuery/testUnion13.result   |   3 +-
 .../TestUnionQuery/testUnionAll12.result        |   3 +-
 .../TestUnionQuery/testUnionAll13.result        |   3 +-
 tajo-core/src/test/tpch/part.tbl                |   7 +-
 .../configuration/worker_configuration.rst      |  94 +-
 .../org/apache/tajo/jdbc/JdbcConnection.java    |  40 +-
 .../apache/tajo/jdbc/TajoDatabaseMetaData.java  |  21 +-
 .../org/apache/tajo/jdbc/TajoStatement.java     |  37 +-
 .../org/apache/tajo/plan/ExprAnnotator.java     |  54 +-
 .../org/apache/tajo/plan/ExprNormalizer.java    |   4 +-
 .../org/apache/tajo/plan/LogicalOptimizer.java  | 272 +++++-
 .../tajo/plan/LogicalPlanPreprocessor.java      |   6 +-
 .../org/apache/tajo/plan/LogicalPlanner.java    |  29 +-
 .../org/apache/tajo/plan/PlanningException.java |   3 +-
 .../org/apache/tajo/plan/TypeDeterminant.java   |  10 +-
 .../tajo/plan/expr/GeneralFunctionEval.java     |   6 +-
 .../GreedyHeuristicJoinOrderAlgorithm.java      | 518 ++++++----
 .../apache/tajo/plan/joinorder/JoinEdge.java    |  70 +-
 .../apache/tajo/plan/joinorder/JoinGraph.java   | 150 +--
 .../tajo/plan/joinorder/JoinGraphContext.java   | 137 +++
 .../tajo/plan/joinorder/JoinOrderAlgorithm.java |  14 +-
 .../tajo/plan/joinorder/JoinOrderingUtil.java   | 313 ++++++
 .../apache/tajo/plan/joinorder/JoinVertex.java  |  32 +
 .../plan/joinorder/JoinedRelationsVertex.java   | 125 +++
 .../tajo/plan/joinorder/RelationVertex.java     |  76 ++
 .../org/apache/tajo/plan/logical/JoinNode.java  |  37 +-
 .../org/apache/tajo/plan/logical/JoinSpec.java  | 132 +++
 .../plan/logical/NoSuchColumnException.java     |  34 -
 .../org/apache/tajo/plan/logical/ScanNode.java  |   1 +
 .../tajo/plan/nameresolver/NameResolver.java    |   8 +-
 .../plan/nameresolver/ResolverByLegacy.java     |   6 +-
 .../tajo/plan/nameresolver/ResolverByRels.java  |   4 +-
 .../nameresolver/ResolverByRelsAndSubExprs.java |   4 +-
 .../nameresolver/ResolverBySubExprsAndRels.java |   4 +-
 .../plan/rewrite/rules/FilterPushDownRule.java  |   2 +-
 .../rewrite/rules/PartitionedTableRewriter.java |   2 +-
 .../tajo/plan/serder/EvalNodeDeserializer.java  |  12 +-
 .../org/apache/tajo/plan/util/PlannerUtil.java  |  17 +-
 .../tajo/plan/verifier/ExprsVerifier.java       |  12 +-
 .../tajo/plan/verifier/LogicalPlanVerifier.java |  29 +-
 .../plan/verifier/PreLogicalPlanVerifier.java   |  43 +-
 .../plan/verifier/SyntaxErrorException.java     |  29 +
 .../tajo/plan/verifier/SyntaxErrorUtil.java     |  54 +
 .../tajo/plan/verifier/VerificationState.java   |  16 +-
 .../plan/visitor/BasicLogicalPlanVisitor.java   |   2 +
 tajo-plan/src/main/proto/Plan.proto             | 125 +++
 tajo-project/pom.xml                            |   2 +-
 .../org/apache/tajo/rpc/AsyncRpcServer.java     |   6 +-
 .../tajo/storage/json/JsonLineDeserializer.java |   7 +-
 .../tajo/storage/json/JsonLineSerializer.java   |   5 +-
 .../tajo/storage/text/DelimitedLineReader.java  |   4 +-
 529 files changed, 15833 insertions(+), 16295 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tajo/blob/0028d7aa/CHANGES
----------------------------------------------------------------------
diff --cc CHANGES
index 7ad6d51,36cd9fc..4f61eb2
--- a/CHANGES
+++ b/CHANGES
@@@ -172,13 -177,9 +177,16 @@@ Release 0.11.0 - unrelease
  
    BUG FIXES
  
 +    TAJO-1608: Fix test failure in index_support branch. (jihoon)
 +
 +    TAJO-1594: Catalog schema is invalid for some databases. (jihoon)
 +
 +    TAJO-1657: Tajo Rest API /database/{database-name]/tables should return table 
 +    names only without invalid external table info. 
 +
+     TAJO-1689: Metrics file reporter prints histogram metric without group name.
+     (hyunsik)
+ 
      TAJO-1657: Tajo Rest API /database/{database-name]/tables should return 
      table names only without invalid external table info. 
      (Contributed by  DaeMyung Kang, Committed by jihoon)

http://git-wip-us.apache.org/repos/asf/tajo/blob/0028d7aa/tajo-catalog/tajo-catalog-client/src/main/java/org/apache/tajo/catalog/AbstractCatalogClient.java
----------------------------------------------------------------------
diff --cc tajo-catalog/tajo-catalog-client/src/main/java/org/apache/tajo/catalog/AbstractCatalogClient.java
index c872f8b,f7f7785..df07f4c
--- 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
@@@ -28,12 -31,11 +31,12 @@@ import org.apache.tajo.catalog.partitio
  import org.apache.tajo.catalog.proto.CatalogProtos.*;
  import org.apache.tajo.common.TajoDataTypes.DataType;
  import org.apache.tajo.conf.TajoConf;
- import org.apache.tajo.exception.InvalidOperationException;
- import org.apache.tajo.rpc.protocolrecords.PrimitiveProtos;
+ import org.apache.tajo.error.Errors.ResultCode;
+ import org.apache.tajo.exception.ReturnStateUtil;
  import org.apache.tajo.rpc.protocolrecords.PrimitiveProtos.NullProto;
+ import org.apache.tajo.rpc.protocolrecords.PrimitiveProtos.StringListResponse;
  import org.apache.tajo.util.ProtoUtil;
 +import org.apache.tajo.util.TUtil;
  
  import java.io.Closeable;
  import java.util.ArrayList;
@@@ -270,29 -315,18 +316,30 @@@ public abstract class AbstractCatalogCl
    }
  
    @Override
 +  public List<IndexDescProto> getAllIndexes() {
 +    try {
 +      CatalogProtocolService.BlockingInterface stub = getStub();
 +      GetIndexesProto response = stub.getAllIndexes(null, ProtoUtil.NULL_PROTO);
 +      return response.getIndexList();
 +    } catch (ServiceException e) {
 +      LOG.error(e.getMessage(), e);
 +      return null;
 +    }
 +  }
 +
 +  @Override
    public final PartitionMethodDesc getPartitionMethod(final String databaseName, final String tableName) {
+ 
      try {
-       TableIdentifierProto.Builder builder = TableIdentifierProto.newBuilder();
-       builder.setDatabaseName(databaseName);
-       builder.setTableName(tableName);
+       final BlockingInterface stub = getStub();
+       final TableIdentifierProto request = buildTableIdentifier(databaseName, tableName);
+       final GetPartitionMethodResponse response = stub.getPartitionMethodByTableName(null, request);
+       ensureOk(response.getState());
+ 
+       return CatalogUtil.newPartitionMethodDesc(response.getPartition());
  
-       CatalogProtocolService.BlockingInterface stub = getStub();
-       return CatalogUtil.newPartitionMethodDesc(stub.getPartitionMethodByTableName(null, builder.build()));
      } catch (ServiceException e) {
-       LOG.error(e.getMessage(), e);
-       return null;
+       throw new RuntimeException(e);
      }
    }
  
@@@ -471,45 -521,20 +534,37 @@@
    }
  
    @Override
 -  public boolean existIndexByColumn(final String databaseName, final String tableName, final String columnName) {
 +  public boolean existIndexByColumns(final String databaseName, final String tableName, final Column [] columns) {
 +    return existIndexByColumnNames(databaseName, tableName, extractColumnNames(columns));
 +  }
 +
 +  @Override
 +  public boolean existIndexByColumnNames(final String databaseName, final String tableName, final String [] columnNames) {
      try {
  
- //<<<<<<< HEAD
 -      final GetIndexByColumnRequest request = GetIndexByColumnRequest.newBuilder()
 -          .setTableIdentifier(buildTableIdentifier(databaseName, tableName))
 -          .setColumnName(columnName)
 -          .build();
 +      GetIndexByColumnNamesRequest.Builder builder = GetIndexByColumnNamesRequest.newBuilder();
 +      builder.setTableIdentifier(CatalogUtil.buildTableIdentifier(databaseName, tableName));
 +      for (String colunName : columnNames) {
 +        builder.addColumnNames(colunName);
 +      }
  
-       CatalogProtocolService.BlockingInterface stub = getStub();
-       return stub.existIndexByColumnNames(null, builder.build()).getValue();
+       final BlockingInterface stub = getStub();
+ 
 -      return isSuccess(stub.existIndexByColumn(null, request));
++      return isSuccess(stub.existIndexByColumnNames(null, builder.build()).getValue());
 +    } catch (ServiceException e) {
-       LOG.error(e.getMessage(), e);
-       return false;
++      throw new RuntimeException(e);
 +    }
 +  }
  
 +  @Override
 +  public boolean existIndexesByTable(final String databaseName, final String tableName) {
 +    try {
-       CatalogProtocolService.BlockingInterface stub = getStub();
-       return stub.existIndexesByTable(null, CatalogUtil.buildTableIdentifier(databaseName, tableName)).getValue();
- //=======
- //      GetIndexByColumnRequest.Builder builder = GetIndexByColumnRequest.newBuilder();
- //      builder.setTableIdentifier(CatalogUtil.buildTableIdentifier(databaseName, tableName));
- //      builder.setColumnName(columnName);
- //
- //      CatalogProtocolService.BlockingInterface stub = getStub();
- //      return stub.existIndexByColumn(null, builder.build()).getValue();
- //>>>>>>> 9b3824b5f0c64af42bfcf0a6bb8d3555c22c5746
++      final BlockingInterface stub = getStub();
++
++      return isSuccess(
++          stub.existIndexesByTable(null, CatalogUtil.buildTableIdentifier(databaseName, tableName)).getValue());
      } catch (ServiceException e) {
-       LOG.error(e.getMessage(), e);
-       return false;
+       throw new RuntimeException(e);
      }
    }
  
@@@ -528,97 -558,59 +588,78 @@@
      }
    }
  
 +  private static String[] extractColumnNames(Column[] columns) {
 +    String[] columnNames = new String [columns.length];
 +    for (int i = 0; i < columnNames.length; i++) {
 +      columnNames[i] = columns[i].getSimpleName();
 +    }
 +    return columnNames;
 +  }
 +
    @Override
 -  public final IndexDesc getIndexByColumn(final String databaseName,
 -                                          final String tableName,
 -                                          final String columnName) {
 -    try {
 +  public final IndexDesc getIndexByColumns(final String databaseName,
 +                                               final String tableName,
 +                                               final Column [] columns) {
 +    return getIndexByColumnNames(databaseName, tableName, extractColumnNames(columns));
 +  }
  
 -      final GetIndexByColumnRequest request = GetIndexByColumnRequest.newBuilder()
 -          .setTableIdentifier(buildTableIdentifier(databaseName, tableName))
 -          .setColumnName(columnName)
 -          .build();
 +  @Override
 +  public final IndexDesc getIndexByColumnNames(final String databaseName,
 +                                           final String tableName,
 +                                           final String [] columnNames) {
 +    try {
- //      GetIndexByColumnRequest.Builder builder = GetIndexByColumnRequest.newBuilder();
- //      builder.setTableIdentifier(CatalogUtil.buildTableIdentifier(databaseName, tableName));
- //      builder.setColumnName(columnName);
- //
- //<<<<<<< HEAD
 +      GetIndexByColumnNamesRequest.Builder builder = GetIndexByColumnNamesRequest.newBuilder();
 +      builder.setTableIdentifier(CatalogUtil.buildTableIdentifier(databaseName, tableName));
 +      for (String columnName : columnNames) {
 +        builder.addColumnNames(columnName);
 +      }
  
-       CatalogProtocolService.BlockingInterface stub = getStub();
-       return new IndexDesc(stub.getIndexByColumnNames(null, builder.build()));
+       final BlockingInterface stub = getStub();
 -      final GetIndexResponse response = stub.getIndexByColumn(null, request);
 -      ensureOk(response.getState());;
++      final GetIndexResponse response = stub.getIndexByColumnNames(null, builder.build());
++      ensureOk(response.getState());
+ 
+       return new IndexDesc(response.getIndex());
 -
      } catch (ServiceException e) {
-       LOG.error(e.getMessage(), e);
-       return null;
+       throw new RuntimeException(e);
      }
    }
  
    @Override
 -  public boolean dropIndex(final String dbName, final String indexName) {
 +  public final Collection<IndexDesc> getAllIndexesByTable(final String databaseName,
 +                                                          final String tableName) {
      try {
 -      final IndexNameProto request = IndexNameProto.newBuilder()
 -          .setDatabaseName(dbName)
 -          .setIndexName(indexName)
 -          .build();
 +      TableIdentifierProto proto = CatalogUtil.buildTableIdentifier(databaseName, tableName);
-       CatalogProtocolService.BlockingInterface stub = getStub();
-       GetAllIndexesResponse response = stub.getAllIndexesByTable(null, proto);
+ 
+       final BlockingInterface stub = getStub();
++      final GetAllIndexesResponse response = stub.getAllIndexesByTable(null, proto);
++      ensureOk(response.getState());
+ 
 -      return isSuccess(stub.dropIndex(null, request));
 -
 +      List<IndexDesc> indexDescs = TUtil.newList();
 +      for (IndexDescProto descProto : response.getIndexDescList()) {
 +        indexDescs.add(new IndexDesc(descProto));
 +      }
 +      return indexDescs;
- //=======
- //      CatalogProtocolService.BlockingInterface stub = getStub();
- //      return new IndexDesc(stub.getIndexByColumn(null, builder.build()));
- //>>>>>>> 9b3824b5f0c64af42bfcf0a6bb8d3555c22c5746
      } catch (ServiceException e) {
-       LOG.error(e.getMessage(), e);
-       return null;
+       throw new RuntimeException(e);
      }
    }
  
    @Override
-   public boolean dropIndex(final String databaseName,
-                            final String indexName) {
 -  public List<IndexProto> getAllIndexes() {
 -
++  public boolean dropIndex(final String dbName, final String indexName) {
      try {
-       IndexNameProto.Builder builder = IndexNameProto.newBuilder();
-       builder.setDatabaseName(databaseName);
-       builder.setIndexName(indexName);
++      final IndexNameProto request = IndexNameProto.newBuilder()
++          .setDatabaseName(dbName)
++          .setIndexName(indexName)
++          .build();
++
+       final BlockingInterface stub = getStub();
 -      final GetIndexesResponse response = stub.getAllIndexes(null, ProtoUtil.NULL_PROTO);
 -      ensureOk(response.getState());
+ 
 -      return response.getIndexList();
++      return isSuccess(stub.dropIndex(null, request));
  
-       CatalogProtocolService.BlockingInterface stub = getStub();
-       return stub.dropIndex(null, builder.build()).getValue();
      } catch (ServiceException e) {
-       LOG.error(e.getMessage(), e);
-       return false;
-     }
-   }
- //<<<<<<< HEAD
- //=======
- //
- //  @Override
- //  public List<IndexProto> getAllIndexes() {
- //    try {
- //      CatalogProtocolService.BlockingInterface stub = getStub();
- //      GetIndexesProto response = stub.getAllIndexes(null, ProtoUtil.NULL_PROTO);
- //      return response.getIndexList();
- //    } catch (ServiceException e) {
- //      LOG.error(e.getMessage(), e);
- //      return new ArrayList<IndexProto>();
- //    }
- //  }
- //>>>>>>> 9b3824b5f0c64af42bfcf0a6bb8d3555c22c5746
+       throw new RuntimeException(e);
+     }
+   }
  
    @Override
    public final boolean createFunction(final FunctionDesc funcDesc) {

http://git-wip-us.apache.org/repos/asf/tajo/blob/0028d7aa/tajo-catalog/tajo-catalog-client/src/main/proto/CatalogProtocol.proto
----------------------------------------------------------------------
diff --cc tajo-catalog/tajo-catalog-client/src/main/proto/CatalogProtocol.proto
index b845d82,8d0eef6..8b4b134
--- a/tajo-catalog/tajo-catalog-client/src/main/proto/CatalogProtocol.proto
+++ b/tajo-catalog/tajo-catalog-client/src/main/proto/CatalogProtocol.proto
@@@ -24,55 -24,118 +24,135 @@@ option java_generate_equals_and_hash = 
  import "CatalogProtos.proto";
  import "PrimitiveProtos.proto";
  
+ message GetTablespaceListResponse {
+   required ReturnState state = 1;
+   repeated TablespaceProto tablespace = 2;
+ }
+ 
+ message GetTablespaceResponse {
+   required ReturnState state = 1;
+   optional TablespaceProto tablespace = 2;
+ }
+ 
+ message GetDatabasesResponse {
+   required ReturnState state = 1;
+   repeated DatabaseProto database = 2;
+ }
+ 
+ message GetTablesResponse {
+   required ReturnState state = 1;
+   repeated TableDescriptorProto table = 2;
+ }
+ 
+ message GetTablePropertiesResponse {
+   required ReturnState state = 1;
+   repeated TableOptionProto properties = 2;
+ }
+ 
+ message GetTableStatsResponse {
+   required ReturnState state = 1;
+   repeated TableStatsProto stats = 2;
+ }
+ 
+ message GetColumnsResponse {
+   required ReturnState state = 1;
+   repeated ColumnProto column = 2;
+ }
+ 
+ message GetPartitionMethodResponse {
+   required ReturnState state = 1;
+   optional PartitionMethodProto partition = 2;
+ }
+ 
+ message GetPartitionDescResponse {
+   required ReturnState state = 1;
+   optional PartitionDescProto partition = 2;
+ }
+ 
 -message GetIndexResponse {
++message GetIndexeDescResponse {
+   required ReturnState state = 1;
+   optional IndexDescProto index = 2;
+ }
+ 
++message GetIndexByColumnNamesRequest {
++  required TableIdentifierProto tableIdentifier = 1;
++  repeated string columnNames = 2;
++}
++
+ message GetIndexesResponse {
+   required ReturnState state = 1;
 -  repeated IndexProto index = 2;
++  repeated IndexDescProto indexDesc = 2;
+ }
+ 
++//message GetIndexResponse {
++//  required ReturnState state = 1;
++//  optional IndexDescProto index = 2;
++//}
++//
++//message GetIndexesResponse {
++//  required ReturnState state = 1;
++//  repeated IndexProto index = 2;
++//}
++
+ message GetPartitionsResponse {
+   required ReturnState state = 1;
+   repeated PartitionDescProto partition = 2;
+ }
+ 
+ message GetTablePartitionsResponse {
+   required ReturnState state = 1;
+   repeated TablePartitionProto part = 2;
+ }
+ 
  service CatalogProtocolService {
  
-   rpc createTablespace(CreateTablespaceRequest) returns (BoolProto);
-   rpc dropTablespace(StringProto) returns (BoolProto);
-   rpc existTablespace(StringProto) returns (BoolProto);
-   rpc getAllTablespaces(NullProto) returns (GetTablespacesProto);
-   rpc getAllTablespaceNames(NullProto) returns (StringListProto);
-   rpc getTablespace(StringProto) returns (TablespaceProto);
-   rpc alterTablespace(AlterTablespaceProto) returns (BoolProto);
-   rpc alterTable(AlterTableDescProto) returns (BoolProto);
-   rpc updateTableStats(UpdateTableStatsProto) returns (BoolProto);
- 
-   rpc createDatabase(CreateDatabaseRequest) returns (BoolProto);
-   rpc dropDatabase(StringProto) returns (BoolProto);
-   rpc existDatabase(StringProto) returns (BoolProto);
-   rpc getAllDatabaseNames(NullProto) returns (StringListProto);
-   rpc getAllDatabases(NullProto) returns (GetDatabasesProto);
- 
-   rpc createTable(TableDescProto) returns (BoolProto);
-   rpc dropTable(TableIdentifierProto) returns (BoolProto);
-   rpc existsTable(TableIdentifierProto) returns (BoolProto);
-   rpc getTableDesc(TableIdentifierProto) returns (TableDescProto);
-   rpc getAllTableNames(StringProto) returns (StringListProto);
-   rpc getAllTables(NullProto) returns (GetTablesProto);
-   rpc getAllTableOptions(NullProto) returns (GetTableOptionsProto);
-   rpc getAllTableStats(NullProto) returns (GetTableStatsProto);
-   rpc getAllColumns(NullProto) returns (GetColumnsProto);
- 
-   rpc getPartitionMethodByTableName(TableIdentifierProto) returns (PartitionMethodProto);
-   rpc existPartitionMethod(TableIdentifierProto) returns (BoolProto);
-   rpc dropPartitionMethod(TableIdentifierProto) returns (BoolProto);
- 
-   rpc getPartitionByPartitionName(PartitionIdentifierProto) returns (PartitionDescProto);
-   rpc getPartitionsByTableName(PartitionIdentifierProto) returns (PartitionsProto);
-   rpc getAllPartitions(NullProto) returns (GetTablePartitionsProto);
- 
-   rpc createIndex(IndexDescProto) returns (BoolProto);
-   rpc dropIndex(IndexNameProto) returns (BoolProto);
-   rpc existIndexByName(IndexNameProto) returns (BoolProto);
-   rpc existIndexByColumnNames(GetIndexByColumnNamesRequest) returns (BoolProto);
-   rpc existIndexesByTable(TableIdentifierProto) returns (BoolProto);
+   rpc createTablespace(CreateTablespaceRequest) returns (ReturnState);
+   rpc dropTablespace(StringProto) returns (ReturnState);
+   rpc existTablespace(StringProto) returns (ReturnState);
+   rpc getAllTablespaces(NullProto) returns (GetTablespaceListResponse);
+   rpc getAllTablespaceNames(NullProto) returns (StringListResponse);
+   rpc getTablespace(StringProto) returns (GetTablespaceResponse);
+   rpc alterTablespace(AlterTablespaceProto) returns (ReturnState);
+   rpc alterTable(AlterTableDescProto) returns (ReturnState);
+   rpc updateTableStats(UpdateTableStatsProto) returns (ReturnState);
+ 
+   rpc createDatabase(CreateDatabaseRequest) returns (ReturnState);
+   rpc dropDatabase(StringProto) returns (ReturnState);
+   rpc existDatabase(StringProto) returns (ReturnState);
+   rpc getAllDatabaseNames(NullProto) returns (StringListResponse);
+   rpc getAllDatabases(NullProto) returns (GetDatabasesResponse);
+ 
+   rpc createTable(TableDescProto) returns (ReturnState);
+   rpc dropTable(TableIdentifierProto) returns (ReturnState);
+   rpc existsTable(TableIdentifierProto) returns (ReturnState);
+   rpc getTableDesc(TableIdentifierProto) returns (TableResponse);
+   rpc getAllTableNames(StringProto) returns (StringListResponse);
+   rpc getAllTables(NullProto) returns (GetTablesResponse);
+   rpc getAllTableProperties(NullProto) returns (GetTablePropertiesResponse);
+   rpc getAllTableStats(NullProto) returns (GetTableStatsResponse);
+   rpc getAllColumns(NullProto) returns (GetColumnsResponse);
+ 
+   rpc getPartitionMethodByTableName(TableIdentifierProto) returns (GetPartitionMethodResponse);
+   rpc existPartitionMethod(TableIdentifierProto) returns (ReturnState);
+   rpc dropPartitionMethod(TableIdentifierProto) returns (ReturnState);
+ 
+   rpc getPartitionByPartitionName(PartitionIdentifierProto) returns (GetPartitionDescResponse);
+   rpc getPartitionsByTableName(PartitionIdentifierProto) returns (GetPartitionsResponse);
+   rpc getAllPartitions(NullProto) returns (GetTablePartitionsResponse);
+ 
+   rpc createIndex(IndexDescProto) returns (ReturnState);
+   rpc dropIndex(IndexNameProto) returns (ReturnState);
+   rpc existIndexByName(IndexNameProto) returns (ReturnState);
 -  rpc existIndexByColumn(GetIndexByColumnRequest) returns (ReturnState);
 -  rpc getIndexByName(IndexNameProto) returns (GetIndexResponse);
 -  rpc getIndexByColumn(GetIndexByColumnRequest) returns (GetIndexResponse);
 -  rpc getAllIndexes(NullProto) returns (GetIndexesResponse);
++  rpc existIndexByColumnNames(GetIndexByColumnNamesRequest) returns (ReturnState);
++  rpc existIndexesByTable(TableIdentifierProto) returns (ReturnState);
 +  rpc getIndexByName(IndexNameProto) returns (IndexDescProto);
 +  rpc getIndexByColumnNames(GetIndexByColumnNamesRequest) returns (IndexDescProto);
 +  rpc getAllIndexesByTable(TableIdentifierProto) returns (GetAllIndexesResponse);
 +  rpc getAllIndexes(NullProto) returns (GetIndexesProto);
  
-   rpc createFunction(FunctionDescProto) returns (BoolProto);
-   rpc dropFunction(UnregisterFunctionRequest) returns (BoolProto);
+   rpc createFunction(FunctionDescProto) returns (ReturnState);
+   rpc dropFunction(UnregisterFunctionRequest) returns (ReturnState);
    rpc getFunctions(NullProto) returns (GetFunctionsResponse);
-   rpc getFunctionMeta(GetFunctionMetaRequest) returns (FunctionDescProto);
-   rpc containFunction(ContainFunctionRequest) returns (BoolProto);
+   rpc getFunctionMeta(GetFunctionMetaRequest) returns (FunctionResponse);
+   rpc containFunction(ContainFunctionRequest) returns (ReturnState);
  }

http://git-wip-us.apache.org/repos/asf/tajo/blob/0028d7aa/tajo-catalog/tajo-catalog-common/src/main/java/org/apache/tajo/catalog/CatalogService.java
----------------------------------------------------------------------
diff --cc tajo-catalog/tajo-catalog-common/src/main/java/org/apache/tajo/catalog/CatalogService.java
index c356097,5dc5412..3d56a7a
--- a/tajo-catalog/tajo-catalog-common/src/main/java/org/apache/tajo/catalog/CatalogService.java
+++ b/tajo-catalog/tajo-catalog-common/src/main/java/org/apache/tajo/catalog/CatalogService.java
@@@ -18,8 -18,9 +18,10 @@@
  
  package org.apache.tajo.catalog;
  
+ import org.apache.tajo.catalog.exception.UndefinedFunctionException;
+ import org.apache.tajo.catalog.exception.UndefinedPartitionException;
  import org.apache.tajo.catalog.partition.PartitionMethodDesc;
 +import org.apache.tajo.catalog.proto.CatalogProtos.*;
  import org.apache.tajo.catalog.proto.CatalogProtos;
  import org.apache.tajo.catalog.proto.CatalogProtos.ColumnProto;
  import org.apache.tajo.catalog.proto.CatalogProtos.DatabaseProto;

http://git-wip-us.apache.org/repos/asf/tajo/blob/0028d7aa/tajo-catalog/tajo-catalog-common/src/main/java/org/apache/tajo/catalog/CatalogUtil.java
----------------------------------------------------------------------
diff --cc tajo-catalog/tajo-catalog-common/src/main/java/org/apache/tajo/catalog/CatalogUtil.java
index 1247482,87bd972..0e5776e
--- 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
@@@ -27,8 -27,8 +27,9 @@@ import org.apache.tajo.catalog.partitio
  import org.apache.tajo.catalog.partition.PartitionMethodDesc;
  import org.apache.tajo.catalog.proto.CatalogProtos;
  import org.apache.tajo.catalog.proto.CatalogProtos.SchemaProto;
 +import org.apache.tajo.catalog.proto.CatalogProtos.StoreType;
  import org.apache.tajo.catalog.proto.CatalogProtos.TableDescProto;
+ import org.apache.tajo.catalog.proto.CatalogProtos.TableIdentifierProto;
  import org.apache.tajo.catalog.proto.CatalogProtos.PartitionKeyProto;
  import org.apache.tajo.common.TajoDataTypes;
  import org.apache.tajo.common.TajoDataTypes.DataType;
@@@ -43,8 -43,12 +44,11 @@@ import java.sql.Connection
  import java.sql.ResultSet;
  import java.sql.SQLException;
  import java.sql.Statement;
- import java.util.*;
+ import java.util.HashSet;
+ import java.util.List;
+ import java.util.Map;
+ import java.util.Set;
  
 -import static org.apache.tajo.catalog.proto.CatalogProtos.StoreType;
  import static org.apache.tajo.common.TajoDataTypes.Type;
  
  public class CatalogUtil {

http://git-wip-us.apache.org/repos/asf/tajo/blob/0028d7aa/tajo-catalog/tajo-catalog-common/src/main/proto/CatalogProtos.proto
----------------------------------------------------------------------
diff --cc tajo-catalog/tajo-catalog-common/src/main/proto/CatalogProtos.proto
index 511f595,d0cf238..90888d7
--- a/tajo-catalog/tajo-catalog-common/src/main/proto/CatalogProtos.proto
+++ b/tajo-catalog/tajo-catalog-common/src/main/proto/CatalogProtos.proto
@@@ -134,40 -133,20 +134,10 @@@ enum IndexMethod 
    BITMAP_IDX = 3;
  }
  
- message GetAllTableNamesResponse {
-   repeated string tableName = 1;
- }
- 
- message GetTablespacesProto {
-   repeated TablespaceProto tablespace = 1;
- }
- 
- message GetDatabasesProto {
-   repeated DatabaseProto database = 1;
- }
- 
- message GetTablesProto {
-   repeated TableDescriptorProto table = 1;
- }
- 
- message GetColumnsProto {
-   repeated ColumnProto column = 1;
- }
- 
--message GetIndexesProto {
-   repeated IndexDescProto index = 1;
- }
- 
- message GetTableOptionsProto {
-   repeated TableOptionProto tableOption = 1;
- }
- 
- message GetTableStatsProto {
-   repeated TableStatsProto stat = 1;
 -  repeated IndexProto index = 1;
--}
--
- message GetTablePartitionsProto {
-   repeated TablePartitionProto part = 1;
 -message IndexProto {
 -  required int32 dbId = 1;
 -  required int32 tId = 2;
++message IndexNameProto {
++  required string databaseName = 1;
++  optional string namespace = 2;
+   required string indexName = 3;
 -  required string columnName = 4;
 -  required string dataType = 5;
 -  required string indexType = 6;
 -  optional bool isUnique = 7 [default = false];
 -  optional bool isClustered = 8 [default = false];
 -  optional bool isAscending = 9 [default = false];
  }
  
  message TableOptionProto {
@@@ -182,21 -161,17 +152,6 @@@ message TablePartitionProto 
    optional string path = 4;
  }
  
- message GetIndexByColumnNamesRequest {
 -message GetIndexByColumnRequest {
--  required TableIdentifierProto tableIdentifier = 1;
-   repeated string columnNames = 2;
 -  required string columnName = 2;
--}
--
--message IndexNameProto {
--  required string databaseName = 1;
--  optional string namespace = 2;
--  required string indexName = 3;
- }
- 
- message GetAllIndexesResponse {
-   repeated IndexDescProto indexDesc = 1;
--}
--
  message GetFunctionsResponse {
    repeated FunctionDescProto functionDesc = 1;
  }

http://git-wip-us.apache.org/repos/asf/tajo/blob/0028d7aa/tajo-catalog/tajo-catalog-drivers/tajo-hive/src/main/java/org/apache/tajo/catalog/store/HiveCatalogStore.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/tajo/blob/0028d7aa/tajo-catalog/tajo-catalog-server/src/main/java/org/apache/tajo/catalog/CatalogServer.java
----------------------------------------------------------------------
diff --cc tajo-catalog/tajo-catalog-server/src/main/java/org/apache/tajo/catalog/CatalogServer.java
index c9f38e1,6a3fc16..68f9576
--- 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
@@@ -957,8 -1106,7 +1106,8 @@@ public class CatalogServer extends Abst
      }
  
      @Override
-     public BoolProto existIndexByColumnNames(RpcController controller, GetIndexByColumnNamesRequest request)
 -    public ReturnState existIndexByColumn(RpcController controller, GetIndexByColumnRequest request) {
++    public ReturnState existIndexByColumnNames(RpcController controller, GetIndexByColumnNamesRequest request)
 +        throws ServiceException {
  
        TableIdentifierProto identifier = request.getTableIdentifier();
        String databaseName = identifier.getDatabaseName();
@@@ -967,29 -1115,13 +1116,27 @@@
  
        rlock.lock();
        try {
 -        return store.existIndexByColumn(databaseName, tableName, columnName) ?
 -            OK : errUndefinedIndex(tableName, columnName);
 -
 +        return store.existIndexByColumns(databaseName, tableName,
-             columnNames.toArray(new String[columnNames.size()])) ?
-             ProtoUtil.TRUE : ProtoUtil.FALSE;
-       } catch (Exception e) {
-         LOG.error(e);
-         return BoolProto.newBuilder().setValue(false).build();
++            columnNames.toArray(new String[columnNames.size()])) ? OK : errUndefinedIndex(tableName, columnNames);
+       } catch (Throwable t) {
+         printStackTraceIfError(LOG, t);
+         return returnError(t);
 +      } finally {
 +        rlock.unlock();
 +      }
 +    }
 +
 +    @Override
-     public BoolProto existIndexesByTable(RpcController controller, TableIdentifierProto request) throws ServiceException {
++    public ReturnState existIndexesByTable(RpcController controller, TableIdentifierProto request) throws ServiceException {
 +      String databaseName = request.getDatabaseName();
 +      String tableName = request.getTableName();
  
 +      rlock.lock();
 +      try {
-         return store.existIndexesByTable(databaseName, tableName) ?
-             ProtoUtil.TRUE : ProtoUtil.FALSE;
-       } catch (Exception e) {
-         LOG.error(e, e);
-         return BoolProto.newBuilder().setValue(false).build();
++        return store.existIndexesByTable(databaseName, tableName) ? OK : errUndefinedIndex(tableName);
++      } catch (Throwable t) {
++        printStackTraceIfError(LOG, t);
++        return returnError(t);
        } finally {
          rlock.unlock();
        }
@@@ -1017,7 -1161,7 +1176,7 @@@
      }
  
      @Override
-     public IndexDescProto getIndexByColumnNames(RpcController controller, GetIndexByColumnNamesRequest request)
 -    public GetIndexResponse getIndexByColumn(RpcController controller, GetIndexByColumnRequest request)
++    public GetIndexResponse getIndexByColumnNames(RpcController controller, GetIndexByColumnNamesRequest request)
          throws ServiceException {
  
        TableIdentifierProto identifier = request.getTableIdentifier();
@@@ -1029,48 -1171,24 +1188,59 @@@
  
        rlock.lock();
        try {
 -        if (!store.existIndexByColumn(databaseName, tableName, columnName)) {
 +        if (!store.existIndexByColumns(databaseName, tableName, columnNames)) {
-           throw new NoSuchIndexException(databaseName, columnNames);
+           return GetIndexResponse.newBuilder()
+               .setState(errUndefinedIndex(tableName, columnName))
+               .build();
          }
-         return store.getIndexByColumns(databaseName, tableName, columnNames);
-       } catch (Exception e) {
-         LOG.error("ERROR: cannot get index for " + tableName + "." + columnNames, e);
-         return null;
 -
+         return GetIndexResponse.newBuilder()
+             .setState(OK)
+             .setIndex(store.getIndexByColumn(databaseName, tableName, columnName))
+             .build();
++      }  catch (Throwable t) {
++        printStackTraceIfError(LOG, t);
++
++        return GetIndexResponse.newBuilder()
++            .setState(returnError(t))
++            .build();
 +      } finally {
 +        rlock.unlock();
 +      }
 +    }
 +
 +    @Override
 +    public GetAllIndexesResponse getAllIndexesByTable(RpcController controller, TableIdentifierProto request)
 +        throws ServiceException {
 +      rlock.lock();
 +      String databaseName = request.getDatabaseName();
 +      String tableName = request.getTableName();
 +      try {
 +        GetAllIndexesResponse.Builder builder = GetAllIndexesResponse.newBuilder();
 +        for (String eachIndexName : store.getAllIndexNamesByTable(databaseName, tableName)) {
 +          builder.addIndexDesc(store.getIndexByName(databaseName, eachIndexName));
 +        }
 +        return builder.build();
 +      } catch (Exception e) {
 +        LOG.error("ERROR: cannot get all indexes for " + databaseName + "." + tableName, e);
 +        return null;
 +      } finally {
 +        rlock.unlock();
 +      }
 +    }
 +
 +    @Override
-     public GetIndexesProto getAllIndexes(RpcController controller, NullProto request) throws ServiceException {
++    public GetIndexesResponse getAllIndexes(RpcController controller, NullProto request) throws ServiceException {
 +      rlock.lock();
 +      try {
-         GetIndexesProto.Builder builder = GetIndexesProto.newBuilder();
-         builder.addAllIndex(store.getAllIndexes());
-         return builder.build();
-       } catch (Exception e) {
-         LOG.error("ERROR: cannot get all indexes", e);
-         return null;
++        return GetIndexesResponse.newBuilder().addAllIndex(store.getAllIndexes()).build();
+ 
+       } catch (Throwable t) {
+         printStackTraceIfError(LOG, t);
+ 
 -        return GetIndexResponse.newBuilder()
++        return GetIndexesResponse.newBuilder()
+             .setState(returnError(t))
+             .build();
+ 
        } finally {
          rlock.unlock();
        }
@@@ -1094,13 -1216,25 +1268,7 @@@
        } finally {
          wlock.unlock();
        }
- 
-       return BOOL_TRUE;
-     }
- 
-     public boolean checkIfBuiltin(FunctionType type) {
-       return type == GENERAL || type == AGGREGATION || type == DISTINCT_AGGREGATION;
      }
 -    
 -    @Override
 -    public GetIndexesResponse getAllIndexes(RpcController controller, NullProto request) throws ServiceException {
 -      rlock.lock();
 -      try {
 -        return GetIndexesResponse.newBuilder().addAllIndex(store.getAllIndexes()).build();
 -
 -      } catch (Throwable t) {
 -        printStackTraceIfError(LOG, t);
 -
 -        return GetIndexesResponse.newBuilder()
 -            .setState(returnError(t))
 -            .build();
 -
 -      } finally {
 -        rlock.unlock();
 -      }
 -    }
  
      private boolean containFunction(String signature) {
        List<FunctionDescProto> found = findFunction(signature);

http://git-wip-us.apache.org/repos/asf/tajo/blob/0028d7aa/tajo-catalog/tajo-catalog-server/src/main/java/org/apache/tajo/catalog/store/AbstractDBStore.java
----------------------------------------------------------------------
diff --cc tajo-catalog/tajo-catalog-server/src/main/java/org/apache/tajo/catalog/store/AbstractDBStore.java
index 9c70dba,c6b7d36..5dd2b68
--- 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
@@@ -2312,10 -2293,9 +2308,10 @@@ public abstract class AbstractDBStore e
        resultToIndexDescProtoBuilder(builder, res);
        String tableName = getTableName(conn, res.getInt(COL_TABLES_PK));
        builder.setTableIdentifier(CatalogUtil.buildTableIdentifier(databaseName, tableName));
 +      builder.setTargetRelationSchema(getTable(databaseName, tableName).getSchema());
        proto = builder.build();
      } catch (SQLException se) {
-       throw new CatalogException(se);
+       throw new TajoInternalError(se);
      } finally {
        CatalogUtil.closeQuietly(pstmt, res);
      }
@@@ -2351,20 -2324,18 +2347,24 @@@
        conn = getConnection();
        pstmt = conn.prepareStatement(sql);
        pstmt.setInt(1, databaseId);
 -      ;
 -      pstmt.setString(2, columnName);
 +      pstmt.setInt(2, tableId);
 +      pstmt.setString(3, unifiedName);
        res = pstmt.executeQuery();
        if (!res.next()) {
++<<<<<<< HEAD
 +        throw new CatalogException("ERROR: there is no index matched to " + unifiedName);
++=======
+         throw new TajoInternalError("ERROR: there is no index matched to " + columnName);
++>>>>>>> c50a5dadff90fa90709abbce59856e834baa4867
        }
 +
        IndexDescProto.Builder builder = IndexDescProto.newBuilder();
        resultToIndexDescProtoBuilder(builder, res);
        builder.setTableIdentifier(CatalogUtil.buildTableIdentifier(databaseName, tableName));
 +      builder.setTargetRelationSchema(tableDescProto.getSchema());
        proto = builder.build();
      } catch (SQLException se) {
-       throw new CatalogException(se);
+       throw new TajoInternalError(se);
      } finally {
        CatalogUtil.closeQuietly(pstmt, res);
      }
@@@ -2471,58 -2437,57 +2471,58 @@@
        res = pstmt.executeQuery();
  
        while (res.next()) {
 -        IndexDescProto.Builder builder = IndexDescProto.newBuilder();
 -        resultToIndexDescProtoBuilder(builder, res);
 -        builder.setTableIdentifier(tableIdentifier);
 -        protos.add(builder.build());
 +        indexNames.add(res.getString("index_name"));
        }
      } catch (SQLException se) {
-       throw new CatalogException(se);
+       throw new TajoInternalError(se);
      } finally {
        CatalogUtil.closeQuietly(pstmt, res);
      }
  
 -    return protos.toArray(new IndexDescProto[protos.size()]);
 +    return indexNames;
    }
 -  
 -  @Override
 -  public List<IndexProto> getAllIndexes() throws CatalogException {
 -    Connection conn = null;
 -    Statement stmt = null;
 -    ResultSet resultSet = null;
  
 -    List<IndexProto> indexes = new ArrayList<IndexProto>();
 +  @Override
 +  public boolean existIndexesByTable(String databaseName, String tableName) throws CatalogException {
 +    ResultSet res = null;
 +    PreparedStatement pstmt = null;
 +    final List<String> indexNames = new ArrayList<String>();
  
      try {
 -      String sql = "SELECT " + COL_DATABASES_PK + ", " + COL_TABLES_PK + ", INDEX_NAME, " +
 -        "COLUMN_NAME, DATA_TYPE, INDEX_TYPE, IS_UNIQUE, IS_CLUSTERED, IS_ASCENDING FROM " + TB_INDEXES;
 +      final int databaseId = getDatabaseId(databaseName);
 +      final int tableId = getTableId(databaseId, databaseName, tableName);
  
 -      conn = getConnection();
 -      stmt = conn.createStatement();
 -      resultSet = stmt.executeQuery(sql);
 -      while (resultSet.next()) {
 -        IndexProto.Builder builder = IndexProto.newBuilder();
 -        
 -        builder.setDbId(resultSet.getInt(COL_DATABASES_PK));
 -        builder.setTId(resultSet.getInt(COL_TABLES_PK));
 -        builder.setIndexName(resultSet.getString("INDEX_NAME"));
 -        builder.setColumnName(resultSet.getString("COLUMN_NAME"));
 -        builder.setDataType(resultSet.getString("DATA_TYPE"));
 -        builder.setIndexType(resultSet.getString("INDEX_TYPE"));
 -        builder.setIsUnique(resultSet.getBoolean("IS_UNIQUE"));
 -        builder.setIsClustered(resultSet.getBoolean("IS_CLUSTERED"));
 -        builder.setIsAscending(resultSet.getBoolean("IS_ASCENDING"));
 -        
 -        indexes.add(builder.build());
 +      String sql = GET_INDEXES_SQL + " WHERE " + COL_DATABASES_PK + "=? AND " + COL_TABLES_PK + "=?";
 +
 +      if (LOG.isDebugEnabled()) {
 +        LOG.debug(sql);
        }
 +
 +      conn = getConnection();
 +      pstmt = conn.prepareStatement(sql);
 +      pstmt.setInt(1, databaseId);
 +      pstmt.setInt(2, tableId);
 +      res = pstmt.executeQuery();
 +
 +      return res.next();
      } catch (SQLException se) {
-       throw new CatalogException(se);
+       throw new TajoInternalError(se);
      } finally {
 -      CatalogUtil.closeQuietly(stmt, resultSet);
 +      CatalogUtil.closeQuietly(pstmt, res);
      }
 -    
 -    return indexes;
 +  }
 +
 +  @Override
 +  public List<IndexDescProto> getAllIndexes() throws CatalogException {
 +    List<IndexDescProto> indexDescProtos = TUtil.newList();
 +    for (String databaseName : getAllDatabaseNames()) {
 +      for (String tableName : getAllTableNames(databaseName)) {
 +        for (String indexName: getAllIndexNamesByTable(databaseName, tableName)) {
 +          indexDescProtos.add(getIndexByName(databaseName, indexName));
 +        }
 +      }
 +    }
 +    return indexDescProtos;
    }
  
    private void resultToIndexDescProtoBuilder(IndexDescProto.Builder builder,

http://git-wip-us.apache.org/repos/asf/tajo/blob/0028d7aa/tajo-catalog/tajo-catalog-server/src/main/java/org/apache/tajo/catalog/store/CatalogStore.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/tajo/blob/0028d7aa/tajo-catalog/tajo-catalog-server/src/main/java/org/apache/tajo/catalog/store/MemStore.java
----------------------------------------------------------------------
diff --cc tajo-catalog/tajo-catalog-server/src/main/java/org/apache/tajo/catalog/store/MemStore.java
index 5f226b4,5763f31..433a309
--- 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
@@@ -164,11 -161,9 +164,11 @@@ public class MemStore implements Catalo
    @Override
    public void dropDatabase(String databaseName) throws CatalogException {
      if (!databases.containsKey(databaseName)) {
-       throw new NoSuchDatabaseException(databaseName);
+       throw new UndefinedDatabaseException(databaseName);
      }
      databases.remove(databaseName);
 +    indexes.remove(databaseName);
 +    indexesByColumn.remove(databaseName);
    }
  
    @Override
@@@ -618,10 -612,9 +618,10 @@@
  
      Map<String, IndexDescProto> index = checkAndGetDatabaseNS(indexes, databaseName);
      Map<String, IndexDescProto> indexByColumn = checkAndGetDatabaseNS(indexesByColumn, databaseName);
 +    TableDescProto tableDescProto = getTable(databaseName, tableName);
  
      if (index.containsKey(proto.getIndexName())) {
-       throw new AlreadyExistsIndexException(proto.getIndexName());
+       throw new DuplicateIndexException(proto.getIndexName());
      }
  
      index.put(proto.getIndexName(), proto);
@@@ -639,19 -628,10 +639,19 @@@
    @Override
    public void dropIndex(String databaseName, String indexName) throws CatalogException {
      Map<String, IndexDescProto> index = checkAndGetDatabaseNS(indexes, databaseName);
 +    Map<String, IndexDescProto> indexByColumn = checkAndGetDatabaseNS(indexesByColumn, databaseName);
      if (!index.containsKey(indexName)) {
-       throw new NoSuchIndexException(indexName);
+       throw new UndefinedIndexException(indexName);
      }
 +    IndexDescProto proto = index.get(indexName);
 +    final String tableName = CatalogUtil.extractSimpleName(proto.getTableIdentifier().getTableName());
 +    TableDescProto tableDescProto = getTable(databaseName, tableName);
      index.remove(indexName);
 +    String originalTableName = proto.getTableIdentifier().getTableName();
 +    String simpleTableName = CatalogUtil.extractSimpleName(originalTableName);
 +    indexByColumn.remove(CatalogUtil.buildFQName(proto.getTableIdentifier().getDatabaseName(),
 +        simpleTableName,
 +        getUnifiedNameForIndexByColumn(proto)));
    }
  
    /* (non-Javadoc)
@@@ -667,18 -647,19 +667,23 @@@
      return index.get(indexName);
    }
  
 -  /* (non-Javadoc)
 -   * @see CatalogStore#getIndexByName(java.lang.String, java.lang.String)
 -   */
    @Override
 -  public IndexDescProto getIndexByColumn(String databaseName, String tableName, String columnName)
 -      throws CatalogException {
 -
 +  public IndexDescProto getIndexByColumns(String databaseName, String tableName, String[] columnNames) throws CatalogException {
      Map<String, IndexDescProto> indexByColumn = checkAndGetDatabaseNS(indexesByColumn, databaseName);
++<<<<<<< HEAD
 +    String simpleTableName = CatalogUtil.extractSimpleName(tableName);
 +    TableDescProto tableDescProto = getTable(databaseName, simpleTableName);
 +    String qualifiedColumnName = CatalogUtil.buildFQName(databaseName, simpleTableName,
 +        CatalogUtil.getUnifiedSimpleColumnName(new Schema(tableDescProto.getSchema()), columnNames));
 +    if (!indexByColumn.containsKey(qualifiedColumnName)) {
 +      throw new NoSuchIndexException(qualifiedColumnName);
++=======
+     if (!indexByColumn.containsKey(columnName)) {
+       throw new UndefinedIndexException(CatalogUtil.buildFQName(databaseName, tableName), columnName);
++>>>>>>> c50a5dadff90fa90709abbce59856e834baa4867
      }
  
 -    return indexByColumn.get(columnName);
 +    return indexByColumn.get(qualifiedColumnName);
    }
  
    @Override

http://git-wip-us.apache.org/repos/asf/tajo/blob/0028d7aa/tajo-catalog/tajo-catalog-server/src/test/java/org/apache/tajo/catalog/TestCatalog.java
----------------------------------------------------------------------
diff --cc tajo-catalog/tajo-catalog-server/src/test/java/org/apache/tajo/catalog/TestCatalog.java
index aa1f1a0,6020e83..6872b59
--- a/tajo-catalog/tajo-catalog-server/src/test/java/org/apache/tajo/catalog/TestCatalog.java
+++ b/tajo-catalog/tajo-catalog-server/src/test/java/org/apache/tajo/catalog/TestCatalog.java
@@@ -23,8 -24,9 +23,8 @@@ import org.apache.hadoop.fs.Path
  import org.apache.tajo.TajoConstants;
  import org.apache.tajo.catalog.dictionary.InfoSchemaMetadataDictionary;
  import org.apache.tajo.catalog.exception.CatalogException;
- import org.apache.tajo.catalog.exception.NoSuchFunctionException;
+ import org.apache.tajo.catalog.exception.UndefinedFunctionException;
  import org.apache.tajo.catalog.partition.PartitionDesc;
 -import org.apache.tajo.catalog.store.PostgreSQLStore;
  import org.apache.tajo.catalog.partition.PartitionMethodDesc;
  import org.apache.tajo.catalog.proto.CatalogProtos;
  import org.apache.tajo.catalog.proto.CatalogProtos.FunctionType;

http://git-wip-us.apache.org/repos/asf/tajo/blob/0028d7aa/tajo-cli/src/main/java/org/apache/tajo/cli/tsql/TajoCli.java
----------------------------------------------------------------------
diff --cc tajo-cli/src/main/java/org/apache/tajo/cli/tsql/TajoCli.java
index 2ed38c0,bc5fa7a..6ceb4b6
--- a/tajo-cli/src/main/java/org/apache/tajo/cli/tsql/TajoCli.java
+++ b/tajo-cli/src/main/java/org/apache/tajo/cli/tsql/TajoCli.java
@@@ -490,7 -491,7 +491,11 @@@ public class TajoCli 
      ClientProtos.SubmitQueryResponse response = client.executeQueryWithJson(json);
      if (response == null) {
        onError("response is null", null);
++<<<<<<< HEAD
 +    } else if (response.getResult().getResultCode() == ClientProtos.ResultCode.OK) {
++=======
+     } else if (ReturnStateUtil.isSuccess(response.getState())) {
++>>>>>>> c50a5dadff90fa90709abbce59856e834baa4867
        if (response.getIsForwarded()) {
          QueryId queryId = new QueryId(response.getQueryId());
          waitForQueryCompleted(queryId);
@@@ -503,8 -504,8 +508,13 @@@
          }
        }
      } else {
++<<<<<<< HEAD
 +      if (response.getResult().hasErrorMessage()) {
 +        onError(response.getResult().getErrorMessage(), null);
++=======
+       if (ReturnStateUtil.isError(response.getState())) {
+         onError(response.getState().getMessage(), null);
++>>>>>>> c50a5dadff90fa90709abbce59856e834baa4867
        }
      }
    }
@@@ -519,22 -520,22 +529,41 @@@
        onError(null, te);
      }
  
++<<<<<<< HEAD
 +    if (response == null) {
 +      onError("response is null", null);
 +    } else if (response.getResult().getResultCode() == ClientProtos.ResultCode.OK) {
 +      if (response.getIsForwarded()) {
 +        QueryId queryId = new QueryId(response.getQueryId());
 +        waitForQueryCompleted(queryId);
 +      } else {
 +        if (!response.hasTableDesc() && !response.hasResultSet()) {
 +          displayFormatter.printMessage(sout, "OK");
++=======
+     if (response != null) {
+       if (ReturnStateUtil.isSuccess(response.getState())) {
+         if (response.getIsForwarded()) {
+           QueryId queryId = new QueryId(response.getQueryId());
+           waitForQueryCompleted(queryId);
++>>>>>>> c50a5dadff90fa90709abbce59856e834baa4867
          } else {
-           localQueryCompleted(response, startTime);
+           if (!response.hasTableDesc() && !response.hasResultSet()) {
+             displayFormatter.printMessage(sout, "OK");
+           } else {
+             localQueryCompleted(response, startTime);
+           }
          }
+       } else {
+         if (ReturnStateUtil.isError(response.getState())) {
+           onError(response.getState().getMessage(), null);
+         }
++<<<<<<< HEAD
 +      }
 +    } else {
 +      if (response.getResult().hasErrorMessage()) {
 +        onError(response.getResult().getErrorMessage(), null);
++=======
++>>>>>>> c50a5dadff90fa90709abbce59856e834baa4867
        }
      }
  

http://git-wip-us.apache.org/repos/asf/tajo/blob/0028d7aa/tajo-client/src/main/java/org/apache/tajo/client/CatalogAdminClient.java
----------------------------------------------------------------------
diff --cc tajo-client/src/main/java/org/apache/tajo/client/CatalogAdminClient.java
index 86d1622,c020ef5..1044cc9
--- a/tajo-client/src/main/java/org/apache/tajo/client/CatalogAdminClient.java
+++ b/tajo-client/src/main/java/org/apache/tajo/client/CatalogAdminClient.java
@@@ -18,9 -18,7 +18,8 @@@
  
  package org.apache.tajo.client;
  
- import com.google.protobuf.ServiceException;
  import org.apache.tajo.annotation.Nullable;
 +import org.apache.tajo.catalog.IndexMeta;
  import org.apache.tajo.catalog.Schema;
  import org.apache.tajo.catalog.TableDesc;
  import org.apache.tajo.catalog.TableMeta;
@@@ -132,22 -130,9 +132,27 @@@ public interface CatalogAdminClient ext
     *
     * @param tableName The table name to get. This name is case sensitive.
     * @return Table description
+    * @throws java.sql.SQLException
     */
-   public TableDesc getTableDesc(final String tableName) throws ServiceException;
+   TableDesc getTableDesc(final String tableName) throws SQLException;
  
++<<<<<<< HEAD
 +  public List<CatalogProtos.FunctionDescProto> getFunctions(final String functionName) throws ServiceException;
 +
 +  public IndexDescProto getIndex(final String indexName) throws ServiceException;
 +
 +  public boolean existIndex(final String indexName) throws ServiceException;
 +
 +  public List<IndexDescProto> getIndexes(final String tableName) throws ServiceException;
 +
 +  public boolean hasIndexes(final String tableName) throws ServiceException;
 +
 +  public IndexDescProto getIndex(final String tableName, final String[] columnNames) throws ServiceException;
 +
 +  public boolean existIndex(final String tableName, final String[] columnName) throws ServiceException;
 +
 +  public boolean dropIndex(final String indexName) throws ServiceException;
++=======
+   List<CatalogProtos.FunctionDescProto> getFunctions(final String functionName) throws SQLException;
++>>>>>>> c50a5dadff90fa90709abbce59856e834baa4867
  }


Mime
View raw message