mirror of
https://github.com/apache/impala.git
synced 2025-12-19 18:12:08 -05:00
This changes the Thrift from 0.6.1 to 0.7.0. Please uninstall the old thrift and download/install Thrift 0.7.0.
Beeswax service now depends on Hive metastore; fix buildall.sh to clean generated-source in FE; fix .gitignore to clean generated-source in BE;
This commit is contained in:
2
be/.gitignore
vendored
2
be/.gitignore
vendored
@@ -1,5 +1,5 @@
|
||||
*~
|
||||
|
||||
build
|
||||
generated-sources
|
||||
generated-sources/**/*
|
||||
|
||||
|
||||
@@ -27,6 +27,8 @@ set(SRC_FILES
|
||||
Descriptors_types.cpp
|
||||
Exprs_constants.cpp
|
||||
Exprs_types.cpp
|
||||
hive_metastore_constants.cpp
|
||||
hive_metastore_types.cpp
|
||||
Opcodes_constants.cpp
|
||||
Opcodes_types.cpp
|
||||
PlanNodes_constants.cpp
|
||||
|
||||
0
be/generated-sources/impala-ir/.gitignore
vendored
Normal file
0
be/generated-sources/impala-ir/.gitignore
vendored
Normal file
@@ -110,7 +110,7 @@ Status InProcessQueryExecutor::Exec(const string& query, vector<PrimitiveType>*
|
||||
COUNTER_SCOPED_TIMER(plan_gen_counter);
|
||||
CHECK(client_.get() != NULL) << "didn't call InProcessQueryExecutor::Setup()";
|
||||
client_->GetExecRequest(query_request_, query.c_str(), FLAGS_num_nodes);
|
||||
} catch (::apache::thrift::TException& e) {
|
||||
} catch (TImpalaPlanServiceException& e) {
|
||||
return Status(e.what());
|
||||
}
|
||||
VLOG(1) << "query request:\n" << ThriftDebugString(query_request_);
|
||||
@@ -273,7 +273,7 @@ void InProcessQueryExecutor::Shutdown() {
|
||||
// shut down server we started ourselves
|
||||
try {
|
||||
client_->ShutdownServer();
|
||||
} catch (TException& e) {
|
||||
} catch (TImpalaPlanServiceException& e) {
|
||||
// ignore; the server just quit, so won't respond to the rpc
|
||||
}
|
||||
}
|
||||
@@ -298,7 +298,7 @@ Status InProcessQueryExecutor::Explain(const string& query, string* explain_plan
|
||||
try {
|
||||
client_->GetExplainString(*explain_plan, query, 0);
|
||||
return Status::OK;
|
||||
} catch (TException& e) {
|
||||
} catch (TImpalaPlanServiceException& e) {
|
||||
return Status(e.what());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -85,6 +85,7 @@ then
|
||||
rm -rf target
|
||||
rm -f src/test/resources/hbase-site.xml
|
||||
rm -f src/test/resources/hive-site.xml
|
||||
rm -rf src/generated-sources/*
|
||||
rm -f derby.log
|
||||
|
||||
# clean be
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
# This module defines
|
||||
# Thrift_VERSION, version string of ant if found
|
||||
# Thrift_INCLUDE_DIR, where to find Thrift headers
|
||||
# Thrift_CONTRIB_DIR, where contrib thrift files (e.g. fb303.thrift) are installed
|
||||
# Thrift_LIBS, Thrift libraries
|
||||
# Thrift_FOUND, If false, do not try to use ant
|
||||
|
||||
@@ -14,6 +15,13 @@ find_path(Thrift_INCLUDE_DIR Thrift.h HINTS
|
||||
/opt/local/include/thrift
|
||||
)
|
||||
|
||||
# Use the default install dir of thrift contrib (/usr/local)
|
||||
# if env var THRIFT_CONTRIB_DIR is not set
|
||||
set(Thrift_CONTRIB_DIR $ENV{THRIFT_CONTRIB_DIR})
|
||||
IF (NOT Thrift_CONTRIB_DIR)
|
||||
set(Thrift_CONTRIB_DIR /usr/local)
|
||||
ENDIF (NOT Thrift_CONTRIB_DIR)
|
||||
|
||||
set(Thrift_LIB_PATHS
|
||||
$ENV{THRIFT_HOME}/lib
|
||||
/usr/local/lib
|
||||
@@ -51,6 +59,7 @@ else ()
|
||||
"${Thrift_INCLUDE_DIR}, ${Thrift_LIB})")
|
||||
endif ()
|
||||
|
||||
|
||||
mark_as_advanced(
|
||||
Thrift_LIB
|
||||
Thrift_COMPILER
|
||||
|
||||
@@ -14,7 +14,7 @@ cmake_minimum_required(VERSION 2.6)
|
||||
# To call this function, pass it the output file list followed by the input thrift files:
|
||||
# i.e. THRIFT_GEN(OUTPUT_FILES, ${THRIFT_FILES})
|
||||
#
|
||||
# cmake seems to be case sensitive for some keywords. Changing the first IF check to lower
|
||||
# cmake seems to be case sensitive for some keywords. Changing the first IF check to lower
|
||||
# case makes it not work. TODO: investigate this
|
||||
function(THRIFT_GEN VAR)
|
||||
IF (NOT ARGN)
|
||||
@@ -38,6 +38,15 @@ function(THRIFT_GEN VAR)
|
||||
set(OUTPUT_BE_FILE ${OUTPUT_BE_FILE} "${BE_OUTPUT_DIR}/gen-cpp/${FIL_WE}_constants.h")
|
||||
list(APPEND ${VAR} ${OUTPUT_BE_FILE})
|
||||
|
||||
# BeeswaxService thrift generation
|
||||
# It depends on hive_meta_store, which in turn depends on fb303.
|
||||
# The java dependency is handled by maven.
|
||||
# We need to generate C++ src file for the parent dependencies using the "-r" option.
|
||||
set(CPP_ARGS ${THRIFT_INCLUDE_DIR_OPTION} --gen cpp -o ${BE_OUTPUT_DIR})
|
||||
IF (FIL STREQUAL "beeswax.thrift")
|
||||
set(CPP_ARGS -r ${THRIFT_INCLUDE_DIR_OPTION} --gen cpp -o ${BE_OUTPUT_DIR})
|
||||
ENDIF(FIL STREQUAL "beeswax.thrift")
|
||||
|
||||
add_custom_command(
|
||||
OUTPUT ${OUTPUT_BE_FILE}
|
||||
COMMAND thrift ${CPP_ARGS} ${FIL}
|
||||
@@ -51,14 +60,14 @@ function(THRIFT_GEN VAR)
|
||||
set(${VAR} ${${VAR}} PARENT_SCOPE)
|
||||
endfunction(THRIFT_GEN)
|
||||
|
||||
set(THRIFT_INCLUDE_DIR_OPTION -I ${Thrift_CONTRIB_DIR} -I $ENV{HIVE_HOME}/src/metastore/if)
|
||||
set(BE_OUTPUT_DIR ${CMAKE_SOURCE_DIR}/be/generated-sources)
|
||||
set(FE_OUTPUT_DIR ${CMAKE_SOURCE_DIR}/fe/generated-sources)
|
||||
file(MAKE_DIRECTORY ${BE_OUTPUT_DIR})
|
||||
file(MAKE_DIRECTORY ${FE_OUTPUT_DIR})
|
||||
|
||||
# Args passed to thrift for java/c++ gen
|
||||
set(CPP_ARGS --gen cpp -o ${BE_OUTPUT_DIR})
|
||||
set(JAVA_ARGS --gen java:hashcode -o ${FE_OUTPUT_DIR})
|
||||
# Args passed to thrift for Java gen
|
||||
set(JAVA_ARGS ${THRIFT_INCLUDE_DIR_OPTION} --gen java:hashcode -o ${FE_OUTPUT_DIR})
|
||||
|
||||
set (GENERATES_SRC_FILES
|
||||
Opcodes.thrift
|
||||
|
||||
@@ -5,21 +5,22 @@ namespace java com.cloudera.impala.thrift
|
||||
|
||||
include "ImpalaBackendService.thrift"
|
||||
|
||||
exception TException {
|
||||
exception TImpalaPlanServiceException {
|
||||
1: string msg;
|
||||
}
|
||||
|
||||
// We're running the Impala frontend as a service from which the backend
|
||||
// test driver can get plans to run.
|
||||
service ImpalaPlanService {
|
||||
ImpalaBackendService.TQueryExecRequest
|
||||
GetExecRequest(1:string query, 2:i32 numNodes) throws (1:TException e);
|
||||
ImpalaBackendService.TQueryExecRequest GetExecRequest(1:string query, 2:i32 numNodes)
|
||||
throws (1:TImpalaPlanServiceException e);
|
||||
|
||||
// Force planservice to reload table metadata, in case it has changed due to e.g. an
|
||||
// insert
|
||||
void RefreshMetadata();
|
||||
|
||||
string GetExplainString(1:string query, 2:i32 numNodes) throws (1:TException e);
|
||||
string GetExplainString(1:string query, 2:i32 numNodes)
|
||||
throws (1:TImpalaPlanServiceException e);
|
||||
|
||||
void ShutdownServer();
|
||||
}
|
||||
|
||||
@@ -22,8 +22,7 @@ namespace java com.cloudera.beeswax.api
|
||||
namespace py beeswaxd
|
||||
namespace cpp beeswax
|
||||
|
||||
// TODO: for now, we get rid of the hive dependency as a temp hack
|
||||
//include "hive_metastore.thrift"
|
||||
include "hive_metastore.thrift"
|
||||
|
||||
// A Query
|
||||
struct Query {
|
||||
@@ -75,10 +74,7 @@ struct Results {
|
||||
*/
|
||||
struct ResultsMetadata {
|
||||
/** The schema of the results */
|
||||
/** TODO: The original beeswax schema is hive_metastore.Schema, but to get rid of the
|
||||
Hive dependency, we're using string for now. Change it back to Hive.
|
||||
1: hive_metastore.Schema schema, */
|
||||
1: string schema,
|
||||
1: hive_metastore.Schema schema,
|
||||
/** The directory containing the results. Not applicable for partition table. */
|
||||
2: string table_dir,
|
||||
/** If the results are straight from an existing table, the table name. */
|
||||
|
||||
@@ -73,12 +73,12 @@
|
||||
<dependency>
|
||||
<groupId>org.apache.thrift</groupId>
|
||||
<artifactId>libthrift</artifactId>
|
||||
<version>0.6.1</version>
|
||||
<version>0.7.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.thrift</groupId>
|
||||
<artifactId>libfb303</artifactId>
|
||||
<version>0.6.1</version>
|
||||
<version>0.7.0</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
|
||||
@@ -8,7 +8,6 @@ import java.util.Set;
|
||||
|
||||
import org.apache.hadoop.hive.metastore.api.MetaException;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.apache.thrift.TException;
|
||||
import org.apache.thrift.server.TServer;
|
||||
import org.apache.thrift.server.TThreadPoolServer;
|
||||
import org.apache.thrift.transport.TServerSocket;
|
||||
@@ -18,6 +17,7 @@ import org.apache.thrift.transport.TTransportException;
|
||||
import com.cloudera.impala.common.ImpalaException;
|
||||
import com.cloudera.impala.service.Frontend;
|
||||
import com.cloudera.impala.thrift.ImpalaPlanService;
|
||||
import com.cloudera.impala.thrift.TImpalaPlanServiceException;
|
||||
import com.cloudera.impala.thrift.TQueryExecRequest;
|
||||
import com.cloudera.impala.thrift.TQueryRequest;
|
||||
import com.google.common.collect.Sets;
|
||||
@@ -44,7 +44,8 @@ public class PlanService {
|
||||
frontend = new Frontend(lazy);
|
||||
}
|
||||
|
||||
public TQueryExecRequest GetExecRequest(String stmt, int numNodes) throws TException {
|
||||
public TQueryExecRequest GetExecRequest(String stmt, int numNodes)
|
||||
throws TImpalaPlanServiceException {
|
||||
LOG.info(
|
||||
"Executing '" + stmt + "' for " + Integer.toString(numNodes) + " nodes");
|
||||
TQueryRequest tRequest = new TQueryRequest(stmt, false, numNodes);
|
||||
@@ -54,7 +55,7 @@ public class PlanService {
|
||||
request = frontend.createExecRequest(tRequest, explainStringBuilder);
|
||||
} catch (ImpalaException e) {
|
||||
LOG.warn("Error creating exec request", e);
|
||||
throw new TException(e);
|
||||
throw new TImpalaPlanServiceException(e.getMessage());
|
||||
}
|
||||
|
||||
request.setAsAscii(false);
|
||||
@@ -78,18 +79,18 @@ public class PlanService {
|
||||
* Loads an updated catalog from the metastore. Is thread-safe.
|
||||
*/
|
||||
@Override
|
||||
public void RefreshMetadata() throws TException {
|
||||
public void RefreshMetadata() {
|
||||
frontend.resetCatalog();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String GetExplainString(String query, int numNodes)
|
||||
throws com.cloudera.impala.thrift.TException, TException {
|
||||
throws TImpalaPlanServiceException {
|
||||
try {
|
||||
return frontend.getExplainString(new TQueryRequest(query, false, numNodes));
|
||||
} catch (ImpalaException e) {
|
||||
LOG.warn("Error getting explain string", e);
|
||||
throw new TException(e);
|
||||
throw new TImpalaPlanServiceException(e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user