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
|
build
|
||||||
generated-sources
|
generated-sources/**/*
|
||||||
|
|
||||||
|
|||||||
@@ -27,6 +27,8 @@ set(SRC_FILES
|
|||||||
Descriptors_types.cpp
|
Descriptors_types.cpp
|
||||||
Exprs_constants.cpp
|
Exprs_constants.cpp
|
||||||
Exprs_types.cpp
|
Exprs_types.cpp
|
||||||
|
hive_metastore_constants.cpp
|
||||||
|
hive_metastore_types.cpp
|
||||||
Opcodes_constants.cpp
|
Opcodes_constants.cpp
|
||||||
Opcodes_types.cpp
|
Opcodes_types.cpp
|
||||||
PlanNodes_constants.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);
|
COUNTER_SCOPED_TIMER(plan_gen_counter);
|
||||||
CHECK(client_.get() != NULL) << "didn't call InProcessQueryExecutor::Setup()";
|
CHECK(client_.get() != NULL) << "didn't call InProcessQueryExecutor::Setup()";
|
||||||
client_->GetExecRequest(query_request_, query.c_str(), FLAGS_num_nodes);
|
client_->GetExecRequest(query_request_, query.c_str(), FLAGS_num_nodes);
|
||||||
} catch (::apache::thrift::TException& e) {
|
} catch (TImpalaPlanServiceException& e) {
|
||||||
return Status(e.what());
|
return Status(e.what());
|
||||||
}
|
}
|
||||||
VLOG(1) << "query request:\n" << ThriftDebugString(query_request_);
|
VLOG(1) << "query request:\n" << ThriftDebugString(query_request_);
|
||||||
@@ -273,7 +273,7 @@ void InProcessQueryExecutor::Shutdown() {
|
|||||||
// shut down server we started ourselves
|
// shut down server we started ourselves
|
||||||
try {
|
try {
|
||||||
client_->ShutdownServer();
|
client_->ShutdownServer();
|
||||||
} catch (TException& e) {
|
} catch (TImpalaPlanServiceException& e) {
|
||||||
// ignore; the server just quit, so won't respond to the rpc
|
// 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 {
|
try {
|
||||||
client_->GetExplainString(*explain_plan, query, 0);
|
client_->GetExplainString(*explain_plan, query, 0);
|
||||||
return Status::OK;
|
return Status::OK;
|
||||||
} catch (TException& e) {
|
} catch (TImpalaPlanServiceException& e) {
|
||||||
return Status(e.what());
|
return Status(e.what());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -85,6 +85,7 @@ then
|
|||||||
rm -rf target
|
rm -rf target
|
||||||
rm -f src/test/resources/hbase-site.xml
|
rm -f src/test/resources/hbase-site.xml
|
||||||
rm -f src/test/resources/hive-site.xml
|
rm -f src/test/resources/hive-site.xml
|
||||||
|
rm -rf src/generated-sources/*
|
||||||
rm -f derby.log
|
rm -f derby.log
|
||||||
|
|
||||||
# clean be
|
# clean be
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
# This module defines
|
# This module defines
|
||||||
# Thrift_VERSION, version string of ant if found
|
# Thrift_VERSION, version string of ant if found
|
||||||
# Thrift_INCLUDE_DIR, where to find Thrift headers
|
# 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_LIBS, Thrift libraries
|
||||||
# Thrift_FOUND, If false, do not try to use ant
|
# 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
|
/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
|
set(Thrift_LIB_PATHS
|
||||||
$ENV{THRIFT_HOME}/lib
|
$ENV{THRIFT_HOME}/lib
|
||||||
/usr/local/lib
|
/usr/local/lib
|
||||||
@@ -51,6 +59,7 @@ else ()
|
|||||||
"${Thrift_INCLUDE_DIR}, ${Thrift_LIB})")
|
"${Thrift_INCLUDE_DIR}, ${Thrift_LIB})")
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
|
|
||||||
mark_as_advanced(
|
mark_as_advanced(
|
||||||
Thrift_LIB
|
Thrift_LIB
|
||||||
Thrift_COMPILER
|
Thrift_COMPILER
|
||||||
|
|||||||
@@ -38,6 +38,15 @@ function(THRIFT_GEN VAR)
|
|||||||
set(OUTPUT_BE_FILE ${OUTPUT_BE_FILE} "${BE_OUTPUT_DIR}/gen-cpp/${FIL_WE}_constants.h")
|
set(OUTPUT_BE_FILE ${OUTPUT_BE_FILE} "${BE_OUTPUT_DIR}/gen-cpp/${FIL_WE}_constants.h")
|
||||||
list(APPEND ${VAR} ${OUTPUT_BE_FILE})
|
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(
|
add_custom_command(
|
||||||
OUTPUT ${OUTPUT_BE_FILE}
|
OUTPUT ${OUTPUT_BE_FILE}
|
||||||
COMMAND thrift ${CPP_ARGS} ${FIL}
|
COMMAND thrift ${CPP_ARGS} ${FIL}
|
||||||
@@ -51,14 +60,14 @@ function(THRIFT_GEN VAR)
|
|||||||
set(${VAR} ${${VAR}} PARENT_SCOPE)
|
set(${VAR} ${${VAR}} PARENT_SCOPE)
|
||||||
endfunction(THRIFT_GEN)
|
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(BE_OUTPUT_DIR ${CMAKE_SOURCE_DIR}/be/generated-sources)
|
||||||
set(FE_OUTPUT_DIR ${CMAKE_SOURCE_DIR}/fe/generated-sources)
|
set(FE_OUTPUT_DIR ${CMAKE_SOURCE_DIR}/fe/generated-sources)
|
||||||
file(MAKE_DIRECTORY ${BE_OUTPUT_DIR})
|
file(MAKE_DIRECTORY ${BE_OUTPUT_DIR})
|
||||||
file(MAKE_DIRECTORY ${FE_OUTPUT_DIR})
|
file(MAKE_DIRECTORY ${FE_OUTPUT_DIR})
|
||||||
|
|
||||||
# Args passed to thrift for java/c++ gen
|
# Args passed to thrift for Java gen
|
||||||
set(CPP_ARGS --gen cpp -o ${BE_OUTPUT_DIR})
|
set(JAVA_ARGS ${THRIFT_INCLUDE_DIR_OPTION} --gen java:hashcode -o ${FE_OUTPUT_DIR})
|
||||||
set(JAVA_ARGS --gen java:hashcode -o ${FE_OUTPUT_DIR})
|
|
||||||
|
|
||||||
set (GENERATES_SRC_FILES
|
set (GENERATES_SRC_FILES
|
||||||
Opcodes.thrift
|
Opcodes.thrift
|
||||||
|
|||||||
@@ -5,21 +5,22 @@ namespace java com.cloudera.impala.thrift
|
|||||||
|
|
||||||
include "ImpalaBackendService.thrift"
|
include "ImpalaBackendService.thrift"
|
||||||
|
|
||||||
exception TException {
|
exception TImpalaPlanServiceException {
|
||||||
1: string msg;
|
1: string msg;
|
||||||
}
|
}
|
||||||
|
|
||||||
// We're running the Impala frontend as a service from which the backend
|
// We're running the Impala frontend as a service from which the backend
|
||||||
// test driver can get plans to run.
|
// test driver can get plans to run.
|
||||||
service ImpalaPlanService {
|
service ImpalaPlanService {
|
||||||
ImpalaBackendService.TQueryExecRequest
|
ImpalaBackendService.TQueryExecRequest GetExecRequest(1:string query, 2:i32 numNodes)
|
||||||
GetExecRequest(1:string query, 2:i32 numNodes) throws (1:TException e);
|
throws (1:TImpalaPlanServiceException e);
|
||||||
|
|
||||||
// Force planservice to reload table metadata, in case it has changed due to e.g. an
|
// Force planservice to reload table metadata, in case it has changed due to e.g. an
|
||||||
// insert
|
// insert
|
||||||
void RefreshMetadata();
|
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();
|
void ShutdownServer();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,8 +22,7 @@ namespace java com.cloudera.beeswax.api
|
|||||||
namespace py beeswaxd
|
namespace py beeswaxd
|
||||||
namespace cpp beeswax
|
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
|
// A Query
|
||||||
struct Query {
|
struct Query {
|
||||||
@@ -75,10 +74,7 @@ struct Results {
|
|||||||
*/
|
*/
|
||||||
struct ResultsMetadata {
|
struct ResultsMetadata {
|
||||||
/** The schema of the results */
|
/** The schema of the results */
|
||||||
/** TODO: The original beeswax schema is hive_metastore.Schema, but to get rid of the
|
1: hive_metastore.Schema schema,
|
||||||
Hive dependency, we're using string for now. Change it back to Hive.
|
|
||||||
1: hive_metastore.Schema schema, */
|
|
||||||
1: string schema,
|
|
||||||
/** The directory containing the results. Not applicable for partition table. */
|
/** The directory containing the results. Not applicable for partition table. */
|
||||||
2: string table_dir,
|
2: string table_dir,
|
||||||
/** If the results are straight from an existing table, the table name. */
|
/** If the results are straight from an existing table, the table name. */
|
||||||
|
|||||||
@@ -73,12 +73,12 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.apache.thrift</groupId>
|
<groupId>org.apache.thrift</groupId>
|
||||||
<artifactId>libthrift</artifactId>
|
<artifactId>libthrift</artifactId>
|
||||||
<version>0.6.1</version>
|
<version>0.7.0</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.apache.thrift</groupId>
|
<groupId>org.apache.thrift</groupId>
|
||||||
<artifactId>libfb303</artifactId>
|
<artifactId>libfb303</artifactId>
|
||||||
<version>0.6.1</version>
|
<version>0.7.0</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
|
|||||||
@@ -8,7 +8,6 @@ import java.util.Set;
|
|||||||
|
|
||||||
import org.apache.hadoop.hive.metastore.api.MetaException;
|
import org.apache.hadoop.hive.metastore.api.MetaException;
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
import org.apache.thrift.TException;
|
|
||||||
import org.apache.thrift.server.TServer;
|
import org.apache.thrift.server.TServer;
|
||||||
import org.apache.thrift.server.TThreadPoolServer;
|
import org.apache.thrift.server.TThreadPoolServer;
|
||||||
import org.apache.thrift.transport.TServerSocket;
|
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.common.ImpalaException;
|
||||||
import com.cloudera.impala.service.Frontend;
|
import com.cloudera.impala.service.Frontend;
|
||||||
import com.cloudera.impala.thrift.ImpalaPlanService;
|
import com.cloudera.impala.thrift.ImpalaPlanService;
|
||||||
|
import com.cloudera.impala.thrift.TImpalaPlanServiceException;
|
||||||
import com.cloudera.impala.thrift.TQueryExecRequest;
|
import com.cloudera.impala.thrift.TQueryExecRequest;
|
||||||
import com.cloudera.impala.thrift.TQueryRequest;
|
import com.cloudera.impala.thrift.TQueryRequest;
|
||||||
import com.google.common.collect.Sets;
|
import com.google.common.collect.Sets;
|
||||||
@@ -44,7 +44,8 @@ public class PlanService {
|
|||||||
frontend = new Frontend(lazy);
|
frontend = new Frontend(lazy);
|
||||||
}
|
}
|
||||||
|
|
||||||
public TQueryExecRequest GetExecRequest(String stmt, int numNodes) throws TException {
|
public TQueryExecRequest GetExecRequest(String stmt, int numNodes)
|
||||||
|
throws TImpalaPlanServiceException {
|
||||||
LOG.info(
|
LOG.info(
|
||||||
"Executing '" + stmt + "' for " + Integer.toString(numNodes) + " nodes");
|
"Executing '" + stmt + "' for " + Integer.toString(numNodes) + " nodes");
|
||||||
TQueryRequest tRequest = new TQueryRequest(stmt, false, numNodes);
|
TQueryRequest tRequest = new TQueryRequest(stmt, false, numNodes);
|
||||||
@@ -54,7 +55,7 @@ public class PlanService {
|
|||||||
request = frontend.createExecRequest(tRequest, explainStringBuilder);
|
request = frontend.createExecRequest(tRequest, explainStringBuilder);
|
||||||
} catch (ImpalaException e) {
|
} catch (ImpalaException e) {
|
||||||
LOG.warn("Error creating exec request", e);
|
LOG.warn("Error creating exec request", e);
|
||||||
throw new TException(e);
|
throw new TImpalaPlanServiceException(e.getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
request.setAsAscii(false);
|
request.setAsAscii(false);
|
||||||
@@ -78,18 +79,18 @@ public class PlanService {
|
|||||||
* Loads an updated catalog from the metastore. Is thread-safe.
|
* Loads an updated catalog from the metastore. Is thread-safe.
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void RefreshMetadata() throws TException {
|
public void RefreshMetadata() {
|
||||||
frontend.resetCatalog();
|
frontend.resetCatalog();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String GetExplainString(String query, int numNodes)
|
public String GetExplainString(String query, int numNodes)
|
||||||
throws com.cloudera.impala.thrift.TException, TException {
|
throws TImpalaPlanServiceException {
|
||||||
try {
|
try {
|
||||||
return frontend.getExplainString(new TQueryRequest(query, false, numNodes));
|
return frontend.getExplainString(new TQueryRequest(query, false, numNodes));
|
||||||
} catch (ImpalaException e) {
|
} catch (ImpalaException e) {
|
||||||
LOG.warn("Error getting explain string", e);
|
LOG.warn("Error getting explain string", e);
|
||||||
throw new TException(e);
|
throw new TImpalaPlanServiceException(e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user