代码拉取完成,页面将自动刷新
import React from 'react';
import XtermTerminal from '@rasir/xterm-terminal';
const XtermLogger = () => {
const testText = `2022-07-29 13:49:20,288 [main] ERROR - execute sql error
org.apache.hive.service.cli.HiveSQLException: Error while compiling statement: FAILED: SemanticException org.apache.hadoop.hive.ql.parse.SemanticException: Table already exists: sf_hkust.yiqing_755fb_0729_waybill_182
at org.apache.hive.jdbc.Utils.verifySuccess(Utils.java:266)
at org.apache.hive.jdbc.Utils.verifySuccessWithInfo(Utils.java:252)
at org.apache.hive.jdbc.HiveStatement.runAsyncOnServer(HiveStatement.java:318)
at org.apache.hive.jdbc.HiveStatement.execute(HiveStatement.java:260)
at com.sf.bdp.schetl.hive.driver.HiveJdbcExecutor.execute(HiveJdbcExecutor.java:93)
at com.sf.bdp.schetl.hive.driver.HiveJdbcExecutor.execute(HiveJdbcExecutor.java:112)
at com.sf.bdp.schetl.hive.driver.HiveDriver.main(HiveDriver.java:71)
Caused by: org.apache.hive.service.cli.HiveSQLException: Error while compiling statement: FAILED: SemanticException org.apache.hadoop.hive.ql.parse.SemanticException: Table already exists: sf_hkust.yiqing_755fb_0729_waybill_182
at org.apache.hive.service.cli.operation.Operation.toSQLException(Operation.java:388)
at org.apache.hive.service.cli.operation.SQLOperation.prepare(SQLOperation.java:193)
at org.apache.hive.service.cli.operation.SQLOperation.runInternal(SQLOperation.java:276)
at org.apache.hive.service.cli.operation.Operation.run(Operation.java:324)
at org.apache.hive.service.cli.session.HiveSessionImpl.executeStatementInternal(HiveSessionImpl.java:505)
at org.apache.hive.service.cli.session.HiveSessionImpl.executeStatementAsync(HiveSessionImpl.java:492)
at org.apache.hive.service.cli.CLIService.executeStatementAsync(CLIService.java:295)
at org.apache.hive.service.cli.thrift.ThriftCLIService.ExecuteStatement(ThriftCLIService.java:506)
at org.apache.hive.service.rpc.thrift.TCLIService$Processor$ExecuteStatement.getResult(TCLIService.java:1437)
at org.apache.hive.service.rpc.thrift.TCLIService$Processor$ExecuteStatement.getResult(TCLIService.java:1422)
at org.apache.thrift.ProcessFunction.process(ProcessFunction.java:39)
at org.apache.thrift.TBaseProcessor.process(TBaseProcessor.java:39)
at org.apache.hive.service.auth.TSetIpAddressProcessor.process(TSetIpAddressProcessor.java:56)
at org.apache.thrift.server.TThreadPoolServer$WorkerProcess.run(TThreadPoolServer.java:286)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.RuntimeException: org.apache.hadoop.hive.ql.parse.SemanticException:org.apache.hadoop.hive.ql.parse.SemanticException: Table already exists: sf_hkust.yiqing_755fb_0729_waybill_182
at org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.analyzeCreateTable(SemanticAnalyzer.java:11767)
at org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.genResolvedParseTree(SemanticAnalyzer.java:10717)
at org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.analyzeInternal(SemanticAnalyzer.java:10827)
at org.apache.hadoop.hive.ql.parse.CalcitePlanner.analyzeInternal(CalcitePlanner.java:246)
at org.apache.hadoop.hive.ql.parse.BaseSemanticAnalyzer.analyze(BaseSemanticAnalyzer.java:251)
at org.apache.hadoop.hive.ql.Driver.compile(Driver.java:479)
at org.apache.hadoop.hive.ql.Driver.compileInternal(Driver.java:1253)
at org.apache.hadoop.hive.ql.Driver.compileAndRespond(Driver.java:1240)
at org.apache.hive.service.cli.operation.SQLOperation.prepare(SQLOperation.java:191)
... 15 more
Caused by: java.lang.RuntimeException: org.apache.hadoop.hive.ql.parse.SemanticException:Table already exists: sf_hkust.yiqing_755fb_0729_waybill_182
at org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.analyzeCreateTable(SemanticAnalyzer.java:11764)
... 23 more
Exception in thread "main" com.sf.bdp.schetl.common.exception.ScheduleException: org.apache.hive.service.cli.HiveSQLException: Error while compiling statement: FAILED: SemanticException org.apache.hadoop.hive.ql.parse.SemanticException: Table already exists: sf_hkust.yiqing_755fb_0729_waybill_1822022-07-29 13:49:20,290 [Thread-6] ERROR - execute sql error
java.sql.SQLException: Method getQueryLog() failed. Because the stmtHandle in HiveStatement is null and the statement execution might fail.
at org.apache.hive.jdbc.HiveStatement.getQueryLog(HiveStatement.java:894)
at org.apache.hive.jdbc.HiveStatement.getQueryLog(HiveStatement.java:857)
at com.sf.bdp.schetl.hive.driver.HiveJdbcExecutor$LogPrinter.run(HiveJdbcExecutor.java:141)
at com.sf.bdp.schetl.hive.driver.HiveJdbcExecutor.execute(HiveJdbcExecutor.java:97)日志收集出错:Method getQueryLog() failed. Because the stmtHandle in HiveStatement is null and the statement execution might fail.
at com.sf.bdp.schetl.hive.driver.HiveJdbcExecutor.execute(HiveJdbcExecutor.java:112)
at com.sf.bdp.schetl.hive.driver.HiveDriver.main(HiveDriver.java:71)
Caused by: org.apache.hive.service.cli.HiveSQLException: Error while compiling statement: FAILED: SemanticException org.apache.hadoop.hive.ql.parse.SemanticException: Table already exists: sf_hkust.yiqing_755fb_0729_waybill_182
at org.apache.hive.jdbc.Utils.verifySuccess(Utils.java:266)
at org.apache.hive.jdbc.Utils.verifySuccessWithInfo(Utils.java:252)
at org.apache.hive.jdbc.HiveStatement.runAsyncOnServer(HiveStatement.java:318)
at org.apache.hive.jdbc.HiveStatement.execute(HiveStatement.java:260)
at com.sf.bdp.schetl.hive.driver.HiveJdbcExecutor.execute(HiveJdbcExecutor.java:93)
... 2 more
Caused by: org.apache.hive.service.cli.HiveSQLException: Error while compiling statement: FAILED: SemanticException org.apache.hadoop.hive.ql.parse.SemanticException: Table already exists: sf_hkust.yiqing_755fb_0729_waybill_182
at org.apache.hive.service.cli.operation.Operation.toSQLException(Operation.java:388)
at org.apache.hive.service.cli.operation.SQLOperation.prepare(SQLOperation.java:193)
at org.apache.hive.service.cli.operation.SQLOperation.runInternal(SQLOperation.java:276)
at org.apache.hive.service.cli.operation.Operation.run(Operation.java:324)
at org.apache.hive.service.cli.session.HiveSessionImpl.executeStatementInternal(HiveSessionImpl.java:505)
at org.apache.hive.service.cli.session.HiveSessionImpl.executeStatementAsync(HiveSessionImpl.java:492)
at org.apache.hive.service.cli.CLIService.executeStatementAsync(CLIService.java:295)
at org.apache.hive.service.cli.thrift.ThriftCLIService.ExecuteStatement(ThriftCLIService.java:506)
at org.apache.hive.service.rpc.thrift.TCLIService$Processor$ExecuteStatement.getResult(TCLIService.java:1437)
at org.apache.hive.service.rpc.thrift.TCLIService$Processor$ExecuteStatement.getResult(TCLIService.java:1422)
at org.apache.thrift.ProcessFunction.process(ProcessFunction.java:39)
at org.apache.thrift.TBaseProcessor.process(TBaseProcessor.java:39)
at org.apache.hive.service.auth.TSetIpAddressProcessor.process(TSetIpAddressProcessor.java:56)2022-07-29 13:49:20,292 [Hive-JDBC-Driver-ShutdownHook] INFO - trigger Hive-JDBC-Driver shutdown.
at org.apache.thrift.server.TThreadPoolServer$WorkerProcess.run(TThreadPoolServer.java:286)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.RuntimeException: org.apache.hadoop.hive.ql.parse.SemanticException:org.apache.hadoop.hive.ql.parse.SemanticException: Table already exists: sf_hkust.yiqing_755fb_0729_waybill_182
at org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.analyzeCreateTable(SemanticAnalyzer.java:11767)
at org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.genResolvedParseTree(SemanticAnalyzer.java:10717)
at org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.analyzeInternal(SemanticAnalyzer.java:10827)
at org.apache.hadoop.hive.ql.parse.CalcitePlanner.analyzeInternal(CalcitePlanner.java:246)
at org.apache.hadoop.hive.ql.parse.BaseSemanticAnalyzer.analyze(BaseSemanticAnalyzer.java:251)`;
const loaded = (e, api) => {
Promise.resolve().then(() => {
testText.split(/\n/).forEach((text, i) => {
if (i === 0) {
api.writeln({ text, color: 'YELLOW' });
} else {
api.writeln(text.trim());
}
});
});
};
return (
<div>
<XtermTerminal
colorRules={[{ pattern: /error.*$/gi, color: 'RED' }]}
lineTitle=""
preLog=""
disableStdin
height={300}
onLoad={loaded}
/>
</div>
);
};
export default XtermLogger;
import React, { useState } from 'react';
import XtermTerminal from '@rasir/xterm-terminal';
const Terminal = () => {
const [term, setTerm] = useState();
const [api, setApi] = useState();
const loaded = (term, api) => {
setTerm(term);
setApi(api);
};
const onCommand = (cmd) => {
api.writeln(`hello Rasir!!!`);
api.writeln('');
};
return (
<div>
<XtermTerminal
colorRules={[{ pattern: /error.*$/gi, color: 'RED' }]}
lineTitle="$: "
preLog="### START ###"
height={300}
onLoad={loaded}
onCommand={onCommand}
/>
</div>
);
};
export default Terminal;
属性 | 说明 | 类型 | 默认值 |
---|---|---|---|
className |
容器类名 | string |
--- |
height |
容器高度,height 变化会引起 xterm 自适应 |
number |
--- |
style |
容器高度样式 | React.CSSProperties |
--- |
disableStdin |
是否禁用输入 | boolean |
--- |
lineTitle |
终端输出的每一行开头的字符,不计入输入字符 | string |
$: |
preLog |
终端预置日志 | string |
\r\n*** COMMAND START ***\r\n |
command |
终端执行命令,最好与disableStdin 一起使用 |
string |
--- |
onCommand |
在终端输入回车时会调用回调 | (command?: string) => void |
--- |
onClear |
输入clear 会触发回调 |
() => void |
--- |
onCopy |
ctrl+c/cmd+c 复制回调 |
(text: string) => Promise<void> |
--- |
onPaste |
ctrl+v/cmd+v 粘贴回调 |
() => Promise<string> |
--- |
onLoad |
终端初始化完成时的回调 | (term: XTerminal, api: TerminalApi) => void |
--- |
colorRules |
文字显示颜色的规则 | ColorRule[] |
--- |
options |
xterm 原生配置,初始化时使用,初始化之后,如果要改变配置,可以使用xterm 原来的setOption 方法 |
ITerminalOptions |
--- |
interface TerminalApi {
clearLog: () => void;
writeln: (text?: string) => void;
write: (text?: string) => void;
getCommand: () => string;
resize: () => void;
}
type ColorRule = {
pattern: RegExp;
color: Color;
}
Color = "BLACK" | "RED" | "GREEN" | "YELLOW" | "BLUE" | "MAGENTA" | "CYAN" | "WHITE" | "RESET"
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。