
SQL
魂落忘川犹在川
无端坠入红尘梦,惹却三千烦恼丝。
展开
-
hive的limit失效问题
问题语句select app_name,count(1) as cnt from ( select name,seq_id from tmp.data_20220418 group by name ,seq_id) a group by app_name limit 10; 当我在spark去运行这个语句时加不加limit 结果是一致的但是当我用beeline去运行时, 加limit 结果只有一行错误数据, 不加limit 才能跑出正常结果排查过程把limit相关参数原创 2022-04-29 16:42:02 · 2927 阅读 · 0 评论 -
hive自动化上传文件到表
自动化实现上传文件到表#!/bin/bash. /etc/profile. ~/.bash_profile. ~/.bashrcerror() { if [[ $? != 0 ]]; then echo "$@ 运行失败" exit 1 fi}# 待上传表名inset_table_name=$1# 待上传文件名file_name=$2# 分区名pt=$3load_path="/tmp/load_path/"curr原创 2022-03-04 19:29:44 · 1280 阅读 · 0 评论 -
python-读取txt文件并取部分列的带某字符的数据写到EXCEL(二)
需求:读取本地csv文件取某一列包含某字符数据,可用正则结果写入EXCLEimport pandas as pdimport timecurr_date = time.strftime("%Y%m%d", time.localtime())print(curr_date)path = "D:/code_fileAll/test_file/input/111.csv"res_path = "D:/code_fileAll/test_file/output/"# 读取文件内容,第一.原创 2021-12-31 19:43:34 · 409 阅读 · 0 评论 -
mysql进阶操作去重及空值处理篇(四)
此篇主要介绍去重和去重过程中空值的处理源表部分内容一、去重的四种方式group by-- 去重时 空和null均参与计算select name from demo.product_name group by name ;distinctselect distinct name from demo.product_name ;窗口函数-- 伪列实现去重select * from ( select *,ROW_NUMBER() ov原创 2021-12-20 16:10:19 · 2854 阅读 · 0 评论 -
mysql进阶操作join篇(三)
本文主要介绍mysql中常用join和in,exists 的转化mysql 版本:mysqlVer8.0.27forWin64onx8664(MySQLCommunityServer−GPL)\color{red}{mysql Ver 8.0.27 for Win64 on x86_64 (MySQL Community Server - GPL)}mysqlVer8.0.27forWin64onx8664(MySQLCommunityServer−GPL)注意:使用5.7以下版本建表是不支持两个原创 2021-12-20 11:11:08 · 635 阅读 · 0 评论 -
mysql 进阶操作json篇(二)
一、 样例数据准备建表CREATE TABLE `product_name_copy_2` ( `id` bigint NOT NULL AUTO_INCREMENT, `name` json DEFAULT NULL COMMENT '产品名', `create_time` timestamp NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', `update_time` timestamp NULL DEFAULT CURRENT_T原创 2021-12-17 16:21:29 · 570 阅读 · 0 评论 -
解决本机装载mysql无法使用ip连接问题
基础配置mysql 版本 5.7连接工具Navicat一、先用localhost进入mysql,找到mysql库里的user表二、修改第一列Host值为 %三、刷新配置 flush privileges;四、编辑连接设置ip连接原创 2021-12-16 10:57:50 · 2466 阅读 · 0 评论 -
hiveSQL计算连续值
原始测试数据准备nameseq_numa1a2b4b5c1c3c4创建测试表create table if not exists tmp.rows_preced_test_20210526(name string comment '用户名',seq_num int comment '使用产品编码')partitioned by (pt string comment 'YYMMDD数据入库时间')ROW FOR.原创 2021-10-13 17:02:42 · 461 阅读 · 0 评论