FAQ
Hi @all,

I'm on the prebaked VM i downloaded from Cloudera, and I have a strange
error trying an Insert Overwrite Query via Impala.

I have two tables, as you can see below, the tables are indentical with the
only difference the source table is partitioned by a string, and the target
table is not partitioned, the string is just a 'normal' column.

When i try to insert overwrite in the target table with selecting from the
source table i get an error, that tells me inserting in the table would
cause a loss of precision because it would need an implicit cast from
'<SLOT 15>' (whatever that means?) to 'INT'.
The tried the select part as a query itself, and it works fine, as the
error is from inserting.
How can that be, since the tables are nearly identical, and the values are
of compatible types (the same to be precise)?!

Thanks for your help in advance!


Here are the Tables, the Query and the Error Message:
I changed the column names, but its copy&paste from the statements i use.

Table 1 looks like this:

CREATE TABLE source (
col1 smallint,
col2 smallint,
col3 string,
col4 int,
summe int,
col6 smallint
) PARTITIONED BY (time string) ROW FORMAT DELIMITED FIELDS TERMINATED BY
',' STORED AS TEXTFILE;

Table 2:

CREATE TABLE target (
time string,
col1 smallint,
col2 smallint,
col3 string,
col4 int,
summe int,
col6 smallint
) ROW FORMAT DELIMITED FIELDS TERMINATED BY ',' STORED AS TEXTFILE;

Query:
i use it to aggregate the data to an hour level that is more precise in the
source column, the concat and substr functions are the get time in the
string that have minutes and second both 00 since the min(time) must not
start there.

INSERT OVERWRITE TABLE target SELECT
CONCAT(SUBSTR(MIN(time),1,13),':00:00'), col1, col2, col3, col4,
SUM(summe), col6 FROM source GROUP BY day(time), hour(time), col4, col1,
col2, col3, col6;

Error:

ERROR: com.cloudera.impala.common.AnalysisException: Analysis exception (in
**here stands my query**)
at
com.cloudera.impala.analysis.AnalysisContext.analyze(AnalysisContext.java:133)
at
com.cloudera.impala.service.Frontend.createExecRequest(Frontend.java:221)
at
com.cloudera.impala.service.JniFrontend.createExecRequest(JniFrontend.java:91)
Caused by: com.cloudera.impala.common.AnalysisException: Inserting into
target table '**my target table**' may result in loss of precision.
Would need to cast '<slot 15>' to 'INT'.
at
com.cloudera.impala.analysis.InsertStmt.checkTypeCompatibility(InsertStmt.java:314)
at
com.cloudera.impala.analysis.InsertStmt.checkUnionCompatibility(InsertStmt.java:273)
at com.cloudera.impala.analysis.InsertStmt.analyze(InsertStmt.java:124)
at
com.cloudera.impala.analysis.AnalysisContext.analyze(AnalysisContext.java:130)
... 2 more

Search Discussions

Discussion Posts

Follow ups

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 1 of 2 | next ›
Discussion Overview
groupimpala-user @
categorieshadoop
postedApr 10, '13 at 7:06a
activeApr 10, '13 at 4:52p
posts2
users2
websitecloudera.com
irc#hadoop

2 users in discussion

Ealex531: 1 post Alex Behm: 1 post

People

Translate

site design / logo © 2022 Grokbase