jacques-n commented on a change in pull request #2531:
URL: https://github.com/apache/calcite/pull/2531#discussion_r717126725
##########
File path: core/src/main/java/org/apache/calcite/sql/parser/SqlParser.java
##########
@@ -242,64 +245,72 @@ public static ConfigBuilder configBuilder(Config config) {
/**
* Interface to define the configuration for a SQL parser.
*/
+ @Value.Immutable(singleton = true)
+ @Value.Style(typeImmutable = "ImmutableSqlParserConfig")
public interface Config {
/** Default configuration. */
- Config DEFAULT = ImmutableBeans.create(Config.class)
- .withLex(Lex.ORACLE)
- .withIdentifierMaxLength(DEFAULT_IDENTIFIER_MAX_LENGTH)
- .withConformance(SqlConformanceEnum.DEFAULT)
- .withParserFactory(SqlParserImpl.FACTORY);
-
- @ImmutableBeans.Property()
- @ImmutableBeans.IntDefault(DEFAULT_IDENTIFIER_MAX_LENGTH)
- int identifierMaxLength();
+ Config DEFAULT = ImmutableSqlParserConfig.of();
+ @Value.Default default int identifierMaxLength() {
+ return DEFAULT_IDENTIFIER_MAX_LENGTH;
+ }
+ //Quoting.DOUBLE_QUOTE, Casing.TO_UPPER, Casing.UNCHANGED, true,
+ // CharLiteralStyle.STANDARD
Review comment:
Good catch. That was a dev note that should have been deleted. Removed.
##########
File path:
core/src/main/java/org/apache/calcite/rel/rules/materialize/MaterializedViewOnlyAggregateRule.java
##########
@@ -69,18 +72,25 @@ public MaterializedViewOnlyAggregateRule(RelOptRuleOperand
operand,
}
/** Rule configuration. */
- public interface Config extends MaterializedViewAggregateRule.Config {
- Config DEFAULT = create(RelFactories.LOGICAL_BUILDER);
+ @Value.Immutable
+ public interface Config extends MaterializedViewAggregateRule.Config<Config>
{
+ Config DEFAULT =
ImmutableMaterializedViewOnlyAggregateRule.Config.builder()
+ .withRelBuilderFactory(RelFactories.LOGICAL_BUILDER)
+ .withGenerateUnionRewriting(true)
+ .withUnionRewritingPullProgram(null)
+ .withFastBailOut(false)
+ .build();
static Config create(RelBuilderFactory relBuilderFactory) {
- return MaterializedViewAggregateRule.Config.create(relBuilderFactory)
+
+ return ImmutableMaterializedViewOnlyAggregateRule.Config.builder()
Review comment:
Thanks. In most cases I use builders to build the default so
from(DEFAULT) doesn't really work.
##########
File path: core/src/main/java/org/apache/calcite/sql/pretty/SqlPrettyWriter.java
##########
@@ -360,7 +353,7 @@ public SqlPrettyWriter() {
/** Creates a {@link SqlWriterConfig} with Calcite's SQL dialect. */
public static SqlWriterConfig config() {
- return CONFIG;
+ return SqlWriterConfig.of().withDialect(CalciteSqlDialect.DEFAULT);
Review comment:
fixed.
##########
File path: core/src/main/java/org/apache/calcite/sql/SqlWriterConfig.java
##########
@@ -433,4 +424,6 @@ SqlWriterConfig withWhereListItemsOnSeparateLines(
/** Wrap always. Items are on separate lines. */
TALL
}
+
+ static SqlWriterConfig DEFAULT = ImmutableSqlWriterConfig.DEFAULT;
Review comment:
Modified. This isn't included anymore
##########
File path: core/build.gradle.kts
##########
@@ -61,6 +61,8 @@ dependencies {
implementation("commons-io:commons-io")
implementation("org.codehaus.janino:commons-compiler")
implementation("org.codehaus.janino:janino")
+ annotationProcessor("org.immutables:value:2.8.2")
Review comment:
fixed
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]