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

[lang] Remove wildcard imports #488

Merged
merged 7 commits into from
Feb 9, 2022
Merged
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
34 changes: 19 additions & 15 deletions lang/src/org/partiql/lang/CompilerPipeline.kt
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,27 @@

package org.partiql.lang

import com.amazon.ion.*
import org.partiql.lang.ast.*
import org.partiql.lang.eval.*
import org.partiql.lang.eval.builtins.*
import com.amazon.ion.IonSystem
import org.partiql.lang.ast.ExprNode
import org.partiql.lang.ast.toAstStatement
import org.partiql.lang.ast.toExprNode
import org.partiql.lang.eval.Bindings
import org.partiql.lang.eval.CompileOptions
import org.partiql.lang.eval.EvaluatingCompiler
import org.partiql.lang.eval.ExprFunction
import org.partiql.lang.eval.ExprValueFactory
import org.partiql.lang.eval.Expression
import org.partiql.lang.eval.ThunkReturnTypeAssertions
import org.partiql.lang.eval.builtins.createBuiltinFunctions
import org.partiql.lang.eval.builtins.storedprocedure.StoredProcedure
import org.partiql.lang.eval.visitors.PipelinedVisitorTransform
import org.partiql.lang.eval.visitors.StaticTypeInferenceVisitorTransform
import org.partiql.lang.eval.visitors.StaticTypeVisitorTransform
import org.partiql.lang.syntax.*
import org.partiql.lang.util.interruptibleFold
import org.partiql.lang.types.StaticType
import org.partiql.lang.syntax.Parser
import org.partiql.lang.syntax.SqlParser
import org.partiql.lang.types.CustomType
import org.partiql.lang.types.StaticType
import org.partiql.lang.util.interruptibleFold

/**
* Contains all of the information needed for processing steps.
Expand Down Expand Up @@ -98,7 +107,6 @@ interface CompilerPipeline {
fun compile(query: ExprNode): Expression

companion object {

/** Kotlin style builder for [CompilerPipeline]. If calling from Java instead use [builder]. */
fun build(ion: IonSystem, block: Builder.() -> Unit) = build(ExprValueFactory.standard(ion), block)

Expand All @@ -119,8 +127,7 @@ interface CompilerPipeline {

/** Returns an implementation of [CompilerPipeline] with all properties set to their defaults. */
@JvmStatic
fun standard(valueFactory: ExprValueFactory): CompilerPipeline =
builder(valueFactory).build()
fun standard(valueFactory: ExprValueFactory): CompilerPipeline = builder(valueFactory).build()
}

/**
Expand Down Expand Up @@ -282,10 +289,7 @@ internal class CompilerPipelineImpl(
return compiler.compile(queryToCompile.toExprNode(valueFactory.ion))
}

internal fun executePreProcessingSteps(
query: ExprNode,
context: StepContext
) = preProcessingSteps.interruptibleFold(query) { currentExprNode, step ->
step(currentExprNode, context)
internal fun executePreProcessingSteps(query: ExprNode, context: StepContext) = preProcessingSteps
.interruptibleFold(query) { currentExprNode, step -> step(currentExprNode, context)
}
}
11 changes: 6 additions & 5 deletions lang/src/org/partiql/lang/Exceptions.kt
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,10 @@

package org.partiql.lang

import org.partiql.lang.errors.*
import org.partiql.lang.errors.Property.*

import org.partiql.lang.errors.ErrorCode
import org.partiql.lang.errors.Property
import org.partiql.lang.errors.PropertyValueMap
import org.partiql.lang.errors.UNKNOWN

/**
* General exception class for the interpreter.
Expand Down Expand Up @@ -82,8 +83,8 @@ open class SqlException(override var message: String,
errorCode?.getErrorMessage(propertyValueMap) ?: UNKNOWN

private fun errorLocation(propertyValueMap: PropertyValueMap?): String {
val lineNo = propertyValueMap?.get(LINE_NUMBER)?.longValue()
val columnNo = propertyValueMap?.get(COLUMN_NUMBER)?.longValue()
val lineNo = propertyValueMap?.get(Property.LINE_NUMBER)?.longValue()
val columnNo = propertyValueMap?.get(Property.COLUMN_NUMBER)?.longValue()

return "at line ${lineNo ?: UNKNOWN}, column ${columnNo ?: UNKNOWN}"
}
Expand Down
2 changes: 1 addition & 1 deletion lang/src/org/partiql/lang/ast/AggregateCallSiteListMeta.kt
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

package org.partiql.lang.ast

import com.amazon.ion.*
import com.amazon.ion.IonWriter
import org.partiql.lang.domains.PartiqlAst

/**
Expand Down
20 changes: 18 additions & 2 deletions lang/src/org/partiql/lang/ast/AstDeserialization.kt
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,25 @@

package org.partiql.lang.ast

import com.amazon.ion.*
import com.amazon.ion.IonSexp
import com.amazon.ion.IonSymbol
import com.amazon.ion.IonSystem
import com.amazon.ion.IonValue
import com.amazon.ion.IonWriter
import org.partiql.lang.types.CustomType
import org.partiql.lang.util.*
import org.partiql.lang.util.args
import org.partiql.lang.util.arity
import org.partiql.lang.util.asIonInt
import org.partiql.lang.util.asIonSexp
import org.partiql.lang.util.asIonStruct
import org.partiql.lang.util.asIonSymbol
import org.partiql.lang.util.checkThreadInterrupted
import org.partiql.lang.util.field
import org.partiql.lang.util.longValue
import org.partiql.lang.util.singleArgWithTag
import org.partiql.lang.util.stringValue
import org.partiql.lang.util.tagText
import org.partiql.lang.util.toListOfIonSexp

/**
* Deserializes an s-expression based AST.
Expand Down
1 change: 0 additions & 1 deletion lang/src/org/partiql/lang/ast/AstSerialization.kt
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import org.partiql.lang.util.IonWriterContext
import org.partiql.lang.util.asIonSexp
import org.partiql.lang.util.case
import org.partiql.lang.util.checkThreadInterrupted
import kotlin.UnsupportedOperationException

/**
* Serializes an instance of [ExprNode] to one of the s-expression based ASTs.
Expand Down
2 changes: 1 addition & 1 deletion lang/src/org/partiql/lang/ast/InternalMetas.kt
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

package org.partiql.lang.ast

import com.amazon.ion.*
import com.amazon.ion.IonWriter

/**
* Base class for [Meta] implementations which are used internally by [org.partiql.lang.eval.EvaluatingCompiler]
Expand Down
7 changes: 0 additions & 7 deletions lang/src/org/partiql/lang/ast/IsImplictJoinMeta.kt
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,8 @@
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific
* language governing permissions and limitations under the License.
*/

/*

*/
package org.partiql.lang.ast

import com.amazon.ion.*
import org.partiql.lang.ast.*

/**
* Meta node intended to be attached to an instance of [FromSourcedJoin] to indicate that no
* join condition was specified in the original query and therefore this is an implicit join.
Expand Down
3 changes: 0 additions & 3 deletions lang/src/org/partiql/lang/ast/IsIonLiteralMeta.kt
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,6 @@
*/
package org.partiql.lang.ast

import com.amazon.ion.*
import org.partiql.lang.ast.*

/**
* Meta node intended to be attached to an instance of [Literal] to indicate that it was
* designated as an `ionLiteral` in the parsed statement.
Expand Down
2 changes: 1 addition & 1 deletion lang/src/org/partiql/lang/ast/MemoizedMetaDeserializer.kt
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

package org.partiql.lang.ast

import com.amazon.ion.*
import com.amazon.ion.IonValue

/**
* Provides a common way to "deserialize" a memoized meta instance.
Expand Down
8 changes: 6 additions & 2 deletions lang/src/org/partiql/lang/ast/SourceLocationMeta.kt
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,13 @@

package org.partiql.lang.ast

import com.amazon.ion.*
import com.amazon.ion.IonValue
import com.amazon.ion.IonWriter
import com.amazon.ionelement.api.metaOrNull
import org.partiql.lang.util.*
import org.partiql.lang.util.IonWriterContext
import org.partiql.lang.util.asIonStruct
import org.partiql.lang.util.field
import org.partiql.lang.util.longValue

/**
* Represents a specific location within a source file.
Expand Down
Loading