The following HQL is generating an error on HDP 2.6.1 & Hive 1.2.1000. Is it a beeline issue or the Hive version?
CREATE EXTERNAL TABLE IF NOT EXISTS `nwdb.strings` (`string_id` INT, `string_data` STRING, PRIMARY KEY(string_id) DISABLE NOVALIDATE) ROW FORMAT DELIMITED FIELDS TERMINATED BY "," LINES TERMINATED BY "\n" STORED AS TEXTFILE LOCATION "/data/nwdb/";
Error
Error: Error while compiling statement: FAILED: ParseException line 1:133 cannot recognize input near 'KEY' '(' 'string_id' in column type (state=42000,code=40000)
Even ALTER command gives the same error
ALTER TABLE `aravind_stg_platform_nw_northwind_nwdb.strings` ADD CONSTRAINT string_id_PK PRIMARY KEY (`string_id`);
It seems the support for primary keys and foreign is from Hive 2.1
https://issues.apache.org/jira/browse/HIVE-13290
Related
I have a spring boot application that connects to Cockroachdb. I have the following script in my flyway using which the table gets created:
CREATE TABLE IF NOT EXISTS sample_table (
name varchar,
groups varchar,
PRIMARY KEY (name));
The application starts fine, but whenever there is a value for the 'groups' column that is greater than 255 length, I get an error :
Caused by: org.postgresql.util.PSQLException: ERROR: value too long for type VARCHAR(255)
In the sql script, I have mentioned the column 'groups' as 'varchar' which should not restrict the length so I am not sure why am I getting this error.
There isn't an implicit default limit on varchar in CockroachDB. This error indicates that the groups column was initialized with the type varchar(255) when the table was created. Running SHOW CREATE TABLE sample_table; should confirm this.
It's possible that something unexpected is going on in the flyway and the table is not being created how you want it to be created.
I am trying to load a table from MSSQL - IBM Informix DB. Tables without Primary key are getting loaded but ones with Primary key are not loading and throwing following error
Stream component 'st_2_Informix_Target' terminated
Stream component failed at subtask 2, component st_2_Informix_Target
Error executing data handler
Handling new table 'dbo'.'region3' failed
execute create primary key failed, statement ALTER TABLE dbo.region3 ADD CONSTRAINT region3_PK__region3__3213E83F82CE48A3 PRIMARY KEY ( id )
RetCode: SQL_ERROR SqlState: 42000 NativeError: -201 Message: [Informix][Informix ODBC Driver][Informix]A syntax error has occurred.
Failed (retcode -1) to execute statement: 'ALTER TABLE dbo.region3 ADD CONSTRAINT region3_PK__region3__3213E83F82CE48A3 PRIMARY KEY ( id )'
Someone (I guess SQLServer or DMS) is trying to add a primary key to the Informix table using SQLServer SQL syntax which is not valid in Informix.
> ALTER TABLE dbo.region3 ADD CONSTRAINT region3_PK__region3__3213E83F82CE48A3 PRIMARY KEY ( id );
201: A syntax error has occurred.
Error in line 1
Near character position 40
> ALTER TABLE dbo.region3 ADD CONSTRAINT PRIMARY KEY ( id ) CONSTRAINT region3_PK__region3__3213E83F82CE48A3;
Table altered.
>
I suggest to check if there are any options to disable PK creation when doing the load task.
Consider the following table.
CREATE TABLE IF NOT EXISTS wsfiles
(
id INTEGER PRIMARY KEY AUTOINCREMENT,
website_id integer NOT NULL,
parent_id integer,
archive_id integer,
path character varying,
path_sha character varying NOT NULL,
target character varying,
name character varying NOT NULL,
is_directory boolean
CONSTRAINT uniq_file_website_backup UNIQUE (archive_id, path_sha) ON CONFLICT REPLACE
);
And I need to create the following unique partial index.
CREATE UNIQUE INDEX IF NOT EXISTS idx_unique_directory ON wsfiles(path_sha) WHERE is_directory = 1;
But when executing the above schema I am getting a syntax error near the WHERE clause in CREATE UNIQUE INDEX query. This is working well in my local machine and the problem occurs when I am executing on the production machine.
Error: near line 98: near "WHERE": syntax error
Production machine sqlite3 version is 3.7.17
Local machine sqlite3 version is 3.8.5
The documentation says:
Partial indexes have been supported in SQLite since version 3.8.0.
I am trying to alter the size of a column 'Login' which is a primary key in my table 'Utilisateurs' which is in my in 'ME' database. I tried this command:
ALTER TABLE ME.UTILISATEURS
ALTER COLUMN login VARCHAR (50) ;
but I get this error:
Error code -1, SQL state 42X01: syntax Erreur : Encountered "varchar" at line 2, column 21.
I am using netbeans IDE, the Derby Driver.
ALTER TABLE ME.UTILISATEURS
ALTER COLUMN login SET DATA TYPE VARCHAR(50)
I've been trying to grapple with phpPgAdmin and am having difficulties. when trying to use the automated tool to create a table, I get the following error:
SQL error:
ERROR: syntax error at or near "(" at character 96
In statement:
CREATE TABLE "public"."business_secondary_category" ("id" SERIAL, "primary_category_id" integer(10) DEFAULT NULL, "secondary_category" character varying(150) DEFAULT NULL, PRIMARY KEY ("id")) WITHOUT OIDS
This is how I set it up:
I can't figure out what I've done wrong. Link to character.
Try taking out the length specification for the primary_category_id column, postgresql doesn't support the type integer(10), only integer (aka int4)