java.util.unknownformatConversionException:转换
我编写了一个脚本,以在我们的蜂巢群上进行查询。这是发生错误的地方:
Result<Record> result = client.doWithRetry(new SQLClient.JooqSQLFunction<Result<Record>>() {
@Override
public Result<Record> apply(Connection conn, DSLContext jooq) throws SQLException, DataAccessException {
return jooq.fetch(String.format(
"select s.name as season_name, r.name as round_name, " +
" g.uuid, g.name, g.create_time, "+
" (select count(*) from picks_questions q where q.round_uuid=r.uuid) as questions_in_round, "+
" (select group_concat(du.yinz_id) from drops_entries e inner join drops_users du on du.uuid=e.user_uuid where g.uuid=e.drop_uuid and e.create_time<r.end_time) as member_yinz_ids, "+
" (select count(*) from drops_entries e inner join drops_users du on du.uuid=e.user_uuid where g.uuid=e.drop_uuid and e.create_time<r.end_time) as member_count, "+
" (select count(*) from drops_messages m where m.drop_uuid=g.uuid and m.send_time>=r.start_time and m.send_time<r.end_time) as messages_sent "+
" from picks_seasons s "+
" inner join picks_rounds r on r.season_uuid=s.uuid "+
" inner join drops g on g.create_time<r.end_time "+
" where g.name not like 'ADMIN_DROP:%' and g.name<>'' "+
" and s.uuid in "+
" ( "+
" select uuid from picks_seasons "+
" where "+
" unix_timestamp('%s') >= unix_timestamp(start_time) " +
" AND " +
" unix_timestamp('%s') < unix_timestamp(end_time) " +
" );",
sqlDTF.print(seg.getStartingInstant()),
sqlDTF.print(seg.getEndingInstant())
));
}
}
我根本没有使用“''”。有什么想法出了什么问题?
错误追溯:
java.lang.RuntimeException: java.lang.RuntimeException: java.util.UnknownFormatConversionException: Conversion = '''
at workflows.AbstractCopperWorkflow.main(AbstractCopperWorkflow.java:394) ~[na:na]
I wrote a script to orchestrate a query on our hive cluster. And this is the place where the error happened:
Result<Record> result = client.doWithRetry(new SQLClient.JooqSQLFunction<Result<Record>>() {
@Override
public Result<Record> apply(Connection conn, DSLContext jooq) throws SQLException, DataAccessException {
return jooq.fetch(String.format(
"select s.name as season_name, r.name as round_name, " +
" g.uuid, g.name, g.create_time, "+
" (select count(*) from picks_questions q where q.round_uuid=r.uuid) as questions_in_round, "+
" (select group_concat(du.yinz_id) from drops_entries e inner join drops_users du on du.uuid=e.user_uuid where g.uuid=e.drop_uuid and e.create_time<r.end_time) as member_yinz_ids, "+
" (select count(*) from drops_entries e inner join drops_users du on du.uuid=e.user_uuid where g.uuid=e.drop_uuid and e.create_time<r.end_time) as member_count, "+
" (select count(*) from drops_messages m where m.drop_uuid=g.uuid and m.send_time>=r.start_time and m.send_time<r.end_time) as messages_sent "+
" from picks_seasons s "+
" inner join picks_rounds r on r.season_uuid=s.uuid "+
" inner join drops g on g.create_time<r.end_time "+
" where g.name not like 'ADMIN_DROP:%' and g.name<>'' "+
" and s.uuid in "+
" ( "+
" select uuid from picks_seasons "+
" where "+
" unix_timestamp('%s') >= unix_timestamp(start_time) " +
" AND " +
" unix_timestamp('%s') < unix_timestamp(end_time) " +
" );",
sqlDTF.print(seg.getStartingInstant()),
sqlDTF.print(seg.getEndingInstant())
));
}
}
I didn't use "'''" at all. Any ideas what went wrong?
Error Traceback:
java.lang.RuntimeException: java.lang.RuntimeException: java.util.UnknownFormatConversionException: Conversion = '''
at workflows.AbstractCopperWorkflow.main(AbstractCopperWorkflow.java:394) ~[na:na]
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
%标记是Java格式字符串的保留字符。为了逃脱这一点,我们应该使用
%%
而不是%
。% Mark is a reserved character in format string of Java. To escape this, we should use
%%
instead of%
.