- 浏览: 772756 次
- 性别:
- 来自: 广州
最新评论
文章列表
1、用途说明
dirname命令可以取给定路径的目录部分,如果给定的参数本身为一个目录,那就取当前目前的上一层目录。这个命令很少直接在shell命令行中使用,一般把它用在shell脚本中,用于取得脚本文件所在目录,然后将当前目录切换过去。
Usage: dirname NAME
or: dirname OPTION
Print NAME with its trailing /component removed; if NAME contains no /'s,
output `.' (meaning the current directory).
-- ...
一、行转列的使用
1、问题
hive如何将
a b 1a b 2a b 3c d 4c d 5c d 6
变为:
a b 1,2,3c d 4,5,6
2、数据
hive提供了复合数据类型:Structs: structs内部的数据可以通过DOT(.)来存取,例如,表中一列c的类型为STRUCT{a INT; b INT},我们可以通过c.a来访问域aMaps(K-V对):访问指定域可以通过["指定域名称"]进行,例如,一个Map M包含了一个group-》gid的kv对,gid的值可以通过M['group']来获取Arrays:array中的数据为相同类型,例如,假如array A中元素['a','b','c'],则A[1]的值为'b'Struct使用
建表:
[plain]
hive 可以通过with查询来提高查询性能,因为先通过with语法将数据查询到内存,然后后面其它查询可以直接使用
保序回归(英文:Isotonic regression)在数值分析中指的是在保序约束下搜索一个加权 w 的最小二乘 y 以拟合变量 x,它是一个二次规划问题
python的实现版本:http://scikit-learn.org/stable/auto_examples/plot_isotonic_regression.html#example-
mysql查看锁表方法详解
1、show OPEN TABLES where In_use > 0;
查看哪些表在使用中,In_use列表示有多少线程正在使用某张表,Name_locked表示表名是否被锁,这一般发生在Drop或Rename命令操作这张表时。所以这条命令不能帮助解答我们常见的问题:当前某张表是否有死锁,谁拥有表上的这个锁等。
2、show status like '%lock%', show status like 'Table%'查看服务器状态
可以通过检查table_locks_waited和table_locks_immed ...
shell中&&和||的使用方法
&&运算符:
command1 && command2
&&左边的命令(命令1)返回真(即返回0,成功被执行)后,&&右边的命令(命令2)才能够被执行;换句话说,“如果这个命令执行成功&&那么执行这个命令”。
语法格式如下:
command1 && command2 [&& command3 ...]
1 命令之间使用 && 连接,实现逻辑与的功能。
int(10): 之前总以为其中的10表示字段所能表示的位数,其实发现理解错了,这个10表示的是数据显示的长度为10位。
如:int(2):并不表示数据的大小最大为99,其最大的值和int表示的最大值一样,只是表示查询时显示的结果长度为2位
int
从 -2^31 (-2,147,483,648) 到 2^31 – 1 (2,147,483,647) 的整型数据(所有数字)。存储大小为 4 个字节。int 的 SQL-92 同义字为 integer。
无符号时,表示的范围为:0~4294967295
有符号时,表示的范围为:-2147483648~2147483647
...
Replace into是Insert into的增强版。在向表中插入数据时,我们经常会遇到这样的情况:
1、首先判断数据是否存在;
2、如果不存在,则插入;
3、如果存在,则更新。
在SQL Server中可以这样处理:
if not exists (select 1 from t where id = 1) insert into t(id, update_time) values(1, getdate()) else update t set update_time = getdate() where id = 1
通过impala-shell 连接到impala shell命令下是,输入命令要删除字符时会出现 ^H字符,而不能真正删除,如下所示:
[await]mqq@192.168.10.1:~$ impala-shell
Starting Impala Shell without Kerberos authentication
Connected to slave1:21000
Server version: impalad version cdh5-1.3.0 RELEASE (build 40e1b62cf0b97f666d084d9509bf9639c575068c)
Wel ...
saiku mondrian配置聚合表的目的是通过先生成要分析的数据,在实际分析时,直接从聚合表提取结果,省去实时分析的步骤,从而提高分析性能。
配置聚合表的方式:
<Cube name="Test_Demo">
<Table name="demo.t_test_demo" alias="t_test_demo">
<AggName name="agg_2_t_test_demo">
<AggFactCount column="row_count&q ...
今天写了个程序通过jdbc的方式去连接impala,访问库里的数据时遇到如下错误:
java.sql.SQLException: Error: Error: could not match input
at org.apache.hive.jdbc.Utils.verifySuccess(Utils.java:159)
at org.apache.hive.jdbc.Utils.verifySuccessWithInfo(Utils.java:147)
at org.apache.hive.jdbc.HiveStatement.e ...
一、find查找用法
find [-H] [-L] [-P] [-Olevel] [-D help|tree|search|stat|rates|opt|exec] [path...] [expression]
find默认的寻找路径为当前目录,并且默认的表达式为-print
1、列出某个路径下所有文件,包括子目录。
find /data -name “*”
2、查找在某个路径下所有包含“test abc”字符串的文件
find /data -name “*” | xargs grep “test abc”
3、-name:按照文件名查找
find /data -nam ...
一。查看内核版本命令:
1) [root@SOR_SYS ~]# cat /proc/versionLinux version 2.6.18-238.el5 (mockbuild@x86-012.build.bos.redhat.com) (gcc version 4.1.2 20080704 (Red Hat 4.1.2-50)) #1 SMP Sun Dec 19 14:22:44 EST 2010[root@SOR_SYS ~]#
2)[root@SOR_SYS ~]# uname -r2.6.18-238.el53)[roo ...
mysql 修改表的详细语法介绍
ALTER [IGNORE] TABLE tbl_name
[alter_specification [, alter_specification] ...]
[partition_options]
algorithm_option:
ALGORITHM [=] {DEFAULT|INPLACE|COPY}
lock_option:
LOCK [=] {DEFAULT|NONE|SHARED|EXCLUSIVE}
alter_specification:
table_option ...