Impala ACID table select ERROR: Operation not supported on transactional (ACID) table: - hive

I'm using impala 3.4 directly with hive 3.1.
The problem is that if you create a general table in the hive and then select it in impala, an error occurs.
The error message is as follows:
Query: show tables
+----------+
| name |
+----------+
| customer |
| lineitem |
| nation |
| orders |
| part |
| partsupp |
| region |
| supplier |
| t |
+----------+
Fetched 9 row(s) in 0.02s
[host.cluster.com] default> select * from customer;
Query: select * from customer
Query submitted at: 2020-11-20 09:56:12 (Coordinator: http://host.cluster.com:25000)
ERROR: AnalysisException: Operation not supported on transactional (ACID) table: default.customer
In the hive, the acid table and the orc table are only concerned with whether to delete or update, but I knew that selection is common.
In fact, the select statement is normally executed through hive jdbc. Only impala would like to help you understand why this error occurs.

I solved this problem. It was confirmed that the table created through Hive in impala operates normally.
There are two possible causes:
Connect impala built with Hive2 to Hive 3 databases.
When creating a Hive Table that I did not recognize, set the default flag related to ACID.

This version can't read ACID table wich are created by Hive. Hive creates ACID table by default.

Related

synapse pipeline copied data to azure synapse data lake table - serverless sql select shows rows, but spark sql select does not

I made a new Azure synapse data lake database and table:
CREATE DATABASE IF NOT EXISTS db1 LOCATION '/db1';
CREATE TABLE IF NOT EXISTS db1.tbl1(id int, name string) USING CSV (header=true);
I then ran a synapse pipeline to copy data from a source to the ADLS sink for this table. I see the expected csv file in the ADLS container and folder - synapse-workspace-container/db1/tbl1/employee.csv:
id,name
1,adam
2,bob
3,charles
Running a serverless SQL select statement I see my rows:
SELECT TOP (100) [id]
,[name]
FROM [db1].[dbo].[tbl1]
+---+-------+
| id| name|
+---+-------+
| 1| adam|
| 2| bob|
| 3|charles|
+---+-------+
Running a pyspark sql select I see no rows:
sdf=spark.sql("SELECT * FROM db1.tbl1 ORDER BY id ASC")
sdf.show()
+---+----+
| id|name|
+---+----+
+---+----+
Why are no rows showing for spark sql?
I would like to suggest creating global temp view. As a result, you can use this view in any notebook you want as long as your cluster is not terminated. Having said that, you could create global temp view as below -
df.createOrReplaceGlobalTempView("temp_view")
Kindly refer the below document:
https://docs.databricks.com/spark/latest/spark-sql/language-manual/sql-ref-syntax-ddl-create-view.html

Drop user without a name from sql database

Executing the following command
MariaDB [(none)]> select distinct user from mysql.user;
results in
+-------------+
| User |
+-------------+
| app_user |
| |
| test_u |
| mariadb.sys |
| root |
+-------------+
5 rows in set (0.001 sec)
So I have probably created a user with no name, correct? Perhaps by using a wrong syntax in the past. Question is how to drop the user? Something like the following doesn't seem to work:
MariaDB [(none)]> drop user ' ';
ERROR 1396 (HY000): Operation DROP USER failed for ' '#'%'
drop is used to remove tables https://dev.mysql.com/doc/refman/8.0/en/drop-table.html, DROP TABLE User
Try DELETE FROM User WHERE User.user = ' '
After some trial and error I stumbled upon mysql.user does not exist. During the execution of mysql_secure_installation the terminal states
By default, a MariaDB installation has an anonymous user, allowing
anyone to log into MariaDB without having to have a user account
created for them. This is intended only for testing, and to make the
installation go a bit smoother. You should remove them before moving
into a production environment.
Remove anonymous users? [Y/n] Y
... Success!
So this ' ' user is equal to the anonymous user described here. Running select distinct user from mysql.user; after the removal of anonymous users.
Results in
+-------------+
| User |
+-------------+
| app_user |
| test_u |
| mariadb.sys |
| root |
+-------------+
So probably this ' ' user was already there.

Fetch last Refresh time of Materialized View in CockroachDB

In CockroachDB v20.2, one can retrieve a list of Materialized Views using:
> SELECT * FROM pg_catalog.pg_matviews;
schemaname | matviewname | matviewowner | tablespace | hasindexes | ispopulated | definition
----------------------------------------------------------------------------------------------------
public | VIEWNAME | root | NULL | false | true | VIEWDEFINITION
From here, how can we find when this View was last Refreshed?
This information isn't available from the internal tables, as far as I know. I don't think PostgreSQL has it either.
A workaround could be to define your materialized view with an additional timestamp column, like:
create materialized view my_view as select col, now() as last_updated from tab;
The downside of this is that every row in the view will have this column and will use the extra disk space.

How do I resolve a MariaDB possibly corrupted table error when it doesn't look corrupted

I had 2 theories. 1. that it was a permissions error 2. that the table was corrupt. I seem to addressed both without result. What could cause this ERROR 1728 message?
Running it as mysql user does not work
MariaDB [mysql]> DROP FUNCTION IF EXISTS civicrm_strip_non_numeric;
ERROR 1728 (HY000): Cannot load from mysql.proc. The table is probably corrupted
It does not say that it is corrupt.
MariaDB [mysql]> repair table proc;
+------------+--------+----------+----------+
| Table | Op | Msg_type | Msg_text |
+------------+--------+----------+----------+
| mysql.proc | repair | status | OK |
+------------+--------+----------+----------+
This fixes it
mysql_upgrade -u root -pxxx
wasn't aware that I upgraded as this is a new installation.
same for mariadb as mysql

Triggering mysql delete in another table?

I have 3 tables in my database:
| systems |
|-------------|
| system_id |
|-------------|
| systems_maintenances |
|-------------------------|
| systems_maintenances_id|
| system_id |
| maintenance_id |
|-------------------------|
| maintenances |
|-------------------------|
| maintenance_id |
|-------------------------|
I'd like that when I delete a system, the maintenance being deleted too.
For the moment it only deletes in the systems_maintenances table.
I think a trigger is the best (and only?) way to do that.
I created this one:
CREATE TRIGGER `deleteMaintenance` BEFORE DELETE ON `systems`
FOR EACH ROW BEGIN
DELETE FROM maintenances
WHERE maintenance_id = systems_maintenances.maintenance_id;
END
The problem is I get the error:
DELETE FROM SNMProject.systems WHERE systems.system_id =16
MySQL a répondu:
#1054 - Unknown column 'systems_maintenances.maintenance_id' in 'where clause
How to solve my problem?
I don't know if it can help but I have this too for the systems_maintenances table:
(source: xooimage.com)
In a trigger, you don't refer to the table name of the table being affected. Instead, you refer to a proxie for it. That proxie depends on the database. In MySQL, it is new and old.
I suspect that you want something like this:
CREATE TRIGGER `deleteMaintenance` BEFORE DELETE ON `systems` FOR EACH ROW BEGIN
DELETE FROM maintenances m
WHERE maintenance_id IN (SELECT maintenance_id
FROM systems_maintenances sm
WHERE systems_maintenances.system_id = old.system_id
)
END;
There are other ways to express this logic, but this gives a good idea of the structure.
You can do essentially the same thing using cascading deletes, if you prefer. That way, you don't have to write triggers and can put the logic in the create table statement.