Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Spotless] Using custom Java formatter from k-nn plugin #315

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,10 @@ repositories {
// Spotless checks will be added as PRs are applied to resolve each style issue is approved.
spotless {
java {
// target fileTree('.') {
// include '**/*.java', 'src/*/java/**/*.java'
// exclude '**/build/**', '**/build-*/**'
// }
target fileTree('.') {
include '**/*.java', 'src/*/java/**/*.java'
exclude '**/build/**', '**/build-*/**'
}
// importOrder()
// licenseHeader("/*\n" +
// " * Copyright OpenSearch Contributors\n" +
Expand All @@ -95,7 +95,8 @@ spotless {
// removeUnusedImports()
// trimTrailingWhitespace()
// endWithNewline()
// googleJavaFormat('1.17.0').reflowLongStrings().groupArtifact('com.google.googlejavaformat:google-java-format')
//googleJavaFormat('1.17.0').reflowLongStrings().groupArtifact('com.google.googlejavaformat:google-java-format')
eclipse().configFile rootProject.file('formatterConfig.xml')
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
* SPDX-License-Identifier: Apache-2.0
*/


package org.opensearch.sql.analysis;

import java.util.ArrayList;
Expand All @@ -17,56 +16,56 @@
* The context used for Analyzer.
*/
public class AnalysisContext {
/**
* Environment stack for symbol scope management.
*/
private TypeEnvironment environment;
@Getter
private final List<NamedExpression> namedParseExpressions;
/**
* Environment stack for symbol scope management.
*/
private TypeEnvironment environment;
@Getter
private final List<NamedExpression> namedParseExpressions;

@Getter
private final FunctionProperties functionProperties;
@Getter
private final FunctionProperties functionProperties;

public AnalysisContext() {
this(new TypeEnvironment(null));
}
public AnalysisContext() {
this(new TypeEnvironment(null));
}

/**
* Class CTOR.
* @param environment Env to set to a new instance.
*/
public AnalysisContext(TypeEnvironment environment) {
this.environment = environment;
this.namedParseExpressions = new ArrayList<>();
this.functionProperties = new FunctionProperties();
}
/**
* Class CTOR.
* @param environment Env to set to a new instance.
*/
public AnalysisContext(TypeEnvironment environment) {
this.environment = environment;
this.namedParseExpressions = new ArrayList<>();
this.functionProperties = new FunctionProperties();
}

/**
* Push a new environment.
*/
public void push() {
environment = new TypeEnvironment(environment);
}
/**
* Push a new environment.
*/
public void push() {
environment = new TypeEnvironment(environment);
}

/**
* Return current environment.
*
* @return current environment
*/
public TypeEnvironment peek() {
return environment;
}
/**
* Return current environment.
*
* @return current environment
*/
public TypeEnvironment peek() {
return environment;
}

/**
* Pop up current environment from environment chain.
*
* @return current environment (before pop)
*/
public TypeEnvironment pop() {
Objects.requireNonNull(environment, "Fail to pop context due to no environment present");
/**
* Pop up current environment from environment chain.
*
* @return current environment (before pop)
*/
public TypeEnvironment pop() {
Objects.requireNonNull(environment, "Fail to pop context due to no environment present");

TypeEnvironment curEnv = environment;
environment = curEnv.getParent();
return curEnv;
}
TypeEnvironment curEnv = environment;
environment = curEnv.getParent();
return curEnv;
}
}
Loading