This is an automated email from the ASF dual-hosted git repository.
amaliujia pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/calcite.git
The following commit(s) were added to refs/heads/master by this push:
new 85f939f [CALCITE-4482] Extract the default SqlWriterConfig in
SqlPrettyWriter, reduce the overhead of "ImmutableBeans.create" (Jiatao Tao)
85f939f is described below
commit 85f939f922b50aca054e19f21a3c0a55afd4b929
Author: Jiatao Tao <[email protected]>
AuthorDate: Tue Feb 2 11:14:24 2021 +0800
[CALCITE-4482] Extract the default SqlWriterConfig in SqlPrettyWriter,
reduce the overhead of "ImmutableBeans.create" (Jiatao Tao)
---
.../java/org/apache/calcite/sql/pretty/SqlPrettyWriter.java | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git
a/core/src/main/java/org/apache/calcite/sql/pretty/SqlPrettyWriter.java
b/core/src/main/java/org/apache/calcite/sql/pretty/SqlPrettyWriter.java
index 8463c15..b715068 100644
--- a/core/src/main/java/org/apache/calcite/sql/pretty/SqlPrettyWriter.java
+++ b/core/src/main/java/org/apache/calcite/sql/pretty/SqlPrettyWriter.java
@@ -256,6 +256,13 @@ public class SqlPrettyWriter implements SqlWriter {
LoggerFactory.getLogger("org.apache.calcite.sql.pretty.SqlPrettyWriter"));
/**
+ * Default SqlWriterConfig, reduce the overhead of "ImmutableBeans.create"
+ */
+ private static final SqlWriterConfig CONFIG =
+ ImmutableBeans.create(SqlWriterConfig.class)
+ .withDialect(CalciteSqlDialect.DEFAULT);
+
+ /**
* Bean holding the default property values.
*/
private static final Bean DEFAULT_BEAN =
@@ -353,8 +360,7 @@ public class SqlPrettyWriter implements SqlWriter {
/** Creates a {@link SqlWriterConfig} with Calcite's SQL dialect. */
public static SqlWriterConfig config() {
- return ImmutableBeans.create(SqlWriterConfig.class)
- .withDialect(CalciteSqlDialect.DEFAULT);
+ return CONFIG;
}
//~ Methods ----------------------------------------------------------------