java.util.unknownformatConversionException:转换

发布于 2025-02-01 22:15:25 字数 2435 浏览 2 评论 0原文

我编写了一个脚本,以在我们的蜂巢群上进行查询。这是发生错误的地方:

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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

玉环 2025-02-08 22:15:25

%标记是Java格式字符串的保留字符。为了逃脱这一点,我们应该使用%%而不是

% Mark is a reserved character in format string of Java. To escape this, we should use %% instead of %.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文