You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hive.apache.org by Hiroyuki Yamada <mo...@gmail.com> on 2011/10/27 10:16:19 UTC
How to replace a input table name inside Hive (How Hive pass input
file names to Hadoop ?)
Hello,
I am trying to understand how hive compiles and opmizes HiveQL queries
for future development.
I would like to know how to replace a input table name in the
compilation process.
For example,
the following HiveQL is queried,
SELECT l_orderkey FROM lineitem WHERE l_shipdate < '1993-01-01';
, and I want to input "lineitem_copy" file instead of lineitem.
(lineitem_copy is also created beforehand.)
I looked into many of the codes, but I could't do that.
I modified some Table objects ans aliases like the following code, but
they didn't work.
(objects are actually changed, but I think it's not referenced from
InputFormat,
so lineitem is actually read in.)
in parse/SemanticAnalyzer.java
-----------------------------------------------------------------------------------------------------
public void analyzeInternal(ASTNode ast) throws SemanticException {
// complilations and optimizations
for (String alias : qb.getMetaData().getAliasToTable().keySet()) {
Table table = qb.getMetaData().getTableForAlias(alias);
table.setTableName(table.getTableName() + "_copy");
qb.setTabAlias(alias, qb.getTabNameForAlias(alias) + "_ext");
}
genMapRedTasks(qb);
LOG.info("Completed plan generation");
return;
}
-----------------------------------------------------------------------------------------------------
How Hive pass input file names to Hadoop ?
And, is there any way I can achieve this or any hints ?