关于Hive的中文注释以及hwi查询中文结果的问题
来源:互联网 发布:js防止表单二次提交 编辑:程序博客网 时间:2024/04/27 23:46
1.Hive中文注释
当在hive中使用create table t1(c1 string comment '列1');创建表t1后,若用describe t1;显示表结构,则注释部分‘列1’显示为‘?1’
因此需要在MySQL数据库中对hive数据库的表进行编码设置,前文在配置环境部分已经对hive-site.xml中与MySQL连接的编码设置为UTF-8,正常的数据部分的中文在命令行下是可以显示的,此处仅叙述对MySQL中表的设置
使用mysql -u root -p进入MySQL
show databases;显示所有数据库
use hive;进入hive的默认数据库
show tables;查看所有表
alter table COLUMNS_V2 modify column COMMENT varchar(256) character set utf8; 修改字段注释字符集
alter table TABLE_PARAMS modify column PARAM_VALUE varchar(4000) character set utf8;修改表注释字符集
在hive中删除t1表之后再重新创建即可显示中文注释
其他相关设置可参考解决各个hive版本中文注释不能正确显示的问题
关于MySQL的命令查看Mysql命令
2.hwi查询结果显示中文
在hwi创建会话查询数据,结果中文部分无法显示
数据文件在导入hive前已经转换成UTF-8编码,而且命令行可以正常显示,因此可能是hwi的web页面设置时没有对编码做相关设置,查看url得知view_result.jsp为当前的web文件,于是在~/hive/lib下找到打包好的hive-hwi-2.1.0.war,里面是hwi的web文件,找到view_result.jsp,在文件头部指定编码格式
<%-- Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.--%><%@ page contentType="text/html;charset=UTF-8"%><%@page errorPage="error_page.jsp" %><%@ page import="org.apache.hadoop.hive.hwi.*,java.io.*" %><% HWIAuth auth = (HWIAuth) session.getAttribute("auth"); %><% HWISessionManager hs = (HWISessionManager) application.getAttribute("hs"); %><% if (auth==null) { %><jsp:forward page="/authorize.jsp" /><% } %><% String sessionName=request.getParameter("sessionName"); %><% HWISessionItem sess = hs.findSessionItemByName(auth,sessionName);%><% int start=0; if (request.getParameter("start")!=null){ start = Integer.parseInt( request.getParameter("start") ); }%><% int bsize=1024; if (request.getParameter("bsize")!=null){ bsize = Integer.parseInt( request.getParameter("bsize") ); }%>第17行为编码格式,保存文件并重新启动hwi后查询结果显示为中文
- 关于Hive的中文注释以及hwi查询中文结果的问题
- Hive中文注释乱码问题的解决
- Hive中文注释乱码问题的解决
- Hive中文注释问题
- Hive中文注释问题
- hive metadata 存mysql 注释中文乱码的问题
- hive中字段注释中中文出现乱码的问题
- hive中文注释乱码问题
- 关于通过数据库表明查询字段的中文注释
- 关于PL/SQL查询结果中文乱码的解决办法
- Mysql查询中文结果集为空的问题
- MySqlCommand查询条件中包含中文没有结果的问题
- Hive的使用之hwi
- [Unity3D]关于中文注释导致的文件编码错误问题
- 关于新版eclipse中文注释字体显小的问题
- [Unity3D]关于中文注释导致的文件编码错误问题
- 关于中文注释导致的文件编码错误问题
- 关于Lucene.net中文分词后的结果着色问题
- tar 报错gzip: stdin: not in gzip format
- HDOJ 1285 确定比赛名次
- linux 记录
- Masonry介绍与使用实践:快速上手Autolayout
- 控件 SnackBar的使用
- 关于Hive的中文注释以及hwi查询中文结果的问题
- Java和MySQL数据类型对应一览
- android studio导入module依赖工程
- oracle物理DG管理-redo数据传输,应用与三种模式
- form表单提交的几种方法
- 非常全面的 Android Bitmap 知识点梳理
- 在WIN7中修改wget的环境变量,(针对安装在非系统盘盘的wget)
- 修改mysql编码
- Android之分屏模式解析(上)