Impala
Impalaistheopensource,nativeanalyticdatabaseforApacheHadoop.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
com.cloudera.impala.planner.PlannerTestBase Class Reference
Inheritance diagram for com.cloudera.impala.planner.PlannerTestBase:
Collaboration diagram for com.cloudera.impala.planner.PlannerTestBase:

Static Public Member Functions

static void setUp () throws Exception
 
static void cleanUp ()
 

Protected Member Functions

Path cleanseFilePath (Path path)
 
void runPlannerTestFile (String testFile, TQueryOptions options)
 
void runPlannerTestFile (String testFile)
 
void runPlannerTestFile (String testFile, String dbName)
 

Private Member Functions

void buildMaps (TQueryExecRequest execRequest)
 
THdfsPartition findPartition (int nodeId, THdfsFileSplit split)
 
void testHdfsPartitionsReferenced (TQueryExecRequest execRequest, String query, StringBuilder errorLog)
 
StringBuilder PrintScanRangeLocations (TQueryExecRequest execRequest)
 
String getExpectedErrorMessage (ArrayList< String > expectedPlan)
 
void handleNotImplException (String query, String expectedErrorMsg, StringBuilder errorLog, StringBuilder actualOutput, Throwable e)
 
TQueryOptions mergeQueryOptions (TQueryOptions a, TQueryOptions b)
 
TQueryOptions defaultQueryOptions ()
 
void RunTestCase (TestCase testCase, StringBuilder errorLog, StringBuilder actualOutput, String dbName, TQueryOptions options) throws CatalogException
 
void testSingleNodePlan (TestCase testCase, TQueryCtx queryCtx, StringBuilder errorLog, StringBuilder actualOutput) throws CatalogException
 
void testColumnLineageOutput (TestCase testCase, TQueryCtx queryCtx, StringBuilder errorLog, StringBuilder actualOutput) throws CatalogException
 
void testDistributedPlan (TestCase testCase, TQueryCtx queryCtx, StringBuilder errorLog, StringBuilder actualOutput) throws CatalogException
 
String removeExplainHeader (String explain)
 
void runPlannerTestFile (String testFile, String dbName, TQueryOptions options)
 

Private Attributes

final String testDir_ = "functional-planner/queries/PlannerTest"
 
final String outDir_ = "/tmp/PlannerTest/"
 
final Map< Integer, TPlanNode > planMap_ = Maps.newHashMap()
 
final Map< Integer,
TTupleDescriptor > 
tupleMap_ = Maps.newHashMap()
 
final Map< Integer,
TTableDescriptor > 
tableMap_ = Maps.newHashMap()
 

Static Private Attributes

static final Logger LOG = LoggerFactory.getLogger(PlannerTest.class)
 
static final boolean GENERATE_OUTPUT_FILE = true
 
static Frontend frontend_
 

Detailed Description

Definition at line 75 of file PlannerTestBase.java.

Member Function Documentation

void com.cloudera.impala.planner.PlannerTestBase.buildMaps ( TQueryExecRequest  execRequest)
inlineprivate

Clears the old maps and constructs new maps based on the new execRequest so that findPartitions() can locate various thrift metadata structures quickly.

Definition at line 108 of file PlannerTestBase.java.

Referenced by com.cloudera.impala.planner.PlannerTestBase.testSingleNodePlan().

Path com.cloudera.impala.planner.PlannerTestBase.cleanseFilePath ( Path  path)
inlineprotected

Normalize components of the given file path, removing any environment- or test-run dependent components. For example, substitutes the unique id portion of Impala generated file names with a fixed literal. Subclasses should override to do filesystem specific cleansing.

Definition at line 264 of file PlannerTestBase.java.

Referenced by com.cloudera.impala.planner.PlannerTestBase.PrintScanRangeLocations().

static void com.cloudera.impala.planner.PlannerTestBase.cleanUp ( )
inlinestatic

Definition at line 99 of file PlannerTestBase.java.

TQueryOptions com.cloudera.impala.planner.PlannerTestBase.defaultQueryOptions ( )
inlineprivate
THdfsPartition com.cloudera.impala.planner.PlannerTestBase.findPartition ( int  nodeId,
THdfsFileSplit  split 
)
inlineprivate

Look up the partition corresponding to the plan node (identified by nodeId) and a file split.

Definition at line 135 of file PlannerTestBase.java.

Referenced by com.cloudera.impala.planner.PlannerTestBase.PrintScanRangeLocations(), and com.cloudera.impala.planner.PlannerTestBase.testHdfsPartitionsReferenced().

String com.cloudera.impala.planner.PlannerTestBase.getExpectedErrorMessage ( ArrayList< String >  expectedPlan)
inlineprivate

Extracts and returns the expected error message from expectedPlan. Returns null if expectedPlan is empty or its first element is not an error message. The accepted format for error messages is 'not implemented: expected error message' Returns the empty string if expectedPlan starts with 'not implemented' but no expected error message was given.

Definition at line 279 of file PlannerTestBase.java.

Referenced by com.cloudera.impala.planner.PlannerTestBase.testDistributedPlan(), and com.cloudera.impala.planner.PlannerTestBase.testSingleNodePlan().

void com.cloudera.impala.planner.PlannerTestBase.handleNotImplException ( String  query,
String  expectedErrorMsg,
StringBuilder  errorLog,
StringBuilder  actualOutput,
Throwable  e 
)
inlineprivate
TQueryOptions com.cloudera.impala.planner.PlannerTestBase.mergeQueryOptions ( TQueryOptions  a,
TQueryOptions  b 
)
inlineprivate

Merge the options of b into a and return a

Definition at line 313 of file PlannerTestBase.java.

Referenced by com.cloudera.impala.planner.PlannerTestBase.RunTestCase().

StringBuilder com.cloudera.impala.planner.PlannerTestBase.PrintScanRangeLocations ( TQueryExecRequest  execRequest)
inlineprivate
String com.cloudera.impala.planner.PlannerTestBase.removeExplainHeader ( String  explain)
inlineprivate

Strips out the header containing resource estimates and the warning about missing stats from the given explain plan, because the estimates can change easily with stats/cardinality.

Definition at line 594 of file PlannerTestBase.java.

Referenced by com.cloudera.impala.planner.PlannerTestBase.testDistributedPlan(), and com.cloudera.impala.planner.PlannerTestBase.testSingleNodePlan().

void com.cloudera.impala.planner.PlannerTestBase.runPlannerTestFile ( String  testFile,
TQueryOptions  options 
)
inlineprotected

Definition at line 606 of file PlannerTestBase.java.

Referenced by com.cloudera.impala.planner.PlannerTestBase.runPlannerTestFile(), com.cloudera.impala.planner.PlannerTest.testAggregation(), com.cloudera.impala.planner.PlannerTest.testAnalyticFns(), com.cloudera.impala.planner.PlannerTest.testConstant(), com.cloudera.impala.planner.PlannerTest.testDataSourceTables(), com.cloudera.impala.planner.PlannerTest.testDdl(), com.cloudera.impala.planner.PlannerTest.testDistinct(), com.cloudera.impala.planner.PlannerTest.testDistinctEstimate(), com.cloudera.impala.planner.PlannerTest.testEmpty(), com.cloudera.impala.planner.PlannerTest.testHbase(), com.cloudera.impala.planner.PlannerTest.testHdfs(), com.cloudera.impala.planner.PlannerTest.testImplicitJoins(), com.cloudera.impala.planner.PlannerTest.testInlineView(), com.cloudera.impala.planner.PlannerTest.testInlineViewLimit(), com.cloudera.impala.planner.PlannerTest.testInsert(), com.cloudera.impala.planner.PlannerTest.testJoinOrder(), com.cloudera.impala.planner.PlannerTest.testJoins(), com.cloudera.impala.planner.PlannerTest.testLineage(), com.cloudera.impala.planner.PlannerTest.testNestedCollections(), com.cloudera.impala.planner.PlannerTest.testOrder(), com.cloudera.impala.planner.PlannerTest.testOuterJoins(), com.cloudera.impala.planner.PlannerTest.testPredicatePropagation(), com.cloudera.impala.planner.S3PlannerTest.testS3ScanRanges(), com.cloudera.impala.planner.PlannerTest.testSmallQueryOptimization(), com.cloudera.impala.planner.PlannerTest.testSubqueryRewrite(), com.cloudera.impala.planner.PlannerTest.testTopN(), com.cloudera.impala.planner.PlannerTest.testTpcds(), com.cloudera.impala.planner.PlannerTest.testTpch(), com.cloudera.impala.planner.PlannerTest.testUnion(), com.cloudera.impala.planner.PlannerTest.testValues(), com.cloudera.impala.planner.PlannerTest.testViews(), and com.cloudera.impala.planner.PlannerTest.testWithClause().

void com.cloudera.impala.planner.PlannerTestBase.runPlannerTestFile ( String  testFile)
inlineprotected
void com.cloudera.impala.planner.PlannerTestBase.runPlannerTestFile ( String  testFile,
String  dbName 
)
inlineprotected
void com.cloudera.impala.planner.PlannerTestBase.RunTestCase ( TestCase  testCase,
StringBuilder  errorLog,
StringBuilder  actualOutput,
String  dbName,
TQueryOptions  options 
) throws CatalogException
inlineprivate

Produces single-node and distributed plans for testCase and compares plan and scan range results. Appends the actual single-node and distributed plan as well as the printed scan ranges to actualOutput, along with the requisite section header. locations to actualScanRangeLocations; compares both to the appropriate sections of 'testCase'.

Definition at line 338 of file PlannerTestBase.java.

References com.cloudera.impala.planner.PlannerTestBase.defaultQueryOptions(), com.cloudera.impala.planner.PlannerTestBase.mergeQueryOptions(), com.cloudera.impala.planner.PlannerTestBase.testColumnLineageOutput(), com.cloudera.impala.planner.PlannerTestBase.testDistributedPlan(), and com.cloudera.impala.planner.PlannerTestBase.testSingleNodePlan().

Referenced by com.cloudera.impala.planner.PlannerTestBase.runPlannerTestFile().

static void com.cloudera.impala.planner.PlannerTestBase.setUp ( ) throws Exception
inlinestatic

Definition at line 91 of file PlannerTestBase.java.

void com.cloudera.impala.planner.PlannerTestBase.testColumnLineageOutput ( TestCase  testCase,
TQueryCtx  queryCtx,
StringBuilder  errorLog,
StringBuilder  actualOutput 
) throws CatalogException
inlineprivate
void com.cloudera.impala.planner.PlannerTestBase.testDistributedPlan ( TestCase  testCase,
TQueryCtx  queryCtx,
StringBuilder  errorLog,
StringBuilder  actualOutput 
) throws CatalogException
inlineprivate

Produces distributed plan for testCase and compares actual plan with expected plan. If testCase contains no expected distributed plan then this function is a no-op.

Definition at line 532 of file PlannerTestBase.java.

References com.cloudera.impala.testutil.TestFileParser.Section.DISTRIBUTEDPLAN, com.cloudera.impala.planner.PlannerTestBase.getExpectedErrorMessage(), com.cloudera.impala.planner.PlannerTestBase.handleNotImplException(), and com.cloudera.impala.planner.PlannerTestBase.removeExplainHeader().

Referenced by com.cloudera.impala.planner.PlannerTestBase.RunTestCase().

void com.cloudera.impala.planner.PlannerTestBase.testHdfsPartitionsReferenced ( TQueryExecRequest  execRequest,
String  query,
StringBuilder  errorLog 
)
inlineprivate

Verify that all THdfsPartitions included in the descriptor table are referenced by at least one scan range or part of an inserted table. PrintScanRangeLocations will implicitly verify the converse (it'll fail if a scan range references a table/partition descriptor that is not present).

Definition at line 161 of file PlannerTestBase.java.

References com.cloudera.impala.planner.PlannerTestBase.findPartition().

Referenced by com.cloudera.impala.planner.PlannerTestBase.testSingleNodePlan().

void com.cloudera.impala.planner.PlannerTestBase.testSingleNodePlan ( TestCase  testCase,
TQueryCtx  queryCtx,
StringBuilder  errorLog,
StringBuilder  actualOutput 
) throws CatalogException
inlineprivate

Member Data Documentation

Frontend com.cloudera.impala.planner.PlannerTestBase.frontend_
staticprivate
Initial value:
= new Frontend(
AuthorizationConfig.createAuthDisabledConfig(), new ImpaladTestCatalog())

Definition at line 78 of file PlannerTestBase.java.

final boolean com.cloudera.impala.planner.PlannerTestBase.GENERATE_OUTPUT_FILE = true
staticprivate
final Logger com.cloudera.impala.planner.PlannerTestBase.LOG = LoggerFactory.getLogger(PlannerTest.class)
staticprivate

Definition at line 76 of file PlannerTestBase.java.

final String com.cloudera.impala.planner.PlannerTestBase.outDir_ = "/tmp/PlannerTest/"
private
final Map<Integer, TPlanNode> com.cloudera.impala.planner.PlannerTestBase.planMap_ = Maps.newHashMap()
private

Definition at line 84 of file PlannerTestBase.java.

final Map<Integer, TTableDescriptor> com.cloudera.impala.planner.PlannerTestBase.tableMap_ = Maps.newHashMap()
private

Definition at line 88 of file PlannerTestBase.java.

final String com.cloudera.impala.planner.PlannerTestBase.testDir_ = "functional-planner/queries/PlannerTest"
private
final Map<Integer, TTupleDescriptor> com.cloudera.impala.planner.PlannerTestBase.tupleMap_ = Maps.newHashMap()
private

Definition at line 86 of file PlannerTestBase.java.


The documentation for this class was generated from the following file: