im install hive bug query have |,how to solve it? - hive

im install ambari then install hive,but when i use it,like this:
0: jdbc:hive2://master.ambari:2181,slave1.amb>
The correct display should be
hive>
and other err
0: jdbc:hive2://master.ambari:2181,slave1.amb> select 1,2,3;
+------+------+------+
| _c0 | _c1 | _c2 |
+------+------+------+
| 1 | 2 | 3 |
+------+------+------+
1 row selected (0.221 seconds)
The correct display should be
hive>select 1,2,3;
1 2 3
How do we deal with this problem?

The correct display should be
No, beeline should be used instead of hive command, and will result in the full connection URI displayed.
If you want to turn the frames off, then you can use
>!set showheader false;
>select 1,2,3;

Related

Longest Common Prefix Per Aggregate Using Apache Spark SQL

I am using apache spark to find the longest common prefix per session
Given the following example:
session | prefix
_____________________
1 | keys
1 | key chain
1 | keysmith
2 | tim
2 | timmy
2 | tim hortons
I would like to format this into the following output:
session | prefix
_____________________
1 | key
2 | tim
I saw an example which checks a column in one row against all others but I have trouble wrapping my head around how to do this for aggregate rows.
Any help is appreciated!
try like below
select session,min(length(prefix)) from table_name
group by session

AQL can not find row by PK. Row is there when selecting

I have a namespace and a set in aerospike with information inside.
After performing a SELECT * FROM mytecache.search_results I get around 600 rows of this:
"bdee9a37e3217f28a057b5e0ebbef43f_Sabre_13" | "a:11:{s:5:"price";a:14:{s:5:"total";d:2947.5999999999999;s:11:"pricePerPax";d:1473.8;s:8:"totalflt";d:2947.5999999999999;s:9:"baseprice";d:1901.0799999999999;s:3:"tax";d:986.51999999999998;s:10:"servicefee";i:60;s:11:"markupprice";d:1961.0799999999999;s | "flight_bdee9a37e3217f28a057b5e0ebbef43f" | 147380 | LIST('["LH", "LH", "LH", "LH"]'....
As you know, the first column is the primary key, so I try to select the row (which just appeared in SELECT) with:
aql> SELECT * FROM mytecache.search_results WHERE PK = "bdee9a37e3217f28a057b5e0ebbef43f_Sabre_13"
and I get:
Error: (2) AEROSPIKE_ERR_RECORD_NOT_FOUND
Explain returns this:
aql> EXPLAIN SELECT * FROM mytecache.search_results WHERE PK="bdee9a37e3217f28a057b5e0ebbef43f_Sabre_13"
+------------------+--------------------------------------------+-------------+-----------+--------+---------+----------+----------------------------+-------------------+-------------------------+---------+
| SET | DIGEST | NAMESPACE | PARTITION | STATUS | UDF | KEY_TYPE | POLICY_REPLICA | NODE | POLICY_KEY | TIMEOUT |
+------------------+--------------------------------------------+-------------+-----------+--------+---------+----------+----------------------------+-------------------+-------------------------+---------+
| "search_results" | "6F62BE5323F0A51EF7DFDD5060A02E62CD2453F0" | "mytecache" | 623 | 2 | "FALSE" | "STRING" | "AS_POLICY_REPLICA_MASTER" | "BB9B25B63000056" | "AS_POLICY_KEY_DEFAULT" | 1000 |
+------------------+--------------------------------------------+-------------+-----------+--------+---------+----------+----------------------------+-------------------+-------------------------+---------+
1 row in set (0.002 secs)
asinfo outputs:
1 : node
BB9B25B63000056
2 : statistics
cluster_size=1;cluster_key=883272F81547;cluster_integrity=true;cluster_is_member=true;uptime=1146;system_free_mem_pct=90;system_swapping=false;heap_allocated_kbytes=6525778;heap_active_kbytes= 6529792;heap_mapped_kbytes=6619136;heap_efficiency_pct=99;heap_site_count=14;objects=6191;tombstones=0;tsvc_queue=0;info_queue=0;delete_queue=0;rw_in_progress=0;proxy_in_progress=0;tree_gc_queue=0; client_connections=19;heartbeat_connections=0;fabric_connections=0;heartbeat_received_self=7637;heartbeat_received_foreign=0;reaped_fds=47;info_complete=12326;proxy_retry=0;demarshal_error=0;early_ tsvc_client_error=0;early_tsvc_batch_sub_error=0;early_tsvc_udf_sub_error=0;batch_index_initiate=0;batch_index_queue=0:0,0:0,0:0,0:0;batch_index_complete=0;batch_index_error=0;batch_index_timeout=0 ;batch_index_unused_buffers=0;batch_index_huge_buffers=0;batch_index_created_buffers=0;batch_index_destroyed_buffers=0;batch_initiate=0;batch_queue=0;batch_error=0;batch_timeout=0;scans_active=0;qu ery_short_running=0;query_long_running=0;sindex_ucgarbage_found=0;sindex_gc_locktimedout=0;sindex_gc_list_creation_time=39;sindex_gc_list_deletion_time=0;sindex_gc_objects_validated=11734;sindex_gc _garbage_found=0;sindex_gc_garbage_cleaned=0;paxos_principal=BB9B25B63000056;migrate_allowed=true;migrate_partitions_remaining=0;fabric_bulk_send_rate=0;fabric_bulk_recv_rate=0;fabric_ctrl_send_rat e=0;fabric_ctrl_recv_rate=0;fabric_meta_send_rate=0;fabric_meta_recv_rate=0;fabric_rw_send_rate=0;fabric_rw_recv_rate=0
3 : features
peers;cdt-list;cdt-map;pipelining;geo;float;batch-index;replicas-all;replicas-master;replicas-prole;udf
4 : cluster-generation
1
5 : partition-generation
0
6 : build_time
Sat Nov 4 02:19:49 UTC 2017
7 : edition
Aerospike Community Edition
8 : version
Aerospike Community Edition build 3.15.0.2
9 : build
3.15.0.2
10 : services
11 : services-alumni
12 : build_os
debian8
Which seems wrong. Why is the query not returning the result, when it is clearly there ?
"As you know, the first column is the primary key," -- no first column is your first bin. The primary key is whatever you used to write the record. Aerospike does not store your primary key.
You are quite likely using a wrong PK for the record whose first bin is "bdee9a37e3217f28a057b5e0ebbef43f_Sabre_13"
https://www.aerospike.com/docs/tools/aql/data_management.html
“STATUS” is the status of the operation. It will be the code as returned by the client for the record. E.g: 0 is AEROSPIKE_OK and 2 is AEROSPIKE_ERR_RECORD_NOT_FOUND.
So, even your explain execution in AQL is telling you in the STATUS that the record is not found.

Apache-pig Number Extraction After a specific String

I have a file with 10,1900 lines with Delimiter as 5 ('|') [obviously 6 columns now] , and I have statement in sixth column like "Dropped 12 (0.01%)" !! I am longing to extract the number after Dropped within brackets;
Actual -- Dropped 12 (0.01%)
Expected -- 0.01
I need a solution using Apache pig.
You are looking for the REGEX_EXTRACT function.
Let's say you have a table A that looks like:
+--------------------+
| col1 |
+--------------------+
| Dropped 12 (0.01%) |
| Dropped 24 (0.02%) |
+--------------------+
You can extract the number in parenthesis with the following:
B = FOREACH A GENERATE REGEX_EXTRACT(col6, '.*\\((.*)%\\)', 1);
+---------+
| percent |
+---------+
| 0.01 |
| 0.02 |
+---------+
I'm specifying a regex capture group for whatever characters are between ( and %). Notice that I'm using \\ as the escape character so that I match the opening and closing parenthesis.

SQL - Exclude four-digit-number

I have an SQL-Server with and simple table on it.
ID | Code
---+--------
1 | 1234
2 | TEST
3 | 12556
4 | TEST1
5 | 5678
6 | WART
I want to exclude all four-digit-number. In my case that would be 1234 and 5678.
I know I can use ISNUMERIC() tp check if code is numeric.
I also know I can use:
SELECT * FROM Codes WHERE code NOT LIKE '____';
to check if my value has four digits, but i dont get it how to combine them.
Any suggentions?
Thanks in advance!
Just use not like:
where code not like '[0-9][0-9][0-9][0-9]'

how to increment field value each time selenium test is run?

is there any simple way to increment for example field value by +1 every time Selenium test is run through Selenium IDE?
Command: Type
Target: some kind of id
Value: number+1
EDIT 1 :thanks for a reply krosenvold. i got your idea and this is a simplified version of what i got so far:
...
store | 10 | x
storeEval | storedVars['x'] = ${x}+1 |
...
variable's x value does realy get incremented, but how would you save that value between distinct test runs? is it even possible?
should i get $x value every time the test is run and at the end of it assign $x value to some dummy element on testing page, so i could retrieve that previously incremented value the next time test is run?
Correct Answer
store | 10 | i
store | javascript{storedVars.i++;} | i
echo | ${i}
This is solution for your problem
store | 10 | i
store | javascript{storedVars.i++;}
echo | ${i}
store | 0 | iterator
echo | ${iterator} |
execute script | return parseInt(${iterator}) + 1 | iterator
echo | ${iterator} |
As result will be:
0
1
You can use eval;
eval($('elementId').value = $('elementId').value +1);
The exact syntax I'm showing implies prototype on the client;
document.getElementById('elementId').value should also do the trick in a standard DOM environment.
This worked for me
storeEval | storedVars['nextRow'] = ${nextRow}+1 |