diff --git a/partiql-lang/src/main/kotlin/org/partiql/lang/syntax/impl/PartiQLPigVisitor.kt b/partiql-lang/src/main/kotlin/org/partiql/lang/syntax/impl/PartiQLPigVisitor.kt index dbef7d505..8b46c2aa1 100644 --- a/partiql-lang/src/main/kotlin/org/partiql/lang/syntax/impl/PartiQLPigVisitor.kt +++ b/partiql-lang/src/main/kotlin/org/partiql/lang/syntax/impl/PartiQLPigVisitor.kt @@ -1734,6 +1734,14 @@ internal class PartiQLPigVisitor( return com.amazon.ionelement.api.metaContainerOf(Pair(metas.tag, metas)) } + private fun List.getSourceMetaContainer(): MetaContainer { + val base = this.firstOrNull() ?: return emptyMetaContainer() + val length = this.fold(0) { acc, token -> + acc + token.stopIndex - token.startIndex + 1 + } + return metaContainerOf(SourceLocationMeta(base.line.toLong(), base.charPositionInLine.toLong() + 1, length.toLong())) + } + private fun TerminalNode.getSourceMetas(): SourceLocationMeta = this.symbol.getSourceMetas() private fun Token.getSourceMetas(): SourceLocationMeta { diff --git a/partiql-parser/src/main/kotlin/org/partiql/parser/internal/PartiQLParserDefault.kt b/partiql-parser/src/main/kotlin/org/partiql/parser/internal/PartiQLParserDefault.kt index 88ef02f8f..108367e39 100644 --- a/partiql-parser/src/main/kotlin/org/partiql/parser/internal/PartiQLParserDefault.kt +++ b/partiql-parser/src/main/kotlin/org/partiql/parser/internal/PartiQLParserDefault.kt @@ -632,7 +632,7 @@ internal class PartiQLParserDefault : PartiQLParser { } override fun visitColumnDeclaration(ctx: GeneratedParser.ColumnDeclarationContext) = translate(ctx) { - val name = visitSymbolPrimitive(ctx.columnName().symbolPrimitive()) + val name = visitSymbolPrimitive(ctx.columnName().symbolPrimitive()).symbol val type = visit(ctx.type()) as Type val constraints = ctx.columnConstraint().map { visitColumnConstraint(it) diff --git a/partiql-planner/src/main/kotlin/org/partiql/planner/internal/SqlTypes.kt b/partiql-planner/src/main/kotlin/org/partiql/planner/internal/SqlTypes.kt index 0d3938ab7..9dee936cd 100644 --- a/partiql-planner/src/main/kotlin/org/partiql/planner/internal/SqlTypes.kt +++ b/partiql-planner/src/main/kotlin/org/partiql/planner/internal/SqlTypes.kt @@ -207,7 +207,6 @@ internal object SqlTypes { } is Type.Any -> dynamic() is Type.List -> array() - is Type.Array -> array(type.type?.let { from(it) }) is Type.Tuple -> struct() is Type.Struct -> struct() is Type.Custom -> TODO("Custom type not supported ") diff --git a/partiql-planner/src/main/kotlin/org/partiql/planner/internal/transforms/RexConverter.kt b/partiql-planner/src/main/kotlin/org/partiql/planner/internal/transforms/RexConverter.kt index c51de0c95..af6c80e23 100644 --- a/partiql-planner/src/main/kotlin/org/partiql/planner/internal/transforms/RexConverter.kt +++ b/partiql-planner/src/main/kotlin/org/partiql/planner/internal/transforms/RexConverter.kt @@ -852,10 +852,6 @@ internal object RexConverter { is Type.Custom -> TODO("Custom type not supported ") is Type.List -> PType.typeList() is Type.Tuple -> PType.typeStruct() - is Type.Array -> when (type.type) { - null -> PType.typeList() - else -> PType.typeList(visitType(type.type!!)) - } is Type.Struct -> PType.typeStruct() }.toCType() }