diff --git a/ql/src/java/org/apache/hadoop/hive/ql/exec/FunctionRegistry.java b/ql/src/java/org/apache/hadoop/hive/ql/exec/FunctionRegistry.java
index 7ca950de26..68e6ae3cd5 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/exec/FunctionRegistry.java
+++ b/ql/src/java/org/apache/hadoop/hive/ql/exec/FunctionRegistry.java
@@ -860,6 +860,15 @@ public static PrimitiveCategory getPrimitiveCommonCategory(TypeInfo a, TypeInfo
return pcA;
}
+ if (pcA == PrimitiveCategory.VOID) {
+ // Handle NULL, we return the type of pcB
+ return pcB;
+ }
+ if (pcB == PrimitiveCategory.VOID) {
+ // Handle NULL, we return the type of pcA
+ return pcA;
+ }
+
PrimitiveGrouping pgA = PrimitiveObjectInspectorUtils.getPrimitiveGrouping(pcA);
PrimitiveGrouping pgB = PrimitiveObjectInspectorUtils.getPrimitiveGrouping(pcB);
diff --git a/ql/src/java/org/apache/hadoop/hive/ql/parse/FromClauseParser.g b/ql/src/java/org/apache/hadoop/hive/ql/parse/FromClauseParser.g
index 3496d9ecd5..eaa38b5cde 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/parse/FromClauseParser.g
+++ b/ql/src/java/org/apache/hadoop/hive/ql/parse/FromClauseParser.g
@@ -87,8 +87,6 @@ fromSource
@init { gParent.pushMsg("join source", state); }
@after { gParent.popMsg(state); }
:
- virtualTableSource
- |
uniqueJoinToken^ uniqueJoinSource (COMMA! uniqueJoinSource)+
|
joinSource
@@ -101,6 +99,8 @@ atomjoinSource
:
tableSource (lateralView^)*
|
+ virtualTableSource (lateralView^)*
+ |
(subQuerySource) => subQuerySource (lateralView^)*
|
partitionedTableFunction (lateralView^)*
@@ -117,7 +117,7 @@ joinSourcePart
@init { gParent.pushMsg("joinSourcePart", state); }
@after { gParent.popMsg(state); }
:
- (tableSource | subQuerySource | partitionedTableFunction) (lateralView^)*
+ (tableSource | virtualTableSource | subQuerySource | partitionedTableFunction) (lateralView^)*
;
uniqueJoinSource
@@ -155,11 +155,14 @@ lateralView
@init {gParent.pushMsg("lateral view", state); }
@after {gParent.popMsg(state); }
:
- (KW_LATERAL KW_VIEW KW_OUTER) => KW_LATERAL KW_VIEW KW_OUTER function tableAlias (KW_AS identifier ((COMMA)=> COMMA identifier)*)?
+ (COMMA? KW_LATERAL KW_VIEW KW_OUTER) => KW_LATERAL KW_VIEW KW_OUTER function tableAlias (KW_AS identifier ((COMMA)=> COMMA identifier)*)?
-> ^(TOK_LATERAL_VIEW_OUTER ^(TOK_SELECT ^(TOK_SELEXPR function identifier* tableAlias)))
|
- KW_LATERAL KW_VIEW function tableAlias (KW_AS identifier ((COMMA)=> COMMA identifier)*)?
+ COMMA? KW_LATERAL KW_VIEW function tableAlias (KW_AS identifier ((COMMA)=> COMMA identifier)*)?
-> ^(TOK_LATERAL_VIEW ^(TOK_SELECT ^(TOK_SELEXPR function identifier* tableAlias)))
+ |
+ COMMA? KW_LATERAL KW_TABLE LPAREN valuesClause RPAREN KW_AS? tableAlias (LPAREN identifier (COMMA identifier)*)? RPAREN
+ -> ^(TOK_LATERAL_VIEW ^(TOK_SELECT ^(TOK_SELEXPR ^(TOK_FUNCTION Identifier["inline"] valuesClause) identifier* tableAlias)))
;
tableAlias
@@ -290,51 +293,54 @@ searchCondition
//in support of SELECT * FROM (VALUES(1,2,3),(4,5,6),...) as FOO(a,b,c) and
// INSERT INTO
(col1,col2,...) VALUES(...),(...),...
// INSERT INTO (col1,col2,...) SELECT * FROM (VALUES(1,2,3),(4,5,6),...) as Foo(a,b,c)
-valueRowConstructor
-@init { gParent.pushMsg("value row constructor", state); }
+/*
+VALUES(1),(2) means 2 rows, 1 column each.
+VALUES(1,2),(3,4) means 2 rows, 2 columns each.
+VALUES(1,2,3) means 1 row, 3 columns
+*/
+valuesClause
+@init { gParent.pushMsg("values clause", state); }
@after { gParent.popMsg(state); }
:
- expressionsInParenthesis[false] -> ^(TOK_VALUE_ROW expressionsInParenthesis)
+ KW_VALUES valuesTableConstructor -> ^(TOK_FUNCTION Identifier["array"] valuesTableConstructor)
;
valuesTableConstructor
@init { gParent.pushMsg("values table constructor", state); }
@after { gParent.popMsg(state); }
:
- valueRowConstructor (COMMA valueRowConstructor)* -> ^(TOK_VALUES_TABLE valueRowConstructor+)
+ valueRowConstructor (COMMA! valueRowConstructor)*
;
-/*
-VALUES(1),(2) means 2 rows, 1 column each.
-VALUES(1,2),(3,4) means 2 rows, 2 columns each.
-VALUES(1,2,3) means 1 row, 3 columns
-*/
-valuesClause
-@init { gParent.pushMsg("values clause", state); }
+valueRowConstructor
+@init { gParent.pushMsg("value row constructor", state); }
@after { gParent.popMsg(state); }
:
- KW_VALUES! valuesTableConstructor
+ expressionsInParenthesis[true]
;
/*
This represents a clause like this:
-(VALUES(1,2),(2,3)) as VirtTable(col1,col2)
+TABLE(VALUES(1,2),(2,3)) as VirtTable(col1,col2)
*/
virtualTableSource
@init { gParent.pushMsg("virtual table source", state); }
-@after { gParent.popMsg(state); }
- :
- LPAREN valuesClause RPAREN tableNameColList -> ^(TOK_VIRTUAL_TABLE tableNameColList valuesClause)
- ;
-/*
-e.g. as VirtTable(col1,col2)
-Note that we only want literals as column names
-*/
-tableNameColList
-@init { gParent.pushMsg("from source", state); }
@after { gParent.popMsg(state); }
:
- KW_AS? identifier LPAREN identifier (COMMA identifier)* RPAREN -> ^(TOK_VIRTUAL_TABREF ^(TOK_TABNAME identifier) ^(TOK_COL_NAME identifier+))
+ KW_TABLE LPAREN valuesClause RPAREN KW_AS? tabAlias=tableAlias (LPAREN identifier (COMMA identifier)*)? RPAREN
+ -> ^(TOK_SUBQUERY
+ ^(TOK_QUERY
+ ^(TOK_FROM
+ ^(TOK_SUBQUERY
+ ^(TOK_QUERY
+ ^(TOK_INSERT
+ ^(TOK_DESTINATION ^(TOK_DIR TOK_TMP_FILE))
+ ^(TOK_SELECT ^(TOK_SELEXPR IntegralLiteral["0"]))))
+ {adaptor.create(Identifier, $tabAlias.tree.getChild(0).getText())}))
+ ^(TOK_INSERT
+ ^(TOK_DESTINATION ^(TOK_DIR TOK_TMP_FILE))
+ ^(TOK_SELECT ^(TOK_SELEXPR ^(TOK_FUNCTION Identifier["inline"] valuesClause) identifier*))))
+ {adaptor.create(Identifier, $tabAlias.tree.getChild(0).getText())})
;
//-----------------------------------------------------------------------------------
diff --git a/ql/src/java/org/apache/hadoop/hive/ql/parse/HiveParser.g b/ql/src/java/org/apache/hadoop/hive/ql/parse/HiveParser.g
index 209f75de9e..a3fbda2fb7 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/parse/HiveParser.g
+++ b/ql/src/java/org/apache/hadoop/hive/ql/parse/HiveParser.g
@@ -370,11 +370,6 @@ TOK_SHOW_TRANSACTIONS;
TOK_DELETE_FROM;
TOK_UPDATE_TABLE;
TOK_SET_COLUMNS_CLAUSE;
-TOK_VALUE_ROW;
-TOK_VALUES_TABLE;
-TOK_VIRTUAL_TABLE;
-TOK_VIRTUAL_TABREF;
-TOK_ANONYMOUS;
TOK_COL_NAME;
TOK_URI_TYPE;
TOK_SERVER_TYPE;
@@ -2681,8 +2676,7 @@ singleFromStatement
The valuesClause rule below ensures that the parse tree for
"insert into table FOO values (1,2),(3,4)" looks the same as
"insert into table FOO select a,b from (values(1,2),(3,4)) as BAR(a,b)" which itself is made to look
-very similar to the tree for "insert into table FOO select a,b from BAR". Since virtual table name
-is implicit, it's represented as TOK_ANONYMOUS.
+very similar to the tree for "insert into table FOO select a,b from BAR".
*/
regularBody
:
@@ -2693,10 +2687,7 @@ regularBody
|
valuesClause
-> ^(TOK_QUERY
- ^(TOK_FROM
- ^(TOK_VIRTUAL_TABLE ^(TOK_VIRTUAL_TABREF ^(TOK_ANONYMOUS)) valuesClause)
- )
- ^(TOK_INSERT {$i.tree} ^(TOK_SELECT ^(TOK_SELEXPR TOK_ALLCOLREF)))
+ ^(TOK_INSERT {$i.tree} ^(TOK_SELECT ^(TOK_SELEXPR ^(TOK_FUNCTION Identifier["inline"] valuesClause))))
)
)
|
diff --git a/ql/src/java/org/apache/hadoop/hive/ql/parse/SemanticAnalyzer.java b/ql/src/java/org/apache/hadoop/hive/ql/parse/SemanticAnalyzer.java
index 5a88a96d72..6219f94434 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/parse/SemanticAnalyzer.java
+++ b/ql/src/java/org/apache/hadoop/hive/ql/parse/SemanticAnalyzer.java
@@ -872,134 +872,6 @@ private static void writeAsText(String text, FSDataOutputStream out) throws IOEx
out.write(to.getBytes(), 0, to.getLength());
}
- /**
- * Generate a temp table out of a values clause
- * See also {@link #preProcessForInsert(ASTNode, QB)}
- */
- private ASTNode genValuesTempTable(ASTNode originalFrom, QB qb) throws SemanticException {
- Path dataDir = null;
- if(!qb.getEncryptedTargetTablePaths().isEmpty()) {
- //currently only Insert into T values(...) is supported thus only 1 values clause
- //and only 1 target table are possible. If/when support for
- //select ... from values(...) is added an insert statement may have multiple
- //encrypted target tables.
- dataDir = ctx.getMRTmpPath(qb.getEncryptedTargetTablePaths().get(0).toUri());
- }
- // Pick a name for the table
- SessionState ss = SessionState.get();
- String tableName = VALUES_TMP_TABLE_NAME_PREFIX + ss.getNextValuesTempTableSuffix();
-
- // Step 1, parse the values clause we were handed
- List extends Node> fromChildren = originalFrom.getChildren();
- // First child should be the virtual table ref
- ASTNode virtualTableRef = (ASTNode)fromChildren.get(0);
- assert virtualTableRef.getToken().getType() == HiveParser.TOK_VIRTUAL_TABREF :
- "Expected first child of TOK_VIRTUAL_TABLE to be TOK_VIRTUAL_TABREF but was " +
- virtualTableRef.getName();
-
- List extends Node> virtualTableRefChildren = virtualTableRef.getChildren();
- // First child of this should be the table name. If it's anonymous,
- // then we don't have a table name.
- ASTNode tabName = (ASTNode)virtualTableRefChildren.get(0);
- if (tabName.getToken().getType() != HiveParser.TOK_ANONYMOUS) {
- // TODO, if you want to make select ... from (values(...) as foo(...) work,
- // you need to parse this list of columns names and build it into the table
- throw new SemanticException(ErrorMsg.VALUES_TABLE_CONSTRUCTOR_NOT_SUPPORTED.getMsg());
- }
-
- // The second child of the TOK_VIRTUAL_TABLE should be TOK_VALUES_TABLE
- ASTNode valuesTable = (ASTNode)fromChildren.get(1);
- assert valuesTable.getToken().getType() == HiveParser.TOK_VALUES_TABLE :
- "Expected second child of TOK_VIRTUAL_TABLE to be TOK_VALUE_TABLE but was " +
- valuesTable.getName();
- // Each of the children of TOK_VALUES_TABLE will be a TOK_VALUE_ROW
- List extends Node> valuesTableChildren = valuesTable.getChildren();
-
- // Now that we're going to start reading through the rows, open a file to write the rows too
- // If we leave this method before creating the temporary table we need to be sure to clean up
- // this file.
- Path tablePath = null;
- FileSystem fs = null;
- FSDataOutputStream out = null;
- try {
- if(dataDir == null) {
- tablePath = Warehouse.getDnsPath(new Path(ss.getTempTableSpace(), tableName), conf);
- }
- else {
- //if target table of insert is encrypted, make sure temporary table data is stored
- //similarly encrypted
- tablePath = Warehouse.getDnsPath(new Path(dataDir, tableName), conf);
- }
- fs = tablePath.getFileSystem(conf);
- fs.mkdirs(tablePath);
- Path dataFile = new Path(tablePath, "data_file");
- out = fs.create(dataFile);
- List fields = new ArrayList();
-
- boolean firstRow = true;
- for (Node n : valuesTableChildren) {
- ASTNode valuesRow = (ASTNode) n;
- assert valuesRow.getToken().getType() == HiveParser.TOK_VALUE_ROW :
- "Expected child of TOK_VALUE_TABLE to be TOK_VALUE_ROW but was " + valuesRow.getName();
- // Each of the children of this should be a literal
- List extends Node> valuesRowChildren = valuesRow.getChildren();
- boolean isFirst = true;
- int nextColNum = 1;
- for (Node n1 : valuesRowChildren) {
- ASTNode value = (ASTNode) n1;
- if (firstRow) {
- fields.add(new FieldSchema("tmp_values_col" + nextColNum++, "string", ""));
- }
- if (isFirst) {
- isFirst = false;
- } else {
- writeAsText("\u0001", out);
- }
- writeAsText(unparseExprForValuesClause(value), out);
- }
- writeAsText("\n", out);
- firstRow = false;
- }
-
- // Step 2, create a temp table, using the created file as the data
- StorageFormat format = new StorageFormat(conf);
- format.processStorageFormat("TextFile");
- Table table = db.newTable(tableName);
- table.setSerializationLib(format.getSerde());
- table.setFields(fields);
- table.setDataLocation(tablePath);
- table.getTTable().setTemporary(true);
- table.setStoredAsSubDirectories(false);
- table.setInputFormatClass(format.getInputFormat());
- table.setOutputFormatClass(format.getOutputFormat());
- db.createTable(table, false);
- } catch (Exception e) {
- String errMsg = ErrorMsg.INSERT_CANNOT_CREATE_TEMP_FILE.getMsg() + e.getMessage();
- LOG.error(errMsg);
- // Try to delete the file
- if (fs != null && tablePath != null) {
- try {
- fs.delete(tablePath, false);
- } catch (IOException swallowIt) {}
- }
- throw new SemanticException(errMsg, e);
- } finally {
- IOUtils.closeStream(out);
- }
-
- // Step 3, return a new subtree with a from clause built around that temp table
- // The form of the tree is TOK_TABREF->TOK_TABNAME->identifier(tablename)
- Token t = new ClassicToken(HiveParser.TOK_TABREF);
- ASTNode tabRef = new ASTNode(t);
- t = new ClassicToken(HiveParser.TOK_TABNAME);
- ASTNode tabNameNode = new ASTNode(t);
- tabRef.addChild(tabNameNode);
- t = new ClassicToken(HiveParser.Identifier, tableName);
- ASTNode identifier = new ASTNode(t);
- tabNameNode.addChild(identifier);
- return tabRef;
- }
-
// Take an expression in the values clause and turn it back into a string. This is far from
// comprehensive. At the moment it only supports:
// * literals (all types)
@@ -1560,12 +1432,6 @@ public boolean doPhase1(ASTNode ast, QB qb, Phase1Ctx ctx_1, PlannerContext plan
ASTNode frm = (ASTNode) ast.getChild(0);
if (frm.getToken().getType() == HiveParser.TOK_TABREF) {
processTable(qb, frm);
- } else if (frm.getToken().getType() == HiveParser.TOK_VIRTUAL_TABLE) {
- // Create a temp table with the passed values in it then rewrite this portion of the
- // tree to be from that table.
- ASTNode newFrom = genValuesTempTable(frm, qb);
- ast.setChild(0, newFrom);
- processTable(qb, newFrom);
} else if (frm.getToken().getType() == HiveParser.TOK_SUBQUERY) {
processSubQuery(qb, frm);
} else if (frm.getToken().getType() == HiveParser.TOK_LATERAL_VIEW ||
@@ -11445,7 +11311,6 @@ else if(ast.getChild(0).getType() == HiveParser.TOK_FALSE) {
* This will walk AST of an INSERT statement and assemble a list of target tables
* which are in an HDFS encryption zone. This is needed to make sure that so that
* the data from values clause of Insert ... select values(...) is stored securely.
- * See also {@link #genValuesTempTable(ASTNode, QB)}
* @throws SemanticException
*/
private void preProcessForInsert(ASTNode node, QB qb) throws SemanticException {
diff --git a/ql/src/test/queries/clientpositive/tablevalues.q b/ql/src/test/queries/clientpositive/tablevalues.q
new file mode 100644
index 0000000000..28415a2794
--- /dev/null
+++ b/ql/src/test/queries/clientpositive/tablevalues.q
@@ -0,0 +1,85 @@
+-- VALUES -> array(struct(),struct())
+-- TABLE -> LATERAL VIEW INLINE
+
+CREATE TABLE mytbl AS
+SELECT key, value
+FROM src
+ORDER BY key
+LIMIT 5;
+
+EXPLAIN
+SELECT tf.col1, tf.col2, tf.col3
+FROM
+ (SELECT key, value FROM mytbl) t
+ LATERAL VIEW
+ INLINE(array(struct('A', 10, t.key),struct('B', 20, t.key))) tf AS col1, col2, col3;
+
+SELECT tf.col1, tf.col2, tf.col3
+FROM
+ (SELECT key, value FROM mytbl) t
+ LATERAL VIEW
+ INLINE(array(struct('A', 10, t.key),struct('B', 20, t.key))) tf AS col1, col2, col3;
+
+EXPLAIN
+SELECT INLINE(array(struct('A', 10, 30),struct('B', 20, 30))) AS (col1, col2, col3);
+
+SELECT INLINE(array(struct('A', 10, 30),struct('B', 20, 30))) AS (col1, col2, col3);
+
+EXPLAIN
+SELECT tf.col1, tf.col2, tf.col3
+FROM
+ TABLE(VALUES('A', 10, 30.0),('B', 20, 30.0)) AS tf(col1, col2, col3);
+
+SELECT tf.col1, tf.col2, tf.col3
+FROM
+ TABLE(VALUES('A', 10, 30),('B', 20, 30)) AS tf(col1, col2, col3);
+
+-- CROSS PRODUCT (CANNOT BE EXPRESSED WITH LVJ)
+EXPLAIN
+SELECT tf.col1, tf.col2, tf.col3
+FROM
+ TABLE(VALUES('A', 10, 30),('B', 20, 30)) AS tf(col1, col2, col3),
+ (SELECT key, value FROM mytbl) t;
+
+SELECT tf.col1, tf.col2, tf.col3
+FROM
+ TABLE(VALUES('A', 10, 30),('B', 20, 30)) AS tf(col1, col2, col3),
+ (SELECT key, value FROM mytbl) t;
+
+-- CROSS PRODUCT (FIRST CANNOT BE EXPRESSED WITH LVJ, SECOND CAN
+-- BUT IT IS NOT NEEDED)
+EXPLAIN
+SELECT tf.col1, tf.col2, tf.col3
+FROM
+ TABLE(VALUES('A', 10, 30),('B', 20, 30)) AS tf(col1, col2, col3),
+ TABLE(VALUES('A', 10),('B', 20)) AS tf2(col1, col2);
+
+SELECT tf.col1, tf.col2, tf.col3
+FROM
+ TABLE(VALUES('A', 10, 30),('B', 20, 30)) AS tf(col1, col2, col3),
+ TABLE(VALUES('A', 10),('B', 20)) AS tf2(col1, col2);
+
+-- CROSS PRODUCT (CAN BE EXPRESSED WITH LVJ BUT IT IS NOT NEEDED)
+EXPLAIN
+SELECT tf.col1, tf.col2, tf.col3
+FROM
+ (SELECT key, value FROM mytbl) t,
+ TABLE(VALUES('A', 10, 30),('B', 20, 30)) AS tf(col1, col2, col3);
+
+SELECT tf.col1, tf.col2, tf.col3
+FROM
+ (SELECT key, value FROM mytbl) t,
+ TABLE(VALUES('A', 10, 30),('B', 20, 30)) AS tf(col1, col2, col3);
+
+-- LVJ (CORRELATED). LATERAL COULD BE OPTIONAL, BUT IF WE MAKE IT
+-- MANDATORY, IT HELPS US DISTINGUISHING FROM PREVIOUS CASE
+EXPLAIN
+SELECT tf.col1, tf.col2, tf.col3
+FROM
+ (SELECT key, value FROM mytbl) t,
+ LATERAL TABLE(VALUES('A', 10, t.key),('B', 20, t.key)) AS tf(col1, col2, col3);
+
+SELECT tf.col1, tf.col2, tf.col3
+FROM
+ (SELECT key, value FROM mytbl) t,
+ LATERAL TABLE(VALUES('A', 10, t.key),('B', 20, t.key)) AS tf(col1, col2, col3);
diff --git a/ql/src/test/results/clientpositive/insert_values_acid_not_bucketed.q.out b/ql/src/test/results/clientpositive/insert_values_acid_not_bucketed.q.out
index 7885ee44ee..6007c8097d 100644
--- a/ql/src/test/results/clientpositive/insert_values_acid_not_bucketed.q.out
+++ b/ql/src/test/results/clientpositive/insert_values_acid_not_bucketed.q.out
@@ -8,12 +8,14 @@ POSTHOOK: Output: database:default
POSTHOOK: Output: default@acid_notbucketed
PREHOOK: query: insert into table acid_notbucketed values (1, 'abc'), (2, 'def')
PREHOOK: type: QUERY
+PREHOOK: Input: _dummy_database@_dummy_table
PREHOOK: Output: default@acid_notbucketed
POSTHOOK: query: insert into table acid_notbucketed values (1, 'abc'), (2, 'def')
POSTHOOK: type: QUERY
+POSTHOOK: Input: _dummy_database@_dummy_table
POSTHOOK: Output: default@acid_notbucketed
-POSTHOOK: Lineage: acid_notbucketed.a EXPRESSION [(values__tmp__table__1)values__tmp__table__1.FieldSchema(name:tmp_values_col1, type:string, comment:), ]
-POSTHOOK: Lineage: acid_notbucketed.b EXPRESSION [(values__tmp__table__1)values__tmp__table__1.FieldSchema(name:tmp_values_col2, type:string, comment:), ]
+POSTHOOK: Lineage: acid_notbucketed.a SCRIPT []
+POSTHOOK: Lineage: acid_notbucketed.b SCRIPT []
PREHOOK: query: select * from acid_notbucketed
PREHOOK: type: QUERY
PREHOOK: Input: default@acid_notbucketed
diff --git a/ql/src/test/results/clientpositive/insert_values_dynamic_partitioned.q.out b/ql/src/test/results/clientpositive/insert_values_dynamic_partitioned.q.out
index 7da63939bd..cd234b566a 100644
--- a/ql/src/test/results/clientpositive/insert_values_dynamic_partitioned.q.out
+++ b/ql/src/test/results/clientpositive/insert_values_dynamic_partitioned.q.out
@@ -14,19 +14,21 @@ PREHOOK: query: insert into table ivdp partition (ds) values
(1, 109.23, 'and everywhere that mary went', 'today'),
(6553, 923.19, 'the lamb was sure to go', 'tomorrow')
PREHOOK: type: QUERY
+PREHOOK: Input: _dummy_database@_dummy_table
PREHOOK: Output: default@ivdp
POSTHOOK: query: insert into table ivdp partition (ds) values
(1, 109.23, 'and everywhere that mary went', 'today'),
(6553, 923.19, 'the lamb was sure to go', 'tomorrow')
POSTHOOK: type: QUERY
+POSTHOOK: Input: _dummy_database@_dummy_table
POSTHOOK: Output: default@ivdp@ds=today
POSTHOOK: Output: default@ivdp@ds=tomorrow
-POSTHOOK: Lineage: ivdp PARTITION(ds=today).de EXPRESSION [(values__tmp__table__1)values__tmp__table__1.FieldSchema(name:tmp_values_col2, type:string, comment:), ]
-POSTHOOK: Lineage: ivdp PARTITION(ds=today).i EXPRESSION [(values__tmp__table__1)values__tmp__table__1.FieldSchema(name:tmp_values_col1, type:string, comment:), ]
-POSTHOOK: Lineage: ivdp PARTITION(ds=today).vc EXPRESSION [(values__tmp__table__1)values__tmp__table__1.FieldSchema(name:tmp_values_col3, type:string, comment:), ]
-POSTHOOK: Lineage: ivdp PARTITION(ds=tomorrow).de EXPRESSION [(values__tmp__table__1)values__tmp__table__1.FieldSchema(name:tmp_values_col2, type:string, comment:), ]
-POSTHOOK: Lineage: ivdp PARTITION(ds=tomorrow).i EXPRESSION [(values__tmp__table__1)values__tmp__table__1.FieldSchema(name:tmp_values_col1, type:string, comment:), ]
-POSTHOOK: Lineage: ivdp PARTITION(ds=tomorrow).vc EXPRESSION [(values__tmp__table__1)values__tmp__table__1.FieldSchema(name:tmp_values_col3, type:string, comment:), ]
+POSTHOOK: Lineage: ivdp PARTITION(ds=today).de SCRIPT []
+POSTHOOK: Lineage: ivdp PARTITION(ds=today).i SCRIPT []
+POSTHOOK: Lineage: ivdp PARTITION(ds=today).vc SCRIPT []
+POSTHOOK: Lineage: ivdp PARTITION(ds=tomorrow).de SCRIPT []
+POSTHOOK: Lineage: ivdp PARTITION(ds=tomorrow).i SCRIPT []
+POSTHOOK: Lineage: ivdp PARTITION(ds=tomorrow).vc SCRIPT []
PREHOOK: query: select * from ivdp order by ds
PREHOOK: type: QUERY
PREHOOK: Input: default@ivdp
diff --git a/ql/src/test/results/clientpositive/insert_values_non_partitioned.q.out b/ql/src/test/results/clientpositive/insert_values_non_partitioned.q.out
index 189f50d84d..38193510c4 100644
--- a/ql/src/test/results/clientpositive/insert_values_non_partitioned.q.out
+++ b/ql/src/test/results/clientpositive/insert_values_non_partitioned.q.out
@@ -35,26 +35,28 @@ PREHOOK: query: insert into table acid_ivnp values
(null, null, null, null, null, null, null, null, null, null, null, null, null),
(3, 25, 6553, null, 0.14, 1923.141592654, 1.2301, '2014-08-24 17:21:30.0', '2014-08-26', false, 'its fleece was white as snow', 'a pocket full of posies', 'blue' )
PREHOOK: type: QUERY
+PREHOOK: Input: _dummy_database@_dummy_table
PREHOOK: Output: default@acid_ivnp
POSTHOOK: query: insert into table acid_ivnp values
(1, 257, 65537, 4294967297, 3.14, 3.141592654, 109.23, '2014-08-25 17:21:30.0', '2014-08-25', true, 'mary had a little lamb', 'ring around the rosie', 'red'),
(null, null, null, null, null, null, null, null, null, null, null, null, null),
(3, 25, 6553, null, 0.14, 1923.141592654, 1.2301, '2014-08-24 17:21:30.0', '2014-08-26', false, 'its fleece was white as snow', 'a pocket full of posies', 'blue' )
POSTHOOK: type: QUERY
+POSTHOOK: Input: _dummy_database@_dummy_table
POSTHOOK: Output: default@acid_ivnp
-POSTHOOK: Lineage: acid_ivnp.b EXPRESSION [(values__tmp__table__1)values__tmp__table__1.FieldSchema(name:tmp_values_col10, type:string, comment:), ]
-POSTHOOK: Lineage: acid_ivnp.bi EXPRESSION [(values__tmp__table__1)values__tmp__table__1.FieldSchema(name:tmp_values_col4, type:string, comment:), ]
-POSTHOOK: Lineage: acid_ivnp.ch EXPRESSION [(values__tmp__table__1)values__tmp__table__1.FieldSchema(name:tmp_values_col13, type:string, comment:), ]
-POSTHOOK: Lineage: acid_ivnp.d EXPRESSION [(values__tmp__table__1)values__tmp__table__1.FieldSchema(name:tmp_values_col6, type:string, comment:), ]
-POSTHOOK: Lineage: acid_ivnp.de EXPRESSION [(values__tmp__table__1)values__tmp__table__1.FieldSchema(name:tmp_values_col7, type:string, comment:), ]
-POSTHOOK: Lineage: acid_ivnp.dt EXPRESSION [(values__tmp__table__1)values__tmp__table__1.FieldSchema(name:tmp_values_col9, type:string, comment:), ]
-POSTHOOK: Lineage: acid_ivnp.f EXPRESSION [(values__tmp__table__1)values__tmp__table__1.FieldSchema(name:tmp_values_col5, type:string, comment:), ]
-POSTHOOK: Lineage: acid_ivnp.i EXPRESSION [(values__tmp__table__1)values__tmp__table__1.FieldSchema(name:tmp_values_col3, type:string, comment:), ]
-POSTHOOK: Lineage: acid_ivnp.s SIMPLE [(values__tmp__table__1)values__tmp__table__1.FieldSchema(name:tmp_values_col11, type:string, comment:), ]
-POSTHOOK: Lineage: acid_ivnp.si EXPRESSION [(values__tmp__table__1)values__tmp__table__1.FieldSchema(name:tmp_values_col2, type:string, comment:), ]
-POSTHOOK: Lineage: acid_ivnp.t EXPRESSION [(values__tmp__table__1)values__tmp__table__1.FieldSchema(name:tmp_values_col8, type:string, comment:), ]
-POSTHOOK: Lineage: acid_ivnp.ti EXPRESSION [(values__tmp__table__1)values__tmp__table__1.FieldSchema(name:tmp_values_col1, type:string, comment:), ]
-POSTHOOK: Lineage: acid_ivnp.vc EXPRESSION [(values__tmp__table__1)values__tmp__table__1.FieldSchema(name:tmp_values_col12, type:string, comment:), ]
+POSTHOOK: Lineage: acid_ivnp.b SCRIPT []
+POSTHOOK: Lineage: acid_ivnp.bi SCRIPT []
+POSTHOOK: Lineage: acid_ivnp.ch SCRIPT []
+POSTHOOK: Lineage: acid_ivnp.d SCRIPT []
+POSTHOOK: Lineage: acid_ivnp.de SCRIPT []
+POSTHOOK: Lineage: acid_ivnp.dt SCRIPT []
+POSTHOOK: Lineage: acid_ivnp.f SCRIPT []
+POSTHOOK: Lineage: acid_ivnp.i SCRIPT []
+POSTHOOK: Lineage: acid_ivnp.s SCRIPT []
+POSTHOOK: Lineage: acid_ivnp.si SCRIPT []
+POSTHOOK: Lineage: acid_ivnp.t SCRIPT []
+POSTHOOK: Lineage: acid_ivnp.ti SCRIPT []
+POSTHOOK: Lineage: acid_ivnp.vc SCRIPT []
PREHOOK: query: select * from acid_ivnp order by ti
PREHOOK: type: QUERY
PREHOOK: Input: default@acid_ivnp
diff --git a/ql/src/test/results/clientpositive/insert_values_nonascii.q.out b/ql/src/test/results/clientpositive/insert_values_nonascii.q.out
index 62514da30d..cea30e7bf5 100644
--- a/ql/src/test/results/clientpositive/insert_values_nonascii.q.out
+++ b/ql/src/test/results/clientpositive/insert_values_nonascii.q.out
@@ -8,12 +8,14 @@ POSTHOOK: Output: database:default
POSTHOOK: Output: default@insert_values_nonascii
PREHOOK: query: insert into insert_values_nonascii values("Абвгде Garçu 谢谢", "Kôkaku ありがとう"), ("ございます", "kidôtai한국어")
PREHOOK: type: QUERY
+PREHOOK: Input: _dummy_database@_dummy_table
PREHOOK: Output: default@insert_values_nonascii
POSTHOOK: query: insert into insert_values_nonascii values("Абвгде Garçu 谢谢", "Kôkaku ありがとう"), ("ございます", "kidôtai한국어")
POSTHOOK: type: QUERY
+POSTHOOK: Input: _dummy_database@_dummy_table
POSTHOOK: Output: default@insert_values_nonascii
-POSTHOOK: Lineage: insert_values_nonascii.t1 EXPRESSION [(values__tmp__table__1)values__tmp__table__1.FieldSchema(name:tmp_values_col1, type:string, comment:), ]
-POSTHOOK: Lineage: insert_values_nonascii.t2 SIMPLE [(values__tmp__table__1)values__tmp__table__1.FieldSchema(name:tmp_values_col2, type:string, comment:), ]
+POSTHOOK: Lineage: insert_values_nonascii.t1 SCRIPT []
+POSTHOOK: Lineage: insert_values_nonascii.t2 SCRIPT []
PREHOOK: query: select * from insert_values_nonascii
PREHOOK: type: QUERY
PREHOOK: Input: default@insert_values_nonascii
diff --git a/ql/src/test/results/clientpositive/insert_values_partitioned.q.out b/ql/src/test/results/clientpositive/insert_values_partitioned.q.out
index 48dfadc1aa..6136b1aa33 100644
--- a/ql/src/test/results/clientpositive/insert_values_partitioned.q.out
+++ b/ql/src/test/results/clientpositive/insert_values_partitioned.q.out
@@ -32,24 +32,26 @@ PREHOOK: query: insert into table acid_ivp partition (ds='today') values
(1, 257, 65537, 4294967297, 3.14, 3.141592654, 109.23, '2014-08-25 17:21:30.0', '2014-08-25', 'mary had a little lamb', 'ring around the rosie', 'red'),
(3, 25, 6553, 429496729, 0.14, 1923.141592654, 1.2301, '2014-08-24 17:21:30.0', '2014-08-26', 'its fleece was white as snow', 'a pocket full of posies', 'blue')
PREHOOK: type: QUERY
+PREHOOK: Input: _dummy_database@_dummy_table
PREHOOK: Output: default@acid_ivp@ds=today
POSTHOOK: query: insert into table acid_ivp partition (ds='today') values
(1, 257, 65537, 4294967297, 3.14, 3.141592654, 109.23, '2014-08-25 17:21:30.0', '2014-08-25', 'mary had a little lamb', 'ring around the rosie', 'red'),
(3, 25, 6553, 429496729, 0.14, 1923.141592654, 1.2301, '2014-08-24 17:21:30.0', '2014-08-26', 'its fleece was white as snow', 'a pocket full of posies', 'blue')
POSTHOOK: type: QUERY
+POSTHOOK: Input: _dummy_database@_dummy_table
POSTHOOK: Output: default@acid_ivp@ds=today
-POSTHOOK: Lineage: acid_ivp PARTITION(ds=today).bi EXPRESSION [(values__tmp__table__1)values__tmp__table__1.FieldSchema(name:tmp_values_col4, type:string, comment:), ]
-POSTHOOK: Lineage: acid_ivp PARTITION(ds=today).ch EXPRESSION [(values__tmp__table__1)values__tmp__table__1.FieldSchema(name:tmp_values_col12, type:string, comment:), ]
-POSTHOOK: Lineage: acid_ivp PARTITION(ds=today).d EXPRESSION [(values__tmp__table__1)values__tmp__table__1.FieldSchema(name:tmp_values_col6, type:string, comment:), ]
-POSTHOOK: Lineage: acid_ivp PARTITION(ds=today).de EXPRESSION [(values__tmp__table__1)values__tmp__table__1.FieldSchema(name:tmp_values_col7, type:string, comment:), ]
-POSTHOOK: Lineage: acid_ivp PARTITION(ds=today).dt EXPRESSION [(values__tmp__table__1)values__tmp__table__1.FieldSchema(name:tmp_values_col9, type:string, comment:), ]
-POSTHOOK: Lineage: acid_ivp PARTITION(ds=today).f EXPRESSION [(values__tmp__table__1)values__tmp__table__1.FieldSchema(name:tmp_values_col5, type:string, comment:), ]
-POSTHOOK: Lineage: acid_ivp PARTITION(ds=today).i EXPRESSION [(values__tmp__table__1)values__tmp__table__1.FieldSchema(name:tmp_values_col3, type:string, comment:), ]
-POSTHOOK: Lineage: acid_ivp PARTITION(ds=today).s SIMPLE [(values__tmp__table__1)values__tmp__table__1.FieldSchema(name:tmp_values_col10, type:string, comment:), ]
-POSTHOOK: Lineage: acid_ivp PARTITION(ds=today).si EXPRESSION [(values__tmp__table__1)values__tmp__table__1.FieldSchema(name:tmp_values_col2, type:string, comment:), ]
-POSTHOOK: Lineage: acid_ivp PARTITION(ds=today).t EXPRESSION [(values__tmp__table__1)values__tmp__table__1.FieldSchema(name:tmp_values_col8, type:string, comment:), ]
-POSTHOOK: Lineage: acid_ivp PARTITION(ds=today).ti EXPRESSION [(values__tmp__table__1)values__tmp__table__1.FieldSchema(name:tmp_values_col1, type:string, comment:), ]
-POSTHOOK: Lineage: acid_ivp PARTITION(ds=today).vc EXPRESSION [(values__tmp__table__1)values__tmp__table__1.FieldSchema(name:tmp_values_col11, type:string, comment:), ]
+POSTHOOK: Lineage: acid_ivp PARTITION(ds=today).bi SCRIPT []
+POSTHOOK: Lineage: acid_ivp PARTITION(ds=today).ch SCRIPT []
+POSTHOOK: Lineage: acid_ivp PARTITION(ds=today).d SCRIPT []
+POSTHOOK: Lineage: acid_ivp PARTITION(ds=today).de SCRIPT []
+POSTHOOK: Lineage: acid_ivp PARTITION(ds=today).dt SCRIPT []
+POSTHOOK: Lineage: acid_ivp PARTITION(ds=today).f SCRIPT []
+POSTHOOK: Lineage: acid_ivp PARTITION(ds=today).i SCRIPT []
+POSTHOOK: Lineage: acid_ivp PARTITION(ds=today).s SCRIPT []
+POSTHOOK: Lineage: acid_ivp PARTITION(ds=today).si SCRIPT []
+POSTHOOK: Lineage: acid_ivp PARTITION(ds=today).t SCRIPT []
+POSTHOOK: Lineage: acid_ivp PARTITION(ds=today).ti SCRIPT []
+POSTHOOK: Lineage: acid_ivp PARTITION(ds=today).vc SCRIPT []
PREHOOK: query: select * from acid_ivp order by i
PREHOOK: type: QUERY
PREHOOK: Input: default@acid_ivp
diff --git a/ql/src/test/results/clientpositive/insert_values_tmp_table.q.out b/ql/src/test/results/clientpositive/insert_values_tmp_table.q.out
index 4e4eafd85f..81a9e6d922 100644
--- a/ql/src/test/results/clientpositive/insert_values_tmp_table.q.out
+++ b/ql/src/test/results/clientpositive/insert_values_tmp_table.q.out
@@ -11,16 +11,18 @@ PREHOOK: query: insert into table acid_ivtt values
(429496729, 0.14, 'its fleece was white as snow'),
(-29496729, -0.14, 'negative values test')
PREHOOK: type: QUERY
+PREHOOK: Input: _dummy_database@_dummy_table
PREHOOK: Output: default@acid_ivtt
POSTHOOK: query: insert into table acid_ivtt values
(1, 109.23, 'mary had a little lamb'),
(429496729, 0.14, 'its fleece was white as snow'),
(-29496729, -0.14, 'negative values test')
POSTHOOK: type: QUERY
+POSTHOOK: Input: _dummy_database@_dummy_table
POSTHOOK: Output: default@acid_ivtt
-POSTHOOK: Lineage: acid_ivtt.de EXPRESSION [(values__tmp__table__1)values__tmp__table__1.FieldSchema(name:tmp_values_col2, type:string, comment:), ]
-POSTHOOK: Lineage: acid_ivtt.i EXPRESSION [(values__tmp__table__1)values__tmp__table__1.FieldSchema(name:tmp_values_col1, type:string, comment:), ]
-POSTHOOK: Lineage: acid_ivtt.vc EXPRESSION [(values__tmp__table__1)values__tmp__table__1.FieldSchema(name:tmp_values_col3, type:string, comment:), ]
+POSTHOOK: Lineage: acid_ivtt.de SCRIPT []
+POSTHOOK: Lineage: acid_ivtt.i SCRIPT []
+POSTHOOK: Lineage: acid_ivtt.vc SCRIPT []
PREHOOK: query: select i, de, vc from acid_ivtt order by i
PREHOOK: type: QUERY
PREHOOK: Input: default@acid_ivtt
diff --git a/ql/src/test/results/clientpositive/tablevalues.q.out b/ql/src/test/results/clientpositive/tablevalues.q.out
new file mode 100644
index 0000000000..0e0aa48fbf
--- /dev/null
+++ b/ql/src/test/results/clientpositive/tablevalues.q.out
@@ -0,0 +1,616 @@
+PREHOOK: query: CREATE TABLE mytbl AS
+SELECT key, value
+FROM src
+ORDER BY key
+LIMIT 5
+PREHOOK: type: CREATETABLE_AS_SELECT
+PREHOOK: Input: default@src
+PREHOOK: Output: database:default
+PREHOOK: Output: default@mytbl
+POSTHOOK: query: CREATE TABLE mytbl AS
+SELECT key, value
+FROM src
+ORDER BY key
+LIMIT 5
+POSTHOOK: type: CREATETABLE_AS_SELECT
+POSTHOOK: Input: default@src
+POSTHOOK: Output: database:default
+POSTHOOK: Output: default@mytbl
+POSTHOOK: Lineage: mytbl.key SIMPLE [(src)src.FieldSchema(name:key, type:string, comment:default), ]
+POSTHOOK: Lineage: mytbl.value SIMPLE [(src)src.FieldSchema(name:value, type:string, comment:default), ]
+PREHOOK: query: EXPLAIN
+SELECT tf.col1, tf.col2, tf.col3
+FROM
+ (SELECT key, value FROM mytbl) t
+ LATERAL VIEW
+ INLINE(array(struct('A', 10, t.key),struct('B', 20, t.key))) tf AS col1, col2, col3
+PREHOOK: type: QUERY
+POSTHOOK: query: EXPLAIN
+SELECT tf.col1, tf.col2, tf.col3
+FROM
+ (SELECT key, value FROM mytbl) t
+ LATERAL VIEW
+ INLINE(array(struct('A', 10, t.key),struct('B', 20, t.key))) tf AS col1, col2, col3
+POSTHOOK: type: QUERY
+STAGE DEPENDENCIES:
+ Stage-1 is a root stage
+ Stage-0 depends on stages: Stage-1
+
+STAGE PLANS:
+ Stage: Stage-1
+ Map Reduce
+ Map Operator Tree:
+ TableScan
+ alias: mytbl
+ Statistics: Num rows: 5 Data size: 41 Basic stats: COMPLETE Column stats: NONE
+ Select Operator
+ expressions: key (type: string)
+ outputColumnNames: _col0
+ Statistics: Num rows: 5 Data size: 41 Basic stats: COMPLETE Column stats: NONE
+ Lateral View Forward
+ Statistics: Num rows: 5 Data size: 41 Basic stats: COMPLETE Column stats: NONE
+ Select Operator
+ Statistics: Num rows: 5 Data size: 41 Basic stats: COMPLETE Column stats: NONE
+ Lateral View Join Operator
+ outputColumnNames: _col2, _col3, _col4
+ Statistics: Num rows: 10 Data size: 82 Basic stats: COMPLETE Column stats: NONE
+ Select Operator
+ expressions: _col2 (type: string), _col3 (type: int), _col4 (type: string)
+ outputColumnNames: _col0, _col1, _col2
+ Statistics: Num rows: 10 Data size: 82 Basic stats: COMPLETE Column stats: NONE
+ File Output Operator
+ compressed: false
+ Statistics: Num rows: 10 Data size: 82 Basic stats: COMPLETE Column stats: NONE
+ table:
+ input format: org.apache.hadoop.mapred.SequenceFileInputFormat
+ output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
+ serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
+ Select Operator
+ expressions: array(struct('A',10,_col0),struct('B',20,_col0)) (type: array>)
+ outputColumnNames: _col0
+ Statistics: Num rows: 5 Data size: 41 Basic stats: COMPLETE Column stats: NONE
+ UDTF Operator
+ Statistics: Num rows: 5 Data size: 41 Basic stats: COMPLETE Column stats: NONE
+ function name: inline
+ Lateral View Join Operator
+ outputColumnNames: _col2, _col3, _col4
+ Statistics: Num rows: 10 Data size: 82 Basic stats: COMPLETE Column stats: NONE
+ Select Operator
+ expressions: _col2 (type: string), _col3 (type: int), _col4 (type: string)
+ outputColumnNames: _col0, _col1, _col2
+ Statistics: Num rows: 10 Data size: 82 Basic stats: COMPLETE Column stats: NONE
+ File Output Operator
+ compressed: false
+ Statistics: Num rows: 10 Data size: 82 Basic stats: COMPLETE Column stats: NONE
+ table:
+ input format: org.apache.hadoop.mapred.SequenceFileInputFormat
+ output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
+ serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
+
+ Stage: Stage-0
+ Fetch Operator
+ limit: -1
+ Processor Tree:
+ ListSink
+
+PREHOOK: query: SELECT tf.col1, tf.col2, tf.col3
+FROM
+ (SELECT key, value FROM mytbl) t
+ LATERAL VIEW
+ INLINE(array(struct('A', 10, t.key),struct('B', 20, t.key))) tf AS col1, col2, col3
+PREHOOK: type: QUERY
+PREHOOK: Input: default@mytbl
+#### A masked pattern was here ####
+POSTHOOK: query: SELECT tf.col1, tf.col2, tf.col3
+FROM
+ (SELECT key, value FROM mytbl) t
+ LATERAL VIEW
+ INLINE(array(struct('A', 10, t.key),struct('B', 20, t.key))) tf AS col1, col2, col3
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@mytbl
+#### A masked pattern was here ####
+A 10 0
+B 20 0
+A 10 0
+B 20 0
+A 10 0
+B 20 0
+A 10 10
+B 20 10
+A 10 100
+B 20 100
+PREHOOK: query: EXPLAIN
+SELECT INLINE(array(struct('A', 10, 30),struct('B', 20, 30))) AS (col1, col2, col3)
+PREHOOK: type: QUERY
+POSTHOOK: query: EXPLAIN
+SELECT INLINE(array(struct('A', 10, 30),struct('B', 20, 30))) AS (col1, col2, col3)
+POSTHOOK: type: QUERY
+STAGE DEPENDENCIES:
+ Stage-1 is a root stage
+ Stage-0 depends on stages: Stage-1
+
+STAGE PLANS:
+ Stage: Stage-1
+ Map Reduce
+ Map Operator Tree:
+ TableScan
+ alias: _dummy_table
+ Row Limit Per Split: 1
+ Statistics: Num rows: 1 Data size: 10 Basic stats: COMPLETE Column stats: COMPLETE
+ Select Operator
+ expressions: array(const struct('A',10,30),const struct('B',20,30)) (type: array>)
+ outputColumnNames: _col0
+ Statistics: Num rows: 1 Data size: 56 Basic stats: COMPLETE Column stats: COMPLETE
+ UDTF Operator
+ Statistics: Num rows: 1 Data size: 56 Basic stats: COMPLETE Column stats: COMPLETE
+ function name: inline
+ Select Operator
+ expressions: col1 (type: string), col2 (type: int), col3 (type: int)
+ outputColumnNames: _col0, _col1, _col2
+ Statistics: Num rows: 1 Data size: 8 Basic stats: COMPLETE Column stats: COMPLETE
+ File Output Operator
+ compressed: false
+ Statistics: Num rows: 1 Data size: 8 Basic stats: COMPLETE Column stats: COMPLETE
+ table:
+ input format: org.apache.hadoop.mapred.SequenceFileInputFormat
+ output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
+ serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
+
+ Stage: Stage-0
+ Fetch Operator
+ limit: -1
+ Processor Tree:
+ ListSink
+
+PREHOOK: query: SELECT INLINE(array(struct('A', 10, 30),struct('B', 20, 30))) AS (col1, col2, col3)
+PREHOOK: type: QUERY
+PREHOOK: Input: _dummy_database@_dummy_table
+#### A masked pattern was here ####
+POSTHOOK: query: SELECT INLINE(array(struct('A', 10, 30),struct('B', 20, 30))) AS (col1, col2, col3)
+POSTHOOK: type: QUERY
+POSTHOOK: Input: _dummy_database@_dummy_table
+#### A masked pattern was here ####
+A 10 30
+B 20 30
+PREHOOK: query: EXPLAIN
+SELECT tf.col1, tf.col2, tf.col3
+FROM
+ TABLE(VALUES('A', 10, 30.0),('B', 20, 30.0)) AS tf(col1, col2, col3)
+PREHOOK: type: QUERY
+POSTHOOK: query: EXPLAIN
+SELECT tf.col1, tf.col2, tf.col3
+FROM
+ TABLE(VALUES('A', 10, 30.0),('B', 20, 30.0)) AS tf(col1, col2, col3)
+POSTHOOK: type: QUERY
+STAGE DEPENDENCIES:
+ Stage-1 is a root stage
+ Stage-0 depends on stages: Stage-1
+
+STAGE PLANS:
+ Stage: Stage-1
+ Map Reduce
+ Map Operator Tree:
+ TableScan
+ alias: _dummy_table
+ Row Limit Per Split: 1
+ Statistics: Num rows: 1 Data size: 10 Basic stats: COMPLETE Column stats: COMPLETE
+ Select Operator
+ expressions: array(const struct('A',10,30),const struct('B',20,30)) (type: array>)
+ outputColumnNames: _col0
+ Statistics: Num rows: 1 Data size: 3640 Basic stats: COMPLETE Column stats: COMPLETE
+ UDTF Operator
+ Statistics: Num rows: 1 Data size: 3640 Basic stats: COMPLETE Column stats: COMPLETE
+ function name: inline
+ Select Operator
+ expressions: col1 (type: string), col2 (type: int), col3 (type: decimal(2,0))
+ outputColumnNames: _col0, _col1, _col2
+ Statistics: Num rows: 1 Data size: 8 Basic stats: COMPLETE Column stats: COMPLETE
+ File Output Operator
+ compressed: false
+ Statistics: Num rows: 1 Data size: 8 Basic stats: COMPLETE Column stats: COMPLETE
+ table:
+ input format: org.apache.hadoop.mapred.SequenceFileInputFormat
+ output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
+ serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
+
+ Stage: Stage-0
+ Fetch Operator
+ limit: -1
+ Processor Tree:
+ ListSink
+
+PREHOOK: query: SELECT tf.col1, tf.col2, tf.col3
+FROM
+ TABLE(VALUES('A', 10, 30),('B', 20, 30)) AS tf(col1, col2, col3)
+PREHOOK: type: QUERY
+PREHOOK: Input: _dummy_database@_dummy_table
+#### A masked pattern was here ####
+POSTHOOK: query: SELECT tf.col1, tf.col2, tf.col3
+FROM
+ TABLE(VALUES('A', 10, 30),('B', 20, 30)) AS tf(col1, col2, col3)
+POSTHOOK: type: QUERY
+POSTHOOK: Input: _dummy_database@_dummy_table
+#### A masked pattern was here ####
+A 10 30
+B 20 30
+Warning: Shuffle Join JOIN[8][tables = [$hdt$_0, $hdt$_1]] in Stage 'Stage-1:MAPRED' is a cross product
+PREHOOK: query: EXPLAIN
+SELECT tf.col1, tf.col2, tf.col3
+FROM
+ TABLE(VALUES('A', 10, 30),('B', 20, 30)) AS tf(col1, col2, col3),
+ (SELECT key, value FROM mytbl) t
+PREHOOK: type: QUERY
+POSTHOOK: query: EXPLAIN
+SELECT tf.col1, tf.col2, tf.col3
+FROM
+ TABLE(VALUES('A', 10, 30),('B', 20, 30)) AS tf(col1, col2, col3),
+ (SELECT key, value FROM mytbl) t
+POSTHOOK: type: QUERY
+STAGE DEPENDENCIES:
+ Stage-1 is a root stage
+ Stage-0 depends on stages: Stage-1
+
+STAGE PLANS:
+ Stage: Stage-1
+ Map Reduce
+ Map Operator Tree:
+ TableScan
+ alias: _dummy_table
+ Row Limit Per Split: 1
+ Statistics: Num rows: 1 Data size: 10 Basic stats: COMPLETE Column stats: COMPLETE
+ Select Operator
+ expressions: array(const struct('A',10,30),const struct('B',20,30)) (type: array>)
+ outputColumnNames: _col0
+ Statistics: Num rows: 1 Data size: 2560 Basic stats: COMPLETE Column stats: COMPLETE
+ UDTF Operator
+ Statistics: Num rows: 1 Data size: 2560 Basic stats: COMPLETE Column stats: COMPLETE
+ function name: inline
+ Reduce Output Operator
+ sort order:
+ Statistics: Num rows: 1 Data size: 2560 Basic stats: COMPLETE Column stats: COMPLETE
+ value expressions: col1 (type: string), col2 (type: int), col3 (type: int)
+ TableScan
+ alias: mytbl
+ Statistics: Num rows: 5 Data size: 41 Basic stats: COMPLETE Column stats: COMPLETE
+ Select Operator
+ Statistics: Num rows: 5 Data size: 20 Basic stats: COMPLETE Column stats: COMPLETE
+ Reduce Output Operator
+ sort order:
+ Statistics: Num rows: 5 Data size: 20 Basic stats: COMPLETE Column stats: COMPLETE
+ Reduce Operator Tree:
+ Join Operator
+ condition map:
+ Inner Join 0 to 1
+ keys:
+ 0
+ 1
+ outputColumnNames: _col0, _col1, _col2
+ Statistics: Num rows: 5 Data size: 580 Basic stats: COMPLETE Column stats: COMPLETE
+ File Output Operator
+ compressed: false
+ Statistics: Num rows: 5 Data size: 580 Basic stats: COMPLETE Column stats: COMPLETE
+ table:
+ input format: org.apache.hadoop.mapred.SequenceFileInputFormat
+ output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
+ serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
+
+ Stage: Stage-0
+ Fetch Operator
+ limit: -1
+ Processor Tree:
+ ListSink
+
+Warning: Shuffle Join JOIN[8][tables = [$hdt$_0, $hdt$_1]] in Stage 'Stage-1:MAPRED' is a cross product
+PREHOOK: query: SELECT tf.col1, tf.col2, tf.col3
+FROM
+ TABLE(VALUES('A', 10, 30),('B', 20, 30)) AS tf(col1, col2, col3),
+ (SELECT key, value FROM mytbl) t
+PREHOOK: type: QUERY
+PREHOOK: Input: _dummy_database@_dummy_table
+PREHOOK: Input: default@mytbl
+#### A masked pattern was here ####
+POSTHOOK: query: SELECT tf.col1, tf.col2, tf.col3
+FROM
+ TABLE(VALUES('A', 10, 30),('B', 20, 30)) AS tf(col1, col2, col3),
+ (SELECT key, value FROM mytbl) t
+POSTHOOK: type: QUERY
+POSTHOOK: Input: _dummy_database@_dummy_table
+POSTHOOK: Input: default@mytbl
+#### A masked pattern was here ####
+B 20 30
+B 20 30
+B 20 30
+B 20 30
+B 20 30
+A 10 30
+A 10 30
+A 10 30
+A 10 30
+A 10 30
+Warning: Shuffle Join JOIN[10][tables = [$hdt$_0, $hdt$_1]] in Stage 'Stage-1:MAPRED' is a cross product
+PREHOOK: query: EXPLAIN
+SELECT tf.col1, tf.col2, tf.col3
+FROM
+ TABLE(VALUES('A', 10, 30),('B', 20, 30)) AS tf(col1, col2, col3),
+ TABLE(VALUES('A', 10),('B', 20)) AS tf2(col1, col2)
+PREHOOK: type: QUERY
+POSTHOOK: query: EXPLAIN
+SELECT tf.col1, tf.col2, tf.col3
+FROM
+ TABLE(VALUES('A', 10, 30),('B', 20, 30)) AS tf(col1, col2, col3),
+ TABLE(VALUES('A', 10),('B', 20)) AS tf2(col1, col2)
+POSTHOOK: type: QUERY
+STAGE DEPENDENCIES:
+ Stage-1 is a root stage
+ Stage-0 depends on stages: Stage-1
+
+STAGE PLANS:
+ Stage: Stage-1
+ Map Reduce
+ Map Operator Tree:
+ TableScan
+ alias: _dummy_table
+ Row Limit Per Split: 1
+ Statistics: Num rows: 1 Data size: 10 Basic stats: COMPLETE Column stats: COMPLETE
+ Select Operator
+ expressions: array(const struct('A',10,30),const struct('B',20,30)) (type: array>)
+ outputColumnNames: _col0
+ Statistics: Num rows: 1 Data size: 2560 Basic stats: COMPLETE Column stats: COMPLETE
+ UDTF Operator
+ Statistics: Num rows: 1 Data size: 2560 Basic stats: COMPLETE Column stats: COMPLETE
+ function name: inline
+ Reduce Output Operator
+ sort order:
+ Statistics: Num rows: 1 Data size: 2560 Basic stats: COMPLETE Column stats: COMPLETE
+ value expressions: col1 (type: string), col2 (type: int), col3 (type: int)
+ TableScan
+ alias: _dummy_table
+ Row Limit Per Split: 1
+ Statistics: Num rows: 1 Data size: 10 Basic stats: COMPLETE Column stats: COMPLETE
+ Select Operator
+ expressions: array(const struct('A',10),const struct('B',20)) (type: array>)
+ outputColumnNames: _col0
+ Statistics: Num rows: 1 Data size: 2440 Basic stats: COMPLETE Column stats: COMPLETE
+ UDTF Operator
+ Statistics: Num rows: 1 Data size: 2440 Basic stats: COMPLETE Column stats: COMPLETE
+ function name: inline
+ Reduce Output Operator
+ sort order:
+ Statistics: Num rows: 1 Data size: 2440 Basic stats: COMPLETE Column stats: COMPLETE
+ Reduce Operator Tree:
+ Join Operator
+ condition map:
+ Inner Join 0 to 1
+ keys:
+ 0
+ 1
+ outputColumnNames: _col0, _col1, _col2
+ Statistics: Num rows: 1 Data size: 116 Basic stats: COMPLETE Column stats: COMPLETE
+ File Output Operator
+ compressed: false
+ Statistics: Num rows: 1 Data size: 116 Basic stats: COMPLETE Column stats: COMPLETE
+ table:
+ input format: org.apache.hadoop.mapred.SequenceFileInputFormat
+ output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
+ serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
+
+ Stage: Stage-0
+ Fetch Operator
+ limit: -1
+ Processor Tree:
+ ListSink
+
+Warning: Shuffle Join JOIN[10][tables = [$hdt$_0, $hdt$_1]] in Stage 'Stage-1:MAPRED' is a cross product
+PREHOOK: query: SELECT tf.col1, tf.col2, tf.col3
+FROM
+ TABLE(VALUES('A', 10, 30),('B', 20, 30)) AS tf(col1, col2, col3),
+ TABLE(VALUES('A', 10),('B', 20)) AS tf2(col1, col2)
+PREHOOK: type: QUERY
+PREHOOK: Input: _dummy_database@_dummy_table
+#### A masked pattern was here ####
+POSTHOOK: query: SELECT tf.col1, tf.col2, tf.col3
+FROM
+ TABLE(VALUES('A', 10, 30),('B', 20, 30)) AS tf(col1, col2, col3),
+ TABLE(VALUES('A', 10),('B', 20)) AS tf2(col1, col2)
+POSTHOOK: type: QUERY
+POSTHOOK: Input: _dummy_database@_dummy_table
+#### A masked pattern was here ####
+B 20 30
+B 20 30
+A 10 30
+A 10 30
+Warning: Shuffle Join JOIN[8][tables = [$hdt$_0, $hdt$_1]] in Stage 'Stage-1:MAPRED' is a cross product
+PREHOOK: query: EXPLAIN
+SELECT tf.col1, tf.col2, tf.col3
+FROM
+ (SELECT key, value FROM mytbl) t,
+ TABLE(VALUES('A', 10, 30),('B', 20, 30)) AS tf(col1, col2, col3)
+PREHOOK: type: QUERY
+POSTHOOK: query: EXPLAIN
+SELECT tf.col1, tf.col2, tf.col3
+FROM
+ (SELECT key, value FROM mytbl) t,
+ TABLE(VALUES('A', 10, 30),('B', 20, 30)) AS tf(col1, col2, col3)
+POSTHOOK: type: QUERY
+STAGE DEPENDENCIES:
+ Stage-1 is a root stage
+ Stage-0 depends on stages: Stage-1
+
+STAGE PLANS:
+ Stage: Stage-1
+ Map Reduce
+ Map Operator Tree:
+ TableScan
+ alias: mytbl
+ Statistics: Num rows: 5 Data size: 41 Basic stats: COMPLETE Column stats: COMPLETE
+ Select Operator
+ Statistics: Num rows: 5 Data size: 20 Basic stats: COMPLETE Column stats: COMPLETE
+ Reduce Output Operator
+ sort order:
+ Statistics: Num rows: 5 Data size: 20 Basic stats: COMPLETE Column stats: COMPLETE
+ TableScan
+ alias: _dummy_table
+ Row Limit Per Split: 1
+ Statistics: Num rows: 1 Data size: 10 Basic stats: COMPLETE Column stats: COMPLETE
+ Select Operator
+ expressions: array(const struct('A',10,30),const struct('B',20,30)) (type: array>)
+ outputColumnNames: _col0
+ Statistics: Num rows: 1 Data size: 2560 Basic stats: COMPLETE Column stats: COMPLETE
+ UDTF Operator
+ Statistics: Num rows: 1 Data size: 2560 Basic stats: COMPLETE Column stats: COMPLETE
+ function name: inline
+ Reduce Output Operator
+ sort order:
+ Statistics: Num rows: 1 Data size: 2560 Basic stats: COMPLETE Column stats: COMPLETE
+ value expressions: col1 (type: string), col2 (type: int), col3 (type: int)
+ Reduce Operator Tree:
+ Join Operator
+ condition map:
+ Inner Join 0 to 1
+ keys:
+ 0
+ 1
+ outputColumnNames: _col1, _col2, _col3
+ Statistics: Num rows: 5 Data size: 580 Basic stats: COMPLETE Column stats: COMPLETE
+ Select Operator
+ expressions: _col1 (type: string), _col2 (type: int), _col3 (type: int)
+ outputColumnNames: _col0, _col1, _col2
+ Statistics: Num rows: 5 Data size: 40 Basic stats: COMPLETE Column stats: COMPLETE
+ File Output Operator
+ compressed: false
+ Statistics: Num rows: 5 Data size: 40 Basic stats: COMPLETE Column stats: COMPLETE
+ table:
+ input format: org.apache.hadoop.mapred.SequenceFileInputFormat
+ output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
+ serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
+
+ Stage: Stage-0
+ Fetch Operator
+ limit: -1
+ Processor Tree:
+ ListSink
+
+Warning: Shuffle Join JOIN[8][tables = [$hdt$_0, $hdt$_1]] in Stage 'Stage-1:MAPRED' is a cross product
+PREHOOK: query: SELECT tf.col1, tf.col2, tf.col3
+FROM
+ (SELECT key, value FROM mytbl) t,
+ TABLE(VALUES('A', 10, 30),('B', 20, 30)) AS tf(col1, col2, col3)
+PREHOOK: type: QUERY
+PREHOOK: Input: _dummy_database@_dummy_table
+PREHOOK: Input: default@mytbl
+#### A masked pattern was here ####
+POSTHOOK: query: SELECT tf.col1, tf.col2, tf.col3
+FROM
+ (SELECT key, value FROM mytbl) t,
+ TABLE(VALUES('A', 10, 30),('B', 20, 30)) AS tf(col1, col2, col3)
+POSTHOOK: type: QUERY
+POSTHOOK: Input: _dummy_database@_dummy_table
+POSTHOOK: Input: default@mytbl
+#### A masked pattern was here ####
+B 20 30
+A 10 30
+B 20 30
+A 10 30
+B 20 30
+A 10 30
+B 20 30
+A 10 30
+B 20 30
+A 10 30
+PREHOOK: query: EXPLAIN
+SELECT tf.col1, tf.col2, tf.col3
+FROM
+ (SELECT key, value FROM mytbl) t,
+ LATERAL TABLE(VALUES('A', 10, t.key),('B', 20, t.key)) AS tf(col1, col2, col3)
+PREHOOK: type: QUERY
+POSTHOOK: query: EXPLAIN
+SELECT tf.col1, tf.col2, tf.col3
+FROM
+ (SELECT key, value FROM mytbl) t,
+ LATERAL TABLE(VALUES('A', 10, t.key),('B', 20, t.key)) AS tf(col1, col2, col3)
+POSTHOOK: type: QUERY
+STAGE DEPENDENCIES:
+ Stage-1 is a root stage
+ Stage-0 depends on stages: Stage-1
+
+STAGE PLANS:
+ Stage: Stage-1
+ Map Reduce
+ Map Operator Tree:
+ TableScan
+ alias: mytbl
+ Statistics: Num rows: 5 Data size: 41 Basic stats: COMPLETE Column stats: NONE
+ Select Operator
+ expressions: key (type: string)
+ outputColumnNames: _col0
+ Statistics: Num rows: 5 Data size: 41 Basic stats: COMPLETE Column stats: NONE
+ Lateral View Forward
+ Statistics: Num rows: 5 Data size: 41 Basic stats: COMPLETE Column stats: NONE
+ Select Operator
+ Statistics: Num rows: 5 Data size: 41 Basic stats: COMPLETE Column stats: NONE
+ Lateral View Join Operator
+ outputColumnNames: _col2, _col3, _col4
+ Statistics: Num rows: 10 Data size: 82 Basic stats: COMPLETE Column stats: NONE
+ Select Operator
+ expressions: _col2 (type: string), _col3 (type: int), _col4 (type: string)
+ outputColumnNames: _col0, _col1, _col2
+ Statistics: Num rows: 10 Data size: 82 Basic stats: COMPLETE Column stats: NONE
+ File Output Operator
+ compressed: false
+ Statistics: Num rows: 10 Data size: 82 Basic stats: COMPLETE Column stats: NONE
+ table:
+ input format: org.apache.hadoop.mapred.SequenceFileInputFormat
+ output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
+ serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
+ Select Operator
+ expressions: array(struct('A',10,_col0),struct('B',20,_col0)) (type: array>)
+ outputColumnNames: _col0
+ Statistics: Num rows: 5 Data size: 41 Basic stats: COMPLETE Column stats: NONE
+ UDTF Operator
+ Statistics: Num rows: 5 Data size: 41 Basic stats: COMPLETE Column stats: NONE
+ function name: inline
+ Lateral View Join Operator
+ outputColumnNames: _col2, _col3, _col4
+ Statistics: Num rows: 10 Data size: 82 Basic stats: COMPLETE Column stats: NONE
+ Select Operator
+ expressions: _col2 (type: string), _col3 (type: int), _col4 (type: string)
+ outputColumnNames: _col0, _col1, _col2
+ Statistics: Num rows: 10 Data size: 82 Basic stats: COMPLETE Column stats: NONE
+ File Output Operator
+ compressed: false
+ Statistics: Num rows: 10 Data size: 82 Basic stats: COMPLETE Column stats: NONE
+ table:
+ input format: org.apache.hadoop.mapred.SequenceFileInputFormat
+ output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
+ serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
+
+ Stage: Stage-0
+ Fetch Operator
+ limit: -1
+ Processor Tree:
+ ListSink
+
+PREHOOK: query: SELECT tf.col1, tf.col2, tf.col3
+FROM
+ (SELECT key, value FROM mytbl) t,
+ LATERAL TABLE(VALUES('A', 10, t.key),('B', 20, t.key)) AS tf(col1, col2, col3)
+PREHOOK: type: QUERY
+PREHOOK: Input: default@mytbl
+#### A masked pattern was here ####
+POSTHOOK: query: SELECT tf.col1, tf.col2, tf.col3
+FROM
+ (SELECT key, value FROM mytbl) t,
+ LATERAL TABLE(VALUES('A', 10, t.key),('B', 20, t.key)) AS tf(col1, col2, col3)
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@mytbl
+#### A masked pattern was here ####
+A 10 0
+B 20 0
+A 10 0
+B 20 0
+A 10 0
+B 20 0
+A 10 10
+B 20 10
+A 10 100
+B 20 100
diff --git a/serde/src/java/org/apache/hadoop/hive/serde2/objectinspector/ObjectInspectorConverters.java b/serde/src/java/org/apache/hadoop/hive/serde2/objectinspector/ObjectInspectorConverters.java
index faa0a1f567..4c01d6aa82 100644
--- a/serde/src/java/org/apache/hadoop/hive/serde2/objectinspector/ObjectInspectorConverters.java
+++ b/serde/src/java/org/apache/hadoop/hive/serde2/objectinspector/ObjectInspectorConverters.java
@@ -45,6 +45,7 @@
import org.apache.hadoop.hive.serde2.objectinspector.primitive.SettableTimestampLocalTZObjectInspector;
import org.apache.hadoop.hive.serde2.objectinspector.primitive.VoidObjectInspector;
import org.apache.hadoop.hive.serde2.objectinspector.primitive.WritableStringObjectInspector;
+import org.apache.hadoop.hive.serde2.typeinfo.PrimitiveTypeInfo;
/**
* ObjectInspectorConverters.
@@ -75,6 +76,12 @@ public Object convert(Object input) {
private static Converter getConverter(PrimitiveObjectInspector inputOI,
PrimitiveObjectInspector outputOI) {
switch (outputOI.getPrimitiveCategory()) {
+ case VOID:
+ if (!outputOI.getTypeInfo().equals(inputOI.getTypeInfo())) {
+ throw new RuntimeException("Hive internal error: conversion of "
+ + inputOI.getTypeName() + " to void not possible.");
+ }
+ return new IdentityConverter();
case BOOLEAN:
return new PrimitiveObjectInspectorConverter.BooleanConverter(
inputOI,