-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
HIVE-3012 hive custom scripts do not work well if the data contains n…
…ew lines (njain via kevinwilfong) git-svn-id: https://svn.apache.org/repos/asf/hive/trunk@1336986 13f79535-47bb-0310-9956-ffa450edef68
- Loading branch information
Kevin Wilfong
committed
May 11, 2012
1 parent
3c1893a
commit 88582ee
Showing
8 changed files
with
170 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# | ||
# Licensed to the Apache Software Foundation (ASF) under one | ||
# or more contributor license agreements. See the NOTICE file | ||
# distributed with this work for additional information | ||
# regarding copyright ownership. The ASF licenses this file | ||
# to you under the Apache License, Version 2.0 (the | ||
# "License"); you may not use this file except in compliance | ||
# with the License. You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, | ||
# software distributed under the License is distributed on an | ||
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
# KIND, either express or implied. See the License for the | ||
# specific language governing permissions and limitations | ||
# under the License. | ||
# | ||
import sys | ||
|
||
for line in sys.stdin: | ||
print "1\\n2" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
add file ../data/scripts/newline.py; | ||
set hive.script.escape.newlines=true; | ||
|
||
create table tmp_tmp(key string, value string) stored as rcfile; | ||
insert overwrite table tmp_tmp | ||
SELECT TRANSFORM(key, value) USING | ||
'python newline.py' AS key, value FROM src limit 5; | ||
|
||
select * from tmp_tmp; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
PREHOOK: query: create table tmp_tmp(key string, value string) stored as rcfile | ||
PREHOOK: type: CREATETABLE | ||
POSTHOOK: query: create table tmp_tmp(key string, value string) stored as rcfile | ||
POSTHOOK: type: CREATETABLE | ||
POSTHOOK: Output: default@tmp_tmp | ||
PREHOOK: query: insert overwrite table tmp_tmp | ||
SELECT TRANSFORM(key, value) USING | ||
'python newline.py' AS key, value FROM src limit 5 | ||
PREHOOK: type: QUERY | ||
PREHOOK: Input: default@src | ||
PREHOOK: Output: default@tmp_tmp | ||
POSTHOOK: query: insert overwrite table tmp_tmp | ||
SELECT TRANSFORM(key, value) USING | ||
'python newline.py' AS key, value FROM src limit 5 | ||
POSTHOOK: type: QUERY | ||
POSTHOOK: Input: default@src | ||
POSTHOOK: Output: default@tmp_tmp | ||
POSTHOOK: Lineage: tmp_tmp.key SCRIPT [(src)src.FieldSchema(name:key, type:string, comment:default), (src)src.FieldSchema(name:value, type:string, comment:default), ] | ||
POSTHOOK: Lineage: tmp_tmp.value SCRIPT [(src)src.FieldSchema(name:key, type:string, comment:default), (src)src.FieldSchema(name:value, type:string, comment:default), ] | ||
PREHOOK: query: select * from tmp_tmp | ||
PREHOOK: type: QUERY | ||
PREHOOK: Input: default@tmp_tmp | ||
#### A masked pattern was here #### | ||
POSTHOOK: query: select * from tmp_tmp | ||
POSTHOOK: type: QUERY | ||
POSTHOOK: Input: default@tmp_tmp | ||
#### A masked pattern was here #### | ||
POSTHOOK: Lineage: tmp_tmp.key SCRIPT [(src)src.FieldSchema(name:key, type:string, comment:default), (src)src.FieldSchema(name:value, type:string, comment:default), ] | ||
POSTHOOK: Lineage: tmp_tmp.value SCRIPT [(src)src.FieldSchema(name:key, type:string, comment:default), (src)src.FieldSchema(name:value, type:string, comment:default), ] | ||
1 | ||
2 NULL | ||
1 | ||
2 NULL | ||
1 | ||
2 NULL | ||
1 | ||
2 NULL | ||
1 | ||
2 NULL |