FAILED: Execution Error, return code 1 from org.apache.hadoop.hive.ql.exec.DDLTask. M - hive

I am new to Hive. I have set up hive and I am using mysql to store the metadata for hive tables. I am able to launch hive. However when I try to create a simple table.
I get this error:
FAILED: Execution Error, return code 1 from org.apache.hadoop.hive.ql.exec.DDLTask. MetaException(message:Exception thrown when executing query : SELECT DISTINCT 'org.apache.hadoop.hive.metastore.model.MTable' AS NUCLEUS_TYPE,
Here is what I tried,
hive> create external table employee (FirstName string,LastName string, EmployeeId string)
row format delimited
fields terminated by ',';
I have been doing some research but no luck..What could I be doing wrong?

Related

How do I creating a table with stored procedure results on Bigquery

Im trying to schedule my stored procedure to run every day and save the results into a table.
I got the stored procedure to work but im not able to create a table with the results.
Creating a table backed by the SP to run daily
You can use DDL statements where you're executing queries in your stored procedure, before the SQL of your output query.
CREATE OR REPLACE TABLE `datasetId.tableId`
CREATE TABLE statement
Whatever your result query is: try to use DDL of create/replace table to save the results.
something like :
BEGIN
EXECUTE IMMEDIATE CONCAT("create or replace table `",YOUR_TABLE_NAME_VARIABLE,"` as YOUR_QUERY_HERE");
EXCEPTION WHEN ERROR THEN
RAISE USING MESSAGE = CONCAT('StoredProc Error: ',##error.message);
END;

Postgresql 11 - Create Procedure to Execute COPY function

I'm currently trying to create a procedure to automatically copy data into my database when I call the procedure. However, every time I call it I get the following error:
ERROR: column "name" does not exist
LINE 1: SELECT format('COPY test(%L) FROM %s CSV HEADER', name, '/Us...
How does the column not exist? Here's everything I've written out:
CREATE PROCEDURE
test_insert() AS
$$
BEGIN
EXECUTE format('COPY test(%L) FROM %s CSV HEADER', name, '/Users/Receiving.csv');
END;
$$ LANGUAGE plpgsql;
If you use name without single quotes, it is interpreted as a column name in the (tacit) SELECT statement
SELECT format('...', name, '...')
that PL/pgSQL runs when you execute your function.
Since this SELECT statement does not have a FROM clause, you get the observed error.
The solution is to use a string literal instead, i.e. write 'name' instead of 'name'.

SEM_MATCH call returns ORA-00902: invalid datatype

When trying to run examples from http://docs.oracle.com/cd/E11882_01/appdev.112/e25609/sem_apis_ref.htm everything is ok except the most important call of SPARQL query. Here's the shortened version of the example "family" script:
CREATE TABLE family_rdf_data (id NUMBER, triple SDO_RDF_TRIPLE_S);
EXECUTE SEM_APIS.create_sem_model('family', 'family_rdf_data', 'triple');
INSERT INTO family_rdf_data VALUES (15,
SDO_RDF_TRIPLE_S('family',
'<http://www.example.org/family/Tom>',
'<http://www.w3.org/1999/02/22-rdf-syntax-ns#type>',
'<http://www.example.org/family/Male>'));
COMMIT;
-- Select all males from the family model, without inferencing.
SELECT m
FROM TABLE(SEM_MATCH(
'{?m rdf:type :Male}',
SEM_Models('family'),
null,
SEM_ALIASES(SEM_ALIAS('','http://www.example.org/family/')),
null));
SQLPLUS output:
Table created.
PL/SQL procedure successfully completed.
1 row created.
Commit complete.
SELECT m
*
ERROR at line 1:
ORA-00902: invalid datatype
All similar calls from these examples fail with the same error. Any ideas?
The issue has been resolved with reinstallation of Oracle database from scratch including Spatial Option from the start.

CREATE SCHEMA using a name stored

I am trying to create a new schema on my postgres database which name is stored on an existing table, my query look like this:
CREATE SCHEMA (SELECT name FROM table)
But I am getting a syntax error. What am I doing wrong? Is this a valid way to create the new schema? Which other solution exist for this issue?
You can do it with dynamic sql:
do
$$
declare s_name text;
begin
-- make sure there is exactly one row in that table!
-- otherwise you need some where condition or an aggregat to ensure that.
SELECT name INTO s_name FROM some_table;
execute 'create schema '|| quote_ident(s_name);
end;
$$
It is not possible, create schema syntax required a valid schema name (i.e. valid schema name string). in your case it will throw exception as
********** Error **********
ERROR: syntax error at or near "("
SQL state: 42601
Character: 15

H2 column name select returning incorrect column name; "Column "OUT_ID" not found; SQL statement:"

I am using the H2 database, version "H2 1.3.170 (2012-11-30)"
I have the following tab delimited file contents:
in:value1:String out:id:Int out:description:String
N/A 0 N/A
Forced Available 1 Forced Available
Forced Not Available 2 Forced Not Available
I am using the following statement to create a table:
CREATE TABLE xo_coverage_voip_on_xo_override AS SELECT * FROM CSVREAD('C:\Temp\xo_coverage_voip_on_xo_override.tab', 'in_value_1' || chr(9) || 'out_id' || chr(9) || 'out_description', 'UTF-8', chr(9));
I attempt to use the created table with this:
SELECT out_id FROM xo_coverage_voip_on_xo_override;
And I receive this error:
"Column "OUT_ID" not found; SQL statement:"
Where am I going wrong?
Additionally, I would really like to remove the first row from the table before it is inserted. However, I wasn't able to get a WHERE clause to work.
Any assistance you could offer would be greatly appreciated.
So, the solution ends up being this statement:
CREATE TABLE xo_coverage_voip_on_xo_override1(in_value1 varchar, out_id int, out_description varchar)
AS SELECT * FROM CSVREAD('C:\Temp\xo_coverage_voip_on_xo_override.tab', null, 'UTF-8', chr(9));
The key is to have the CSVREAD query load data into a fully specified table. And to provide "null" for the header row so it is skipped in the file.