Gathering column stats throwing error - hive

When I gather stats on columns of a table its throwing an error.
hive> ANALYZE TABLE customer COMPUTE STATISTICS FOR COLUMNS;
FAILED: NullPointerException null
And also if I query select * from customer; it's working.
If I use any where condition it's throwing error.
select * from customer where cust_id=45633;
FAILED: NullPointerException null
Please help me.
Thanks in advance

Related

SQL counter flag is not filtered

I'm using SQL developer and I'm getting an error I don't fully understand.
Due to data privacy, I cannot share the real query, but the question is fairly simple.
I have a query to obtain table T (which works if ran alone) and I want to filter a Y/N flag so I have the following query:
select * from T where flag ='Y'
While this query works, I want the observations which do not fullfil the condition but neither of the following queries works:
select * from T where flag <>'Y'
select * from T where flag ='N'
*I get the following error:
01722. 00000 - "invalid number"
*Cause: The specified number was invalid.
Action: Specify a valid number .
Vendor code 1722
I tried to export the table to analyze it on another language, but I still get the same error.
Can anyone help?
As you confirmed T in your example is not a table, your error simply seems to be caused by a conversion error somewhere on 1 or several records WHERE flag <> 'Y'. This is why the query works with flag = 'Y' but not with your other conditions.
Minimal case to reproduce would be something like:
CREATE TABLE MyTable (
Field VARCHAR(10),
Flag VARCHAR(1)
);
CREATE VIEW T AS SELECT to_number(Field), Flag FROM MyTable;
INSERT INTO MyTable VALUES ('1', 'Y'); /* OK */
INSERT INTO MyTable VALUES ('No way', 'N'); /* Fails */
In your case, the error may not be caused by a call to to_number but this is the best clue I can give given the limited information you provide. It might not be a call to a function at all but the result of a calculation using operators only.
You simply need to make sure the fields can be converted/used in a calculation before you actually attempt to do so (CASE WHEN ... THEN ... ELSE NULL for instance).

BigQuery - Resources error when I make a SELECT FIELD but no error when I do SELECT * (on the same table)

Working query: SELECT * FROM my_project.my_dataset.my_table
Not working query: SELECT id FROM my_project.my_dataset.my_table
Error I get: Resources exceeded during query execution: Not enough resources for query planning - too many subqueries or query is too complex.
I understand the error, but I don't understand why it's occuring when I change '*' to any field (id for exemple)
thank you :)

Hive: select * is ok but select a column fails

It is very strange that when I input the Hive query:
SELECT * FROM tb LIMIT 1;
It returns a row from the table successfully.
However, when I select a column from the table, Hive will fail:
SELECT col FROM tb LIMIT 1;
Hive gives an error message:
FAILED: Execution Error, return code -101 from
org.apache.hadoop.hive.ql.exec.mr.MapRedTask. GC overhead limit
exceeded
What is wrong with Hive?
This looks like a java memory error. The reason why a select * works, but a select column doesn't, is that the select * just pulls a row of data from HDFS rather than actually executing a map-reduce job.
You might be able to solve the problem by increasing the maximum heap size:
export HADOOP_CLIENT_OPTS="-Xmx512m"
would set the heap size to 512m, for example.

Unable to determine schema of SELECT * in this query

I have created a table in Bigquery using the data personsData.json and schema personsDataSchema.json provided by the documentation at https://developers.google.com/bigquery/docs/data#nested.
This query works fine:
SELECT children.* FROM dw_test.persons
But the following query gives the error Error: 0.0 - 0.0: Unable to determine schema of SELECT * in this query:
SELECT citiesLived.* FROM dw_test.persons
I understand that a workaround will be to simply list all the fields of citiesLived:
SELECT citiesLived.place, citiesLived.yearsLived FROM dw_test.persons
But in the case when the record has many fields, listing all the fields becomes cumbersome.
Could anyone please help?
Thank you so much.

Query returned non-zero code: 10, cause: FAILED

all
when I use the Hive to select the id from a table there are some errors occurring as follows:
Query returned non-zero code: 10, cause: FAILED : Error in semantic analysis: Line 1:68 Invalid table alias or column reference 'Goldman'
can any body give me some questions?
Your error seems to indicate that you are doing a select for a column named Goldman that does not exist. You attempting to do an HQL query for a column goldman or you are attempting to do a query for rows in which a specific column has Goldman.