Error creating table stored as Textfile from viewHow to incrementally update a tableHow do I Insert data from text table (using MultiDelimitSerDe) to Avro Table?In Qubole, creation of hive external table using S3 locationCreate a table in Hive and populate it with datawhy there is always some null values when I use “insert into” in hive?Hive Joining multiple tables to create a horizontal layoutAutomatically generating documentation about the structure of the databaseParquet Files Generation with hiveHow to load into Hive a mapreduce result?
Explain why watch 'jobs' does not work but watch 'ps' work?
How to handle a player that cannot be convinced his actions are a problem for both GM and party
Did the IBM PC use the 8088's NMI line?
Is this photo showing a woman posing in the nude before teenagers real?
AC contactor 1 pole or 2?
At what rate does the volume (velocity) of a note decay?
Spoken encryption
Is my employer paying me fairly? Going from 1099 to W2
Expansion with *.txt in the shell doesn't work if no .txt file exists
What's the difference between 2a and 10a charging options?
How do I address my Catering staff subordinate seen eating from a chafing dish before the customers?
Decreasing star size
Keeping an "hot eyeball planet" wet
High income, sudden windfall
kids pooling money for Lego League and taxes
Does the Intel 8086 CPU have user mode and kernel mode?
What does コテッと mean?
Commercial jet accompanied by small plane near Seattle
Why are so many countries still in the Commonwealth?
What does "see" in "the Holy See" mean?
Easy emoji puzzle
What do I do when a student working in my lab "ghosts" me?
Is it normal practice to screen share with a client?
Piece-drop Mate #2
Error creating table stored as Textfile from view
How to incrementally update a tableHow do I Insert data from text table (using MultiDelimitSerDe) to Avro Table?In Qubole, creation of hive external table using S3 locationCreate a table in Hive and populate it with datawhy there is always some null values when I use “insert into” in hive?Hive Joining multiple tables to create a horizontal layoutAutomatically generating documentation about the structure of the databaseParquet Files Generation with hiveHow to load into Hive a mapreduce result?
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
I am trying to load information from a view into an Hive table stored as textfile configured like this:
CREATE TABLE table1 (
field1 BIGINT
,field2 STRING
,email STRING
,field3 BIGINT
,field4 STRING
)
ROW FORMAT DELIMITED
FIELDS TERMINATED BY 'u0001'
LINES TERMINATED BY 'n'
STORED AS TEXTFILE ;
The thing is that after i created the table i insert the info from the view like this:
insert into table1 as
select
field1
,field2
,email
,field3
,field4
from v_table2 ;
The process returns success but when i check the data on table1 the select statement returns the following output:
Error converting column: 4 to BIGINT
The information on that field returns Null when there is info on that field on the view but the insert statement doesn't return any error.
Besides, i can load the first BIGINT field correctly but the email fields displays a "square" and the BIGINT field after that gives that error.
Checking the data on the file it seems that the information suffers a shift after the email field.
Sounds like some encoding problem.
Already tried to force the encoding like this but the no luck:
ALTER TABLE table1 SET SERDEPROPERTIES('serialization.format'='u0001', 'serialization.encoding'='windows-1252');
I should also mention that the fields that are being loaded into table1 from the view are already BIGINT in the table that the view loads information from.
Anyone can help ?
Solution
After some research i manage to found a solution by creating a the destination table with the following definition:
ROW FORMAT SERDE 'org.apache.hadoop.hive.serde2.OpenCSVSerde'
WITH SERDEPROPERTIES ('separatorChar'='u0001', 'quoteChar'="'", 'escapeChar' = '\')
STORED AS TEXTFILE
And by treating the data on the field "email" like that:
case
when ascii(email_fe) <> 1
then email_fe
else NULL
end email_fe
for the "email" fields where the strange data appears i checked that the ascii code was always 1 and by checking that on the select statement i could treat the information accordingly and get the data on the table for the other fields inserted the right way.
Does anyone have a better alternative ?
hadoop hive cloudera-cdh
add a comment |
I am trying to load information from a view into an Hive table stored as textfile configured like this:
CREATE TABLE table1 (
field1 BIGINT
,field2 STRING
,email STRING
,field3 BIGINT
,field4 STRING
)
ROW FORMAT DELIMITED
FIELDS TERMINATED BY 'u0001'
LINES TERMINATED BY 'n'
STORED AS TEXTFILE ;
The thing is that after i created the table i insert the info from the view like this:
insert into table1 as
select
field1
,field2
,email
,field3
,field4
from v_table2 ;
The process returns success but when i check the data on table1 the select statement returns the following output:
Error converting column: 4 to BIGINT
The information on that field returns Null when there is info on that field on the view but the insert statement doesn't return any error.
Besides, i can load the first BIGINT field correctly but the email fields displays a "square" and the BIGINT field after that gives that error.
Checking the data on the file it seems that the information suffers a shift after the email field.
Sounds like some encoding problem.
Already tried to force the encoding like this but the no luck:
ALTER TABLE table1 SET SERDEPROPERTIES('serialization.format'='u0001', 'serialization.encoding'='windows-1252');
I should also mention that the fields that are being loaded into table1 from the view are already BIGINT in the table that the view loads information from.
Anyone can help ?
Solution
After some research i manage to found a solution by creating a the destination table with the following definition:
ROW FORMAT SERDE 'org.apache.hadoop.hive.serde2.OpenCSVSerde'
WITH SERDEPROPERTIES ('separatorChar'='u0001', 'quoteChar'="'", 'escapeChar' = '\')
STORED AS TEXTFILE
And by treating the data on the field "email" like that:
case
when ascii(email_fe) <> 1
then email_fe
else NULL
end email_fe
for the "email" fields where the strange data appears i checked that the ascii code was always 1 and by checking that on the select statement i could treat the information accordingly and get the data on the table for the other fields inserted the right way.
Does anyone have a better alternative ?
hadoop hive cloudera-cdh
add a comment |
I am trying to load information from a view into an Hive table stored as textfile configured like this:
CREATE TABLE table1 (
field1 BIGINT
,field2 STRING
,email STRING
,field3 BIGINT
,field4 STRING
)
ROW FORMAT DELIMITED
FIELDS TERMINATED BY 'u0001'
LINES TERMINATED BY 'n'
STORED AS TEXTFILE ;
The thing is that after i created the table i insert the info from the view like this:
insert into table1 as
select
field1
,field2
,email
,field3
,field4
from v_table2 ;
The process returns success but when i check the data on table1 the select statement returns the following output:
Error converting column: 4 to BIGINT
The information on that field returns Null when there is info on that field on the view but the insert statement doesn't return any error.
Besides, i can load the first BIGINT field correctly but the email fields displays a "square" and the BIGINT field after that gives that error.
Checking the data on the file it seems that the information suffers a shift after the email field.
Sounds like some encoding problem.
Already tried to force the encoding like this but the no luck:
ALTER TABLE table1 SET SERDEPROPERTIES('serialization.format'='u0001', 'serialization.encoding'='windows-1252');
I should also mention that the fields that are being loaded into table1 from the view are already BIGINT in the table that the view loads information from.
Anyone can help ?
Solution
After some research i manage to found a solution by creating a the destination table with the following definition:
ROW FORMAT SERDE 'org.apache.hadoop.hive.serde2.OpenCSVSerde'
WITH SERDEPROPERTIES ('separatorChar'='u0001', 'quoteChar'="'", 'escapeChar' = '\')
STORED AS TEXTFILE
And by treating the data on the field "email" like that:
case
when ascii(email_fe) <> 1
then email_fe
else NULL
end email_fe
for the "email" fields where the strange data appears i checked that the ascii code was always 1 and by checking that on the select statement i could treat the information accordingly and get the data on the table for the other fields inserted the right way.
Does anyone have a better alternative ?
hadoop hive cloudera-cdh
I am trying to load information from a view into an Hive table stored as textfile configured like this:
CREATE TABLE table1 (
field1 BIGINT
,field2 STRING
,email STRING
,field3 BIGINT
,field4 STRING
)
ROW FORMAT DELIMITED
FIELDS TERMINATED BY 'u0001'
LINES TERMINATED BY 'n'
STORED AS TEXTFILE ;
The thing is that after i created the table i insert the info from the view like this:
insert into table1 as
select
field1
,field2
,email
,field3
,field4
from v_table2 ;
The process returns success but when i check the data on table1 the select statement returns the following output:
Error converting column: 4 to BIGINT
The information on that field returns Null when there is info on that field on the view but the insert statement doesn't return any error.
Besides, i can load the first BIGINT field correctly but the email fields displays a "square" and the BIGINT field after that gives that error.
Checking the data on the file it seems that the information suffers a shift after the email field.
Sounds like some encoding problem.
Already tried to force the encoding like this but the no luck:
ALTER TABLE table1 SET SERDEPROPERTIES('serialization.format'='u0001', 'serialization.encoding'='windows-1252');
I should also mention that the fields that are being loaded into table1 from the view are already BIGINT in the table that the view loads information from.
Anyone can help ?
Solution
After some research i manage to found a solution by creating a the destination table with the following definition:
ROW FORMAT SERDE 'org.apache.hadoop.hive.serde2.OpenCSVSerde'
WITH SERDEPROPERTIES ('separatorChar'='u0001', 'quoteChar'="'", 'escapeChar' = '\')
STORED AS TEXTFILE
And by treating the data on the field "email" like that:
case
when ascii(email_fe) <> 1
then email_fe
else NULL
end email_fe
for the "email" fields where the strange data appears i checked that the ascii code was always 1 and by checking that on the select statement i could treat the information accordingly and get the data on the table for the other fields inserted the right way.
Does anyone have a better alternative ?
hadoop hive cloudera-cdh
hadoop hive cloudera-cdh
edited Mar 28 at 15:23
armJF
asked Mar 26 at 17:09
armJFarmJF
114 bronze badges
114 bronze badges
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
Can you give a try this please? This error is thrown since the table created has a column of bigint and we are trying to insert an int value
insert into table1 as
select
field1
,field2
,email
,cast(field3 as bigint)
,field4
from v_table2 ;
I have tried that but with no luck. The thing is that the field "email" is showing some strange character on it and somehow it is making the interpreter read the info on that field as it was the data from two fields what makes the info in the table from the "email" field forward to shift one cell to the right
– armJF
Mar 28 at 15:15
Try to allow only alphanumeric values into the insert statement like below insert into table1 as select field1 ,field2 ,REGEXP_REPLACE(email, '[^a-zA-Z0-9]+', ''), cast(field3 as bigint) ,field4 from v_table2 ; You may also amend the regex_replace if you want to avoid replacing few spl characters like @.
– rightjoin
Mar 28 at 15:45
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55362699%2ferror-creating-table-stored-as-textfile-from-view%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
Can you give a try this please? This error is thrown since the table created has a column of bigint and we are trying to insert an int value
insert into table1 as
select
field1
,field2
,email
,cast(field3 as bigint)
,field4
from v_table2 ;
I have tried that but with no luck. The thing is that the field "email" is showing some strange character on it and somehow it is making the interpreter read the info on that field as it was the data from two fields what makes the info in the table from the "email" field forward to shift one cell to the right
– armJF
Mar 28 at 15:15
Try to allow only alphanumeric values into the insert statement like below insert into table1 as select field1 ,field2 ,REGEXP_REPLACE(email, '[^a-zA-Z0-9]+', ''), cast(field3 as bigint) ,field4 from v_table2 ; You may also amend the regex_replace if you want to avoid replacing few spl characters like @.
– rightjoin
Mar 28 at 15:45
add a comment |
Can you give a try this please? This error is thrown since the table created has a column of bigint and we are trying to insert an int value
insert into table1 as
select
field1
,field2
,email
,cast(field3 as bigint)
,field4
from v_table2 ;
I have tried that but with no luck. The thing is that the field "email" is showing some strange character on it and somehow it is making the interpreter read the info on that field as it was the data from two fields what makes the info in the table from the "email" field forward to shift one cell to the right
– armJF
Mar 28 at 15:15
Try to allow only alphanumeric values into the insert statement like below insert into table1 as select field1 ,field2 ,REGEXP_REPLACE(email, '[^a-zA-Z0-9]+', ''), cast(field3 as bigint) ,field4 from v_table2 ; You may also amend the regex_replace if you want to avoid replacing few spl characters like @.
– rightjoin
Mar 28 at 15:45
add a comment |
Can you give a try this please? This error is thrown since the table created has a column of bigint and we are trying to insert an int value
insert into table1 as
select
field1
,field2
,email
,cast(field3 as bigint)
,field4
from v_table2 ;
Can you give a try this please? This error is thrown since the table created has a column of bigint and we are trying to insert an int value
insert into table1 as
select
field1
,field2
,email
,cast(field3 as bigint)
,field4
from v_table2 ;
edited Mar 27 at 13:36
answered Mar 26 at 21:25
rightjoinrightjoin
788 bronze badges
788 bronze badges
I have tried that but with no luck. The thing is that the field "email" is showing some strange character on it and somehow it is making the interpreter read the info on that field as it was the data from two fields what makes the info in the table from the "email" field forward to shift one cell to the right
– armJF
Mar 28 at 15:15
Try to allow only alphanumeric values into the insert statement like below insert into table1 as select field1 ,field2 ,REGEXP_REPLACE(email, '[^a-zA-Z0-9]+', ''), cast(field3 as bigint) ,field4 from v_table2 ; You may also amend the regex_replace if you want to avoid replacing few spl characters like @.
– rightjoin
Mar 28 at 15:45
add a comment |
I have tried that but with no luck. The thing is that the field "email" is showing some strange character on it and somehow it is making the interpreter read the info on that field as it was the data from two fields what makes the info in the table from the "email" field forward to shift one cell to the right
– armJF
Mar 28 at 15:15
Try to allow only alphanumeric values into the insert statement like below insert into table1 as select field1 ,field2 ,REGEXP_REPLACE(email, '[^a-zA-Z0-9]+', ''), cast(field3 as bigint) ,field4 from v_table2 ; You may also amend the regex_replace if you want to avoid replacing few spl characters like @.
– rightjoin
Mar 28 at 15:45
I have tried that but with no luck. The thing is that the field "email" is showing some strange character on it and somehow it is making the interpreter read the info on that field as it was the data from two fields what makes the info in the table from the "email" field forward to shift one cell to the right
– armJF
Mar 28 at 15:15
I have tried that but with no luck. The thing is that the field "email" is showing some strange character on it and somehow it is making the interpreter read the info on that field as it was the data from two fields what makes the info in the table from the "email" field forward to shift one cell to the right
– armJF
Mar 28 at 15:15
Try to allow only alphanumeric values into the insert statement like below insert into table1 as select field1 ,field2 ,REGEXP_REPLACE(email, '[^a-zA-Z0-9]+', ''), cast(field3 as bigint) ,field4 from v_table2 ; You may also amend the regex_replace if you want to avoid replacing few spl characters like @.
– rightjoin
Mar 28 at 15:45
Try to allow only alphanumeric values into the insert statement like below insert into table1 as select field1 ,field2 ,REGEXP_REPLACE(email, '[^a-zA-Z0-9]+', ''), cast(field3 as bigint) ,field4 from v_table2 ; You may also amend the regex_replace if you want to avoid replacing few spl characters like @.
– rightjoin
Mar 28 at 15:45
add a comment |
Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.
Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55362699%2ferror-creating-table-stored-as-textfile-from-view%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown