Member since
02-11-2019
81
Posts
3
Kudos Received
0
Solutions
05-19-2024
11:32 PM
1 Kudo
@ChineduLB Apache Impala does not enable multi-statement transactions, so you cannot perform an atomic transaction that spans many INSERT statements directly. You can achieve a similar effect by combining the INSERT INTO commands into a single INSERT INTO... SELECT statement that includes a UNION ALL. This method assures that all partitions are loaded within the same query run. you can consolidate your insert statements into one query INSERT INTO client_view_tbl PARTITION (cobdate, region) SELECT col, col2, col3, '20240915' AS cobdate, 'region1' AS region FROM region1_table WHERE cobdate = '20240915' UNION ALL SELECT col, col2, col3, '20240915' AS cobdate, 'region2' AS region FROM region2_table WHERE cobdate = '20240915' UNION ALL SELECT col, col2, col3, '20240915' AS cobdate, 'region3' AS region FROM region3_table WHERE cobdate = '20240915'; Single Query Execution: This approach consolidates multiple INSERT statements into one, which can improve performance and ensure consistency within the query execution context. Simplified Management: Managing a single query is easier than handling multiple INSERT statements. Ensure that your source tables (region1_table, region2_table, region3_table) and the client_view_tbl table have compatible schemas, especially regarding the columns being selected and inserted. Be mindful of the performance implications when dealing with large datasets. Test the combined query to ensure it performs well under your data volume. By using this combined INSERT INTO ... SELECT ... UNION ALL approach, you can effectively populate multiple partitions of the client_view_tbl table in one query. "please accept it as a solution if it it helps"
... View more
05-12-2024
01:41 AM
1 Kudo
@ChineduLB WITH data_counts AS ( SELECT COUNT(*) AS count_table1, COUNT(*) AS count_table2, COUNT(*) AS count_table3, COUNT(*) AS count_table4, COUNT(*) AS count_table5, COUNT(*) AS count_table6 FROM table1 WHERE date_partition = 'your_date' -- Replace 'your_date' with the specific date you're interested in UNION ALL SELECT COUNT(*), COUNT(*), COUNT(*), COUNT(*), COUNT(*), COUNT(*) FROM table2 WHERE date_partition = 'your_date' UNION ALL SELECT COUNT(*), COUNT(*), COUNT(*), COUNT(*), COUNT(*), COUNT(*) FROM table3 WHERE date_partition = 'your_date' UNION ALL SELECT COUNT(*), COUNT(*), COUNT(*), COUNT(*), COUNT(*), COUNT(*) FROM table4 WHERE date_partition = 'your_date' UNION ALL SELECT COUNT(*), COUNT(*), COUNT(*), COUNT(*), COUNT(*), COUNT(*) FROM table5 WHERE date_partition = 'your_date' UNION ALL SELECT COUNT(*), COUNT(*), COUNT(*), COUNT(*), COUNT(*), COUNT(*) FROM table6 WHERE date_partition = 'your_date' ) SELECT CASE WHEN SUM(count_table1) > 0 AND SUM(count_table2) > 0 AND SUM(count_table3) > 0 AND SUM(count_table4) > 0 AND SUM(count_table5) > 0 AND SUM(count_table6) > 0 THEN (SELECT * FROM table1 WHERE date_partition = 'your_date') ELSE NULL -- or whatever you want to return if data doesn't exist in all tables END AS result FROM data_counts;
... View more
05-12-2024
01:37 AM
@ChineduLB Impala doesn't directly support nested select statements within the WHEN clause of a CASE statement. However, you can achieve similar logic Subqueries for conditions: You can use subqueries within the WHEN clause to evaluate conditions based on data retrieved from other tables. SELECT case when (select count(*) from table1) > 0 then (select * from table1) when (select count(*) from table2) > 0 and (select count(*) from table3) > 0 then (select * from table3) else null end as result_table; This query checks if table1 has any rows. If yes, it selects all columns from table1. Otherwise, it checks if both table2 and table3 have rows. If both have data, it selects all columns from table3. If none of the conditions are met, it returns null.
... View more
02-26-2022
04:41 PM
If you want to delete role of TP, you can delete with any error message. 1.Click "Cloudera Management Service". 2. Select "Instances" tab in the Cloudera Management Service. 3. Choose " Telemetry Publisher" and click "Action for Selected" menu. 4. Choose " Delete" in the "Action for Selected" menu. 5. Popup "Delete Role Instances" and click "Delete" button.
... View more
08-30-2021
01:01 AM
Thanks for the confirmation @syedshakir. Much appreciated.
... View more
03-02-2021
10:08 PM
I had a similar issue in CDH 6.21 and doing this worked . rm -rf /var/lib/cloudera-scm-agent/cm_guid
... View more
11-22-2020
03:53 AM
Everything is done as per the installation guide you provided.... still no joy Weird thing is import from Teradata to CDH works seamlessly, Just can't get export working
... View more
11-13-2020
09:35 PM
could you give a working example of this in spark 2.4 using scala dataframe can't seem to find the correct syntax... val result = dataFrame.select(count(when( col("col_1") === "val_1" && col("col_2") === "val_2", 1)
... View more
11-05-2020
04:56 AM
Hi. unfortunately it doesn´t work for me. [root@comp476 cloudera-scm-agent]# ls -larth total 180K -rw-r--r--. 1 root root 36 Feb 19 2020 uuid -rw-r--r--. 1 root root 36 Feb 19 2020 cm_guid drwxr-xr-x. 55 root root 4.0K Jul 22 15:34 .. -rw-------. 1 root root 85 Nov 4 17:35 active_parcels.json.old20201105 -rw-------. 1 root root 80K Nov 4 20:09 response.avro.old20201105 -rw------- 1 root root 80K Nov 5 10:48 response.avro drwxr-xr-x. 2 cloudera-scm cloudera-scm 4.0K Nov 5 10:50 . You have new mail in /var/spool/mail/root I stopped de agent , modified the files´s names and restarted the agent.
... View more
05-04-2020
07:34 PM
You can run the below command: solrctl cluster --get-solrxml /tmp/solr.xml The file will be stored in /tmp/solr.xml
... View more