From 21b13a6d65bd9b55adc40ac26b37142d57575848 Mon Sep 17 00:00:00 2001 From: tokoko Date: Sat, 5 Oct 2024 07:41:04 +0000 Subject: [PATCH 1/2] feat: add derivation expression evaluator --- .devcontainer/Dockerfile | 8 + .devcontainer/devcontainer.json | 24 + Makefile | 2 + SubstraitType.g4 | 209 ++ pyproject.toml | 2 +- src/substrait/derivation_expression.py | 102 + src/substrait/gen/antlr/SubstraitType.interp | 142 ++ src/substrait/gen/antlr/SubstraitType.tokens | 84 + .../gen/antlr/SubstraitTypeLexer.interp | 231 ++ src/substrait/gen/antlr/SubstraitTypeLexer.py | 353 +++ .../gen/antlr/SubstraitTypeLexer.tokens | 84 + .../gen/antlr/SubstraitTypeListener.py | 408 +++ .../gen/antlr/SubstraitTypeParser.py | 2210 +++++++++++++++++ tests/test_derivation_expression.py | 81 + 14 files changed, 3939 insertions(+), 1 deletion(-) create mode 100644 .devcontainer/Dockerfile create mode 100644 .devcontainer/devcontainer.json create mode 100644 Makefile create mode 100644 SubstraitType.g4 create mode 100644 src/substrait/derivation_expression.py create mode 100644 src/substrait/gen/antlr/SubstraitType.interp create mode 100644 src/substrait/gen/antlr/SubstraitType.tokens create mode 100644 src/substrait/gen/antlr/SubstraitTypeLexer.interp create mode 100644 src/substrait/gen/antlr/SubstraitTypeLexer.py create mode 100644 src/substrait/gen/antlr/SubstraitTypeLexer.tokens create mode 100644 src/substrait/gen/antlr/SubstraitTypeListener.py create mode 100644 src/substrait/gen/antlr/SubstraitTypeParser.py create mode 100644 tests/test_derivation_expression.py diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile new file mode 100644 index 0000000..82c84d7 --- /dev/null +++ b/.devcontainer/Dockerfile @@ -0,0 +1,8 @@ +FROM mcr.microsoft.com/vscode/devcontainers/python:3.10-buster +USER vscode +RUN curl -s "https://get.sdkman.io" | bash +SHELL ["/bin/bash", "-c"] +RUN source "/home/vscode/.sdkman/bin/sdkman-init.sh" && sdk install java 20.0.2-graalce +RUN mkdir -p ~/lib && cd ~/lib && curl -L -O http://www.antlr.org/download/antlr-4.13.1-complete.jar +ENV ANTLR_JAR="~/lib/antlr-4.13.1-complete.jar" +USER root \ No newline at end of file diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 0000000..5ad1660 --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,24 @@ +{ + "name": "substrait-python-devcontainer", + "build": { + "context": "..", + "dockerfile": "Dockerfile" + }, + + // Features to add to the dev container. More info: https://containers.dev/features. + // "features": { + // "ghcr.io/devcontainers/features/nix:1": {} + // }, + + // Use 'forwardPorts' to make a list of ports inside the container available locally. + // "forwardPorts": [], + + // Use 'postCreateCommand' to run commands after the container is created. + // "postCreateCommand": "poetry install" + + // Configure tool-specific properties. + // "customizations": {}, + + // Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root. + // "remoteUser": "root" +} \ No newline at end of file diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..7ab45a7 --- /dev/null +++ b/Makefile @@ -0,0 +1,2 @@ +antlr: + java -jar ${ANTLR_JAR} -o src/substrait/gen/antlr -Dlanguage=Python3 SubstraitType.g4 diff --git a/SubstraitType.g4 b/SubstraitType.g4 new file mode 100644 index 0000000..f7d50af --- /dev/null +++ b/SubstraitType.g4 @@ -0,0 +1,209 @@ +grammar SubstraitType; + +// +fragment A : [aA]; +fragment B : [bB]; +fragment C : [cC]; +fragment D : [dD]; +fragment E : [eE]; +fragment F : [fF]; +fragment G : [gG]; +fragment H : [hH]; +fragment I : [iI]; +fragment J : [jJ]; +fragment K : [kK]; +fragment L : [lL]; +fragment M : [mM]; +fragment N : [nN]; +fragment O : [oO]; +fragment P : [pP]; +fragment Q : [qQ]; +fragment R : [rR]; +fragment S : [sS]; +fragment T : [tT]; +fragment U : [uU]; +fragment V : [vV]; +fragment W : [wW]; +fragment X : [xX]; +fragment Y : [yY]; +fragment Z : [zZ]; + + +If : I F; +Then : T H E N; +Else : E L S E; + +// TYPES +Boolean : B O O L E A N; +I8 : I '8'; +I16 : I '16'; +I32 : I '32'; +I64 : I '64'; +FP32 : F P '32'; +FP64 : F P '64'; +String : S T R I N G; +Binary : B I N A R Y; +Timestamp: T I M E S T A M P; +TimestampTZ: T I M E S T A M P '_' T Z; +Date : D A T E; +Time : T I M E; +IntervalYear: I N T E R V A L '_' Y E A R; +IntervalDay: I N T E R V A L '_' D A Y; +IntervalCompound: I N T E R V A L '_' C O M P O U N D; +UUID : U U I D; +Decimal : D E C I M A L; +PrecisionTimestamp: P R E C I S I O N '_' T I M E S T A M P; +PrecisionTimestampTZ: P R E C I S I O N '_' T I M E S T A M P '_' T Z; +FixedChar: F I X E D C H A R; +VarChar : V A R C H A R; +FixedBinary: F I X E D B I N A R Y; +Struct : S T R U C T; +NStruct : N S T R U C T; +List : L I S T; +Map : M A P; +ANY : A N Y; +UserDefined: U '!'; + + +// OPERATIONS +And : A N D; +Or : O R; +Assign : ':='; + +// COMPARE +Eq : '='; +NotEquals: '!='; +Gte : '>='; +Lte : '<='; +Gt : '>'; +Lt : '<'; +Bang : '!'; + + +// MATH +Plus : '+'; +Minus : '-'; +Asterisk : '*'; +ForwardSlash : '/'; +Percent : '%'; + +// ORGANIZE +OBracket : '['; +CBracket : ']'; +OParen : '('; +CParen : ')'; +SColon : ';'; +Comma : ','; +QMark : '?'; +Colon : ':'; +SingleQuote: '\''; + + +Number + : '-'? Int + ; + +Identifier + : ('a'..'z' | 'A'..'Z' | '_' | '$') ('a'..'z' | 'A'..'Z' | '_' | '$' | Digit)* + ; + +LineComment + : '//' ~[\r\n]* -> channel(HIDDEN) + ; + +BlockComment + : ( '/*' + ( '/'* BlockComment + | ~[/*] + | '/'+ ~[/*] + | '*'+ ~[/*] + )* + '*'* + '*/' + ) -> channel(HIDDEN) + ; + +Whitespace + : [ \t]+ -> channel(HIDDEN) + ; + +Newline + : ( '\r' '\n'? + | '\n' + ) + ; + + +fragment Int + : '1'..'9' Digit* + | '0' + ; + +fragment Digit + : '0'..'9' + ; + +start: expr EOF; + +scalarType + : Boolean #Boolean + | I8 #i8 + | I16 #i16 + | I32 #i32 + | I64 #i64 + | FP32 #fp32 + | FP64 #fp64 + | String #string + | Binary #binary + | Timestamp #timestamp + | TimestampTZ #timestampTz + | Date #date + | Time #time + | IntervalYear #intervalYear + | UUID #uuid + | UserDefined Identifier #userDefined + ; + +parameterizedType + : FixedChar isnull='?'? Lt len=numericParameter Gt #fixedChar + | VarChar isnull='?'? Lt len=numericParameter Gt #varChar + | FixedBinary isnull='?'? Lt len=numericParameter Gt #fixedBinary + | Decimal isnull='?'? Lt precision=numericParameter Comma scale=numericParameter Gt #decimal + | IntervalDay isnull='?'? Lt precision=numericParameter Gt #intervalDay + | IntervalCompound isnull='?'? Lt precision=numericParameter Gt #intervalCompound + | PrecisionTimestamp isnull='?'? Lt precision=numericParameter Gt #precisionTimestamp + | PrecisionTimestampTZ isnull='?'? Lt precision=numericParameter Gt #precisionTimestampTZ + | Struct isnull='?'? Lt expr (Comma expr)* Gt #struct + | NStruct isnull='?'? Lt Identifier expr (Comma Identifier expr)* Gt #nStruct + | List isnull='?'? Lt expr Gt #list + | Map isnull='?'? Lt key=expr Comma value=expr Gt #map + ; + +numericParameter + : Number #numericLiteral + | Identifier #numericParameterName + | expr #numericExpression + ; + +anyType: ANY; + +type + : scalarType isnull='?'? + | parameterizedType + | anyType isnull='?'? + ; + +// : (OParen innerExpr CParen | innerExpr) + +expr + : OParen expr CParen #ParenExpression + | Identifier Eq expr Newline+ (Identifier Eq expr Newline+)* finalType=type Newline* #MultilineDefinition + | type #TypeLiteral + | number=Number #LiteralNumber + | identifier=Identifier isnull='?'? #TypeParam + | Identifier OParen (expr (Comma expr)*)? CParen #FunctionCall + | left=expr op=(And | Or | Plus | Minus | Lt | Gt | Eq | NotEquals | Lte | Gte | Asterisk | ForwardSlash) right=expr #BinaryExpr + | If ifExpr=expr Then thenExpr=expr Else elseExpr=expr #IfExpr + | (Bang) expr #NotExpr + | ifExpr=expr QMark thenExpr=expr Colon elseExpr=expr #Ternary + ; \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml index 7407070..cf395e9 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -5,7 +5,7 @@ authors = [{name = "Substrait contributors", email = "substrait@googlegroups.com license = {text = "Apache-2.0"} readme = "README.md" requires-python = ">=3.8.1" -dependencies = ["protobuf >= 3.20"] +dependencies = ["protobuf >= 3.20", "antlr4-python3-runtime"] dynamic = ["version"] [tool.setuptools_scm] diff --git a/src/substrait/derivation_expression.py b/src/substrait/derivation_expression.py new file mode 100644 index 0000000..276d518 --- /dev/null +++ b/src/substrait/derivation_expression.py @@ -0,0 +1,102 @@ +from typing import Optional +from antlr4 import InputStream, CommonTokenStream +from substrait.gen.antlr.SubstraitTypeLexer import SubstraitTypeLexer +from substrait.gen.antlr.SubstraitTypeParser import SubstraitTypeParser +from substrait.gen.proto.type_pb2 import Type + + +def _evaluate(x, values: dict): + if type(x) == SubstraitTypeParser.BinaryExprContext: + left = _evaluate(x.left, values) + right = _evaluate(x.right, values) + + if x.op.text == "+": + return left + right + elif x.op.text == "-": + return left - right + elif x.op.text == "*": + return left * right + elif x.op.text == ">": + return left > right + elif x.op.text == ">=": + return left >= right + elif x.op.text == "<": + return left < right + elif x.op.text == "<=": + return left <= right + else: + raise Exception(f"Unknown binary op {x.op.text}") + elif type(x) == SubstraitTypeParser.LiteralNumberContext: + return int(x.number.text) + elif type(x) == SubstraitTypeParser.TypeParamContext: + return values[x.identifier.text] + elif type(x) == SubstraitTypeParser.NumericParameterNameContext: + return values[x.Identifier().symbol.text] + elif type(x) == SubstraitTypeParser.ParenExpressionContext: + return _evaluate(x.expr(), values) + elif type(x) == SubstraitTypeParser.FunctionCallContext: + exprs = [_evaluate(e, values) for e in x.expr()] + func = x.Identifier().symbol.text + + if func == "min": + return min(*exprs) + elif func == "max": + return max(*exprs) + else: + raise Exception(f"Unknown function {func}") + elif type(x) == SubstraitTypeParser.TypeContext: + scalar_type = x.scalarType() + parametrized_type = x.parameterizedType() + if scalar_type: + if isinstance(scalar_type, SubstraitTypeParser.I8Context): + return Type(i8=Type.I8()) + elif isinstance(scalar_type, SubstraitTypeParser.I16Context): + return Type(i16=Type.I16()) + elif isinstance(scalar_type, SubstraitTypeParser.I32Context): + return Type(i32=Type.I32()) + elif isinstance(scalar_type, SubstraitTypeParser.I64Context): + return Type(i64=Type.I64()) + elif isinstance(scalar_type, SubstraitTypeParser.Fp32Context): + return Type(fp32=Type.FP32()) + elif isinstance(scalar_type, SubstraitTypeParser.Fp64Context): + return Type(fp64=Type.FP64()) + elif isinstance(scalar_type, SubstraitTypeParser.BooleanContext): + return Type(bool=Type.Boolean()) + else: + raise Exception(f"Unknown scalar type {type(scalar_type)}") + elif parametrized_type: + if isinstance(parametrized_type, SubstraitTypeParser.DecimalContext): + precision = _evaluate(parametrized_type.precision, values) + scale = _evaluate(parametrized_type.scale, values) + return Type(decimal=Type.Decimal(precision=precision, scale=scale)) + raise Exception(f"Unknown parametrized type {type(parametrized_type)}") + else: + raise Exception("either scalar_type or parametrized_type is required") + elif type(x) == SubstraitTypeParser.NumericExpressionContext: + return _evaluate(x.expr(), values) + elif type(x) == SubstraitTypeParser.TernaryContext: + ifExpr = _evaluate(x.ifExpr, values) + thenExpr = _evaluate(x.thenExpr, values) + elseExpr = _evaluate(x.elseExpr, values) + + return thenExpr if ifExpr else elseExpr + elif type(x) == SubstraitTypeParser.MultilineDefinitionContext: + lines = zip(x.Identifier(), x.expr()) + + for i, e in lines: + identifier = i.symbol.text + expr_eval = _evaluate(e, values) + values[identifier] = expr_eval + + return _evaluate(x.finalType, values) + elif type(x) == SubstraitTypeParser.TypeLiteralContext: + return _evaluate(x.type_(), values) + else: + raise Exception(f"Unknown token type {type(x)}") + + +def evaluate(x: str, values: Optional[dict] = None): + lexer = SubstraitTypeLexer(InputStream(x)) + stream = CommonTokenStream(lexer) + parser = SubstraitTypeParser(stream) + return _evaluate(parser.expr(), values) diff --git a/src/substrait/gen/antlr/SubstraitType.interp b/src/substrait/gen/antlr/SubstraitType.interp new file mode 100644 index 0000000..51a94fa --- /dev/null +++ b/src/substrait/gen/antlr/SubstraitType.interp @@ -0,0 +1,142 @@ +token literal names: +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +':=' +'=' +'!=' +'>=' +'<=' +'>' +'<' +'!' +'+' +'-' +'*' +'/' +'%' +'[' +']' +'(' +')' +';' +',' +'?' +':' +'\'' +null +null +null +null +null +null + +token symbolic names: +null +If +Then +Else +Boolean +I8 +I16 +I32 +I64 +FP32 +FP64 +String +Binary +Timestamp +TimestampTZ +Date +Time +IntervalYear +IntervalDay +IntervalCompound +UUID +Decimal +PrecisionTimestamp +PrecisionTimestampTZ +FixedChar +VarChar +FixedBinary +Struct +NStruct +List +Map +ANY +UserDefined +And +Or +Assign +Eq +NotEquals +Gte +Lte +Gt +Lt +Bang +Plus +Minus +Asterisk +ForwardSlash +Percent +OBracket +CBracket +OParen +CParen +SColon +Comma +QMark +Colon +SingleQuote +Number +Identifier +LineComment +BlockComment +Whitespace +Newline + +rule names: +start +scalarType +parameterizedType +numericParameter +anyType +type +expr + + +atn: +[4, 1, 62, 250, 2, 0, 7, 0, 2, 1, 7, 1, 2, 2, 7, 2, 2, 3, 7, 3, 2, 4, 7, 4, 2, 5, 7, 5, 2, 6, 7, 6, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 1, 35, 8, 1, 1, 2, 1, 2, 3, 2, 39, 8, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 3, 2, 47, 8, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 3, 2, 55, 8, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 3, 2, 63, 8, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 3, 2, 73, 8, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 3, 2, 81, 8, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 3, 2, 89, 8, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 3, 2, 97, 8, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 3, 2, 105, 8, 2, 1, 2, 1, 2, 1, 2, 1, 2, 5, 2, 111, 8, 2, 10, 2, 12, 2, 114, 9, 2, 1, 2, 1, 2, 1, 2, 1, 2, 3, 2, 120, 8, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 5, 2, 128, 8, 2, 10, 2, 12, 2, 131, 9, 2, 1, 2, 1, 2, 1, 2, 1, 2, 3, 2, 137, 8, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 3, 2, 145, 8, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 3, 2, 153, 8, 2, 1, 3, 1, 3, 1, 3, 3, 3, 158, 8, 3, 1, 4, 1, 4, 1, 5, 1, 5, 3, 5, 164, 8, 5, 1, 5, 1, 5, 1, 5, 3, 5, 169, 8, 5, 3, 5, 171, 8, 5, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 4, 6, 182, 8, 6, 11, 6, 12, 6, 183, 1, 6, 1, 6, 1, 6, 1, 6, 4, 6, 190, 8, 6, 11, 6, 12, 6, 191, 5, 6, 194, 8, 6, 10, 6, 12, 6, 197, 9, 6, 1, 6, 1, 6, 5, 6, 201, 8, 6, 10, 6, 12, 6, 204, 9, 6, 1, 6, 1, 6, 1, 6, 1, 6, 3, 6, 210, 8, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 5, 6, 217, 8, 6, 10, 6, 12, 6, 220, 9, 6, 3, 6, 222, 8, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 3, 6, 234, 8, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 5, 6, 245, 8, 6, 10, 6, 12, 6, 248, 9, 6, 1, 6, 0, 1, 12, 7, 0, 2, 4, 6, 8, 10, 12, 0, 1, 3, 0, 33, 34, 36, 41, 43, 46, 304, 0, 14, 1, 0, 0, 0, 2, 34, 1, 0, 0, 0, 4, 152, 1, 0, 0, 0, 6, 157, 1, 0, 0, 0, 8, 159, 1, 0, 0, 0, 10, 170, 1, 0, 0, 0, 12, 233, 1, 0, 0, 0, 14, 15, 3, 12, 6, 0, 15, 16, 5, 0, 0, 1, 16, 1, 1, 0, 0, 0, 17, 35, 5, 4, 0, 0, 18, 35, 5, 5, 0, 0, 19, 35, 5, 6, 0, 0, 20, 35, 5, 7, 0, 0, 21, 35, 5, 8, 0, 0, 22, 35, 5, 9, 0, 0, 23, 35, 5, 10, 0, 0, 24, 35, 5, 11, 0, 0, 25, 35, 5, 12, 0, 0, 26, 35, 5, 13, 0, 0, 27, 35, 5, 14, 0, 0, 28, 35, 5, 15, 0, 0, 29, 35, 5, 16, 0, 0, 30, 35, 5, 17, 0, 0, 31, 35, 5, 20, 0, 0, 32, 33, 5, 32, 0, 0, 33, 35, 5, 58, 0, 0, 34, 17, 1, 0, 0, 0, 34, 18, 1, 0, 0, 0, 34, 19, 1, 0, 0, 0, 34, 20, 1, 0, 0, 0, 34, 21, 1, 0, 0, 0, 34, 22, 1, 0, 0, 0, 34, 23, 1, 0, 0, 0, 34, 24, 1, 0, 0, 0, 34, 25, 1, 0, 0, 0, 34, 26, 1, 0, 0, 0, 34, 27, 1, 0, 0, 0, 34, 28, 1, 0, 0, 0, 34, 29, 1, 0, 0, 0, 34, 30, 1, 0, 0, 0, 34, 31, 1, 0, 0, 0, 34, 32, 1, 0, 0, 0, 35, 3, 1, 0, 0, 0, 36, 38, 5, 24, 0, 0, 37, 39, 5, 54, 0, 0, 38, 37, 1, 0, 0, 0, 38, 39, 1, 0, 0, 0, 39, 40, 1, 0, 0, 0, 40, 41, 5, 41, 0, 0, 41, 42, 3, 6, 3, 0, 42, 43, 5, 40, 0, 0, 43, 153, 1, 0, 0, 0, 44, 46, 5, 25, 0, 0, 45, 47, 5, 54, 0, 0, 46, 45, 1, 0, 0, 0, 46, 47, 1, 0, 0, 0, 47, 48, 1, 0, 0, 0, 48, 49, 5, 41, 0, 0, 49, 50, 3, 6, 3, 0, 50, 51, 5, 40, 0, 0, 51, 153, 1, 0, 0, 0, 52, 54, 5, 26, 0, 0, 53, 55, 5, 54, 0, 0, 54, 53, 1, 0, 0, 0, 54, 55, 1, 0, 0, 0, 55, 56, 1, 0, 0, 0, 56, 57, 5, 41, 0, 0, 57, 58, 3, 6, 3, 0, 58, 59, 5, 40, 0, 0, 59, 153, 1, 0, 0, 0, 60, 62, 5, 21, 0, 0, 61, 63, 5, 54, 0, 0, 62, 61, 1, 0, 0, 0, 62, 63, 1, 0, 0, 0, 63, 64, 1, 0, 0, 0, 64, 65, 5, 41, 0, 0, 65, 66, 3, 6, 3, 0, 66, 67, 5, 53, 0, 0, 67, 68, 3, 6, 3, 0, 68, 69, 5, 40, 0, 0, 69, 153, 1, 0, 0, 0, 70, 72, 5, 18, 0, 0, 71, 73, 5, 54, 0, 0, 72, 71, 1, 0, 0, 0, 72, 73, 1, 0, 0, 0, 73, 74, 1, 0, 0, 0, 74, 75, 5, 41, 0, 0, 75, 76, 3, 6, 3, 0, 76, 77, 5, 40, 0, 0, 77, 153, 1, 0, 0, 0, 78, 80, 5, 19, 0, 0, 79, 81, 5, 54, 0, 0, 80, 79, 1, 0, 0, 0, 80, 81, 1, 0, 0, 0, 81, 82, 1, 0, 0, 0, 82, 83, 5, 41, 0, 0, 83, 84, 3, 6, 3, 0, 84, 85, 5, 40, 0, 0, 85, 153, 1, 0, 0, 0, 86, 88, 5, 22, 0, 0, 87, 89, 5, 54, 0, 0, 88, 87, 1, 0, 0, 0, 88, 89, 1, 0, 0, 0, 89, 90, 1, 0, 0, 0, 90, 91, 5, 41, 0, 0, 91, 92, 3, 6, 3, 0, 92, 93, 5, 40, 0, 0, 93, 153, 1, 0, 0, 0, 94, 96, 5, 23, 0, 0, 95, 97, 5, 54, 0, 0, 96, 95, 1, 0, 0, 0, 96, 97, 1, 0, 0, 0, 97, 98, 1, 0, 0, 0, 98, 99, 5, 41, 0, 0, 99, 100, 3, 6, 3, 0, 100, 101, 5, 40, 0, 0, 101, 153, 1, 0, 0, 0, 102, 104, 5, 27, 0, 0, 103, 105, 5, 54, 0, 0, 104, 103, 1, 0, 0, 0, 104, 105, 1, 0, 0, 0, 105, 106, 1, 0, 0, 0, 106, 107, 5, 41, 0, 0, 107, 112, 3, 12, 6, 0, 108, 109, 5, 53, 0, 0, 109, 111, 3, 12, 6, 0, 110, 108, 1, 0, 0, 0, 111, 114, 1, 0, 0, 0, 112, 110, 1, 0, 0, 0, 112, 113, 1, 0, 0, 0, 113, 115, 1, 0, 0, 0, 114, 112, 1, 0, 0, 0, 115, 116, 5, 40, 0, 0, 116, 153, 1, 0, 0, 0, 117, 119, 5, 28, 0, 0, 118, 120, 5, 54, 0, 0, 119, 118, 1, 0, 0, 0, 119, 120, 1, 0, 0, 0, 120, 121, 1, 0, 0, 0, 121, 122, 5, 41, 0, 0, 122, 123, 5, 58, 0, 0, 123, 129, 3, 12, 6, 0, 124, 125, 5, 53, 0, 0, 125, 126, 5, 58, 0, 0, 126, 128, 3, 12, 6, 0, 127, 124, 1, 0, 0, 0, 128, 131, 1, 0, 0, 0, 129, 127, 1, 0, 0, 0, 129, 130, 1, 0, 0, 0, 130, 132, 1, 0, 0, 0, 131, 129, 1, 0, 0, 0, 132, 133, 5, 40, 0, 0, 133, 153, 1, 0, 0, 0, 134, 136, 5, 29, 0, 0, 135, 137, 5, 54, 0, 0, 136, 135, 1, 0, 0, 0, 136, 137, 1, 0, 0, 0, 137, 138, 1, 0, 0, 0, 138, 139, 5, 41, 0, 0, 139, 140, 3, 12, 6, 0, 140, 141, 5, 40, 0, 0, 141, 153, 1, 0, 0, 0, 142, 144, 5, 30, 0, 0, 143, 145, 5, 54, 0, 0, 144, 143, 1, 0, 0, 0, 144, 145, 1, 0, 0, 0, 145, 146, 1, 0, 0, 0, 146, 147, 5, 41, 0, 0, 147, 148, 3, 12, 6, 0, 148, 149, 5, 53, 0, 0, 149, 150, 3, 12, 6, 0, 150, 151, 5, 40, 0, 0, 151, 153, 1, 0, 0, 0, 152, 36, 1, 0, 0, 0, 152, 44, 1, 0, 0, 0, 152, 52, 1, 0, 0, 0, 152, 60, 1, 0, 0, 0, 152, 70, 1, 0, 0, 0, 152, 78, 1, 0, 0, 0, 152, 86, 1, 0, 0, 0, 152, 94, 1, 0, 0, 0, 152, 102, 1, 0, 0, 0, 152, 117, 1, 0, 0, 0, 152, 134, 1, 0, 0, 0, 152, 142, 1, 0, 0, 0, 153, 5, 1, 0, 0, 0, 154, 158, 5, 57, 0, 0, 155, 158, 5, 58, 0, 0, 156, 158, 3, 12, 6, 0, 157, 154, 1, 0, 0, 0, 157, 155, 1, 0, 0, 0, 157, 156, 1, 0, 0, 0, 158, 7, 1, 0, 0, 0, 159, 160, 5, 31, 0, 0, 160, 9, 1, 0, 0, 0, 161, 163, 3, 2, 1, 0, 162, 164, 5, 54, 0, 0, 163, 162, 1, 0, 0, 0, 163, 164, 1, 0, 0, 0, 164, 171, 1, 0, 0, 0, 165, 171, 3, 4, 2, 0, 166, 168, 3, 8, 4, 0, 167, 169, 5, 54, 0, 0, 168, 167, 1, 0, 0, 0, 168, 169, 1, 0, 0, 0, 169, 171, 1, 0, 0, 0, 170, 161, 1, 0, 0, 0, 170, 165, 1, 0, 0, 0, 170, 166, 1, 0, 0, 0, 171, 11, 1, 0, 0, 0, 172, 173, 6, 6, -1, 0, 173, 174, 5, 50, 0, 0, 174, 175, 3, 12, 6, 0, 175, 176, 5, 51, 0, 0, 176, 234, 1, 0, 0, 0, 177, 178, 5, 58, 0, 0, 178, 179, 5, 36, 0, 0, 179, 181, 3, 12, 6, 0, 180, 182, 5, 62, 0, 0, 181, 180, 1, 0, 0, 0, 182, 183, 1, 0, 0, 0, 183, 181, 1, 0, 0, 0, 183, 184, 1, 0, 0, 0, 184, 195, 1, 0, 0, 0, 185, 186, 5, 58, 0, 0, 186, 187, 5, 36, 0, 0, 187, 189, 3, 12, 6, 0, 188, 190, 5, 62, 0, 0, 189, 188, 1, 0, 0, 0, 190, 191, 1, 0, 0, 0, 191, 189, 1, 0, 0, 0, 191, 192, 1, 0, 0, 0, 192, 194, 1, 0, 0, 0, 193, 185, 1, 0, 0, 0, 194, 197, 1, 0, 0, 0, 195, 193, 1, 0, 0, 0, 195, 196, 1, 0, 0, 0, 196, 198, 1, 0, 0, 0, 197, 195, 1, 0, 0, 0, 198, 202, 3, 10, 5, 0, 199, 201, 5, 62, 0, 0, 200, 199, 1, 0, 0, 0, 201, 204, 1, 0, 0, 0, 202, 200, 1, 0, 0, 0, 202, 203, 1, 0, 0, 0, 203, 234, 1, 0, 0, 0, 204, 202, 1, 0, 0, 0, 205, 234, 3, 10, 5, 0, 206, 234, 5, 57, 0, 0, 207, 209, 5, 58, 0, 0, 208, 210, 5, 54, 0, 0, 209, 208, 1, 0, 0, 0, 209, 210, 1, 0, 0, 0, 210, 234, 1, 0, 0, 0, 211, 212, 5, 58, 0, 0, 212, 221, 5, 50, 0, 0, 213, 218, 3, 12, 6, 0, 214, 215, 5, 53, 0, 0, 215, 217, 3, 12, 6, 0, 216, 214, 1, 0, 0, 0, 217, 220, 1, 0, 0, 0, 218, 216, 1, 0, 0, 0, 218, 219, 1, 0, 0, 0, 219, 222, 1, 0, 0, 0, 220, 218, 1, 0, 0, 0, 221, 213, 1, 0, 0, 0, 221, 222, 1, 0, 0, 0, 222, 223, 1, 0, 0, 0, 223, 234, 5, 51, 0, 0, 224, 225, 5, 1, 0, 0, 225, 226, 3, 12, 6, 0, 226, 227, 5, 2, 0, 0, 227, 228, 3, 12, 6, 0, 228, 229, 5, 3, 0, 0, 229, 230, 3, 12, 6, 3, 230, 234, 1, 0, 0, 0, 231, 232, 5, 42, 0, 0, 232, 234, 3, 12, 6, 2, 233, 172, 1, 0, 0, 0, 233, 177, 1, 0, 0, 0, 233, 205, 1, 0, 0, 0, 233, 206, 1, 0, 0, 0, 233, 207, 1, 0, 0, 0, 233, 211, 1, 0, 0, 0, 233, 224, 1, 0, 0, 0, 233, 231, 1, 0, 0, 0, 234, 246, 1, 0, 0, 0, 235, 236, 10, 4, 0, 0, 236, 237, 7, 0, 0, 0, 237, 245, 3, 12, 6, 5, 238, 239, 10, 1, 0, 0, 239, 240, 5, 54, 0, 0, 240, 241, 3, 12, 6, 0, 241, 242, 5, 55, 0, 0, 242, 243, 3, 12, 6, 2, 243, 245, 1, 0, 0, 0, 244, 235, 1, 0, 0, 0, 244, 238, 1, 0, 0, 0, 245, 248, 1, 0, 0, 0, 246, 244, 1, 0, 0, 0, 246, 247, 1, 0, 0, 0, 247, 13, 1, 0, 0, 0, 248, 246, 1, 0, 0, 0, 30, 34, 38, 46, 54, 62, 72, 80, 88, 96, 104, 112, 119, 129, 136, 144, 152, 157, 163, 168, 170, 183, 191, 195, 202, 209, 218, 221, 233, 244, 246] \ No newline at end of file diff --git a/src/substrait/gen/antlr/SubstraitType.tokens b/src/substrait/gen/antlr/SubstraitType.tokens new file mode 100644 index 0000000..20c69d8 --- /dev/null +++ b/src/substrait/gen/antlr/SubstraitType.tokens @@ -0,0 +1,84 @@ +If=1 +Then=2 +Else=3 +Boolean=4 +I8=5 +I16=6 +I32=7 +I64=8 +FP32=9 +FP64=10 +String=11 +Binary=12 +Timestamp=13 +TimestampTZ=14 +Date=15 +Time=16 +IntervalYear=17 +IntervalDay=18 +IntervalCompound=19 +UUID=20 +Decimal=21 +PrecisionTimestamp=22 +PrecisionTimestampTZ=23 +FixedChar=24 +VarChar=25 +FixedBinary=26 +Struct=27 +NStruct=28 +List=29 +Map=30 +ANY=31 +UserDefined=32 +And=33 +Or=34 +Assign=35 +Eq=36 +NotEquals=37 +Gte=38 +Lte=39 +Gt=40 +Lt=41 +Bang=42 +Plus=43 +Minus=44 +Asterisk=45 +ForwardSlash=46 +Percent=47 +OBracket=48 +CBracket=49 +OParen=50 +CParen=51 +SColon=52 +Comma=53 +QMark=54 +Colon=55 +SingleQuote=56 +Number=57 +Identifier=58 +LineComment=59 +BlockComment=60 +Whitespace=61 +Newline=62 +':='=35 +'='=36 +'!='=37 +'>='=38 +'<='=39 +'>'=40 +'<'=41 +'!'=42 +'+'=43 +'-'=44 +'*'=45 +'/'=46 +'%'=47 +'['=48 +']'=49 +'('=50 +')'=51 +';'=52 +','=53 +'?'=54 +':'=55 +'\''=56 diff --git a/src/substrait/gen/antlr/SubstraitTypeLexer.interp b/src/substrait/gen/antlr/SubstraitTypeLexer.interp new file mode 100644 index 0000000..d6f47ea --- /dev/null +++ b/src/substrait/gen/antlr/SubstraitTypeLexer.interp @@ -0,0 +1,231 @@ +token literal names: +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +':=' +'=' +'!=' +'>=' +'<=' +'>' +'<' +'!' +'+' +'-' +'*' +'/' +'%' +'[' +']' +'(' +')' +';' +',' +'?' +':' +'\'' +null +null +null +null +null +null + +token symbolic names: +null +If +Then +Else +Boolean +I8 +I16 +I32 +I64 +FP32 +FP64 +String +Binary +Timestamp +TimestampTZ +Date +Time +IntervalYear +IntervalDay +IntervalCompound +UUID +Decimal +PrecisionTimestamp +PrecisionTimestampTZ +FixedChar +VarChar +FixedBinary +Struct +NStruct +List +Map +ANY +UserDefined +And +Or +Assign +Eq +NotEquals +Gte +Lte +Gt +Lt +Bang +Plus +Minus +Asterisk +ForwardSlash +Percent +OBracket +CBracket +OParen +CParen +SColon +Comma +QMark +Colon +SingleQuote +Number +Identifier +LineComment +BlockComment +Whitespace +Newline + +rule names: +A +B +C +D +E +F +G +H +I +J +K +L +M +N +O +P +Q +R +S +T +U +V +W +X +Y +Z +If +Then +Else +Boolean +I8 +I16 +I32 +I64 +FP32 +FP64 +String +Binary +Timestamp +TimestampTZ +Date +Time +IntervalYear +IntervalDay +IntervalCompound +UUID +Decimal +PrecisionTimestamp +PrecisionTimestampTZ +FixedChar +VarChar +FixedBinary +Struct +NStruct +List +Map +ANY +UserDefined +And +Or +Assign +Eq +NotEquals +Gte +Lte +Gt +Lt +Bang +Plus +Minus +Asterisk +ForwardSlash +Percent +OBracket +CBracket +OParen +CParen +SColon +Comma +QMark +Colon +SingleQuote +Number +Identifier +LineComment +BlockComment +Whitespace +Newline +Int +Digit + +channel names: +DEFAULT_TOKEN_CHANNEL +HIDDEN + +mode names: +DEFAULT_MODE + +atn: +[4, 0, 62, 632, 6, -1, 2, 0, 7, 0, 2, 1, 7, 1, 2, 2, 7, 2, 2, 3, 7, 3, 2, 4, 7, 4, 2, 5, 7, 5, 2, 6, 7, 6, 2, 7, 7, 7, 2, 8, 7, 8, 2, 9, 7, 9, 2, 10, 7, 10, 2, 11, 7, 11, 2, 12, 7, 12, 2, 13, 7, 13, 2, 14, 7, 14, 2, 15, 7, 15, 2, 16, 7, 16, 2, 17, 7, 17, 2, 18, 7, 18, 2, 19, 7, 19, 2, 20, 7, 20, 2, 21, 7, 21, 2, 22, 7, 22, 2, 23, 7, 23, 2, 24, 7, 24, 2, 25, 7, 25, 2, 26, 7, 26, 2, 27, 7, 27, 2, 28, 7, 28, 2, 29, 7, 29, 2, 30, 7, 30, 2, 31, 7, 31, 2, 32, 7, 32, 2, 33, 7, 33, 2, 34, 7, 34, 2, 35, 7, 35, 2, 36, 7, 36, 2, 37, 7, 37, 2, 38, 7, 38, 2, 39, 7, 39, 2, 40, 7, 40, 2, 41, 7, 41, 2, 42, 7, 42, 2, 43, 7, 43, 2, 44, 7, 44, 2, 45, 7, 45, 2, 46, 7, 46, 2, 47, 7, 47, 2, 48, 7, 48, 2, 49, 7, 49, 2, 50, 7, 50, 2, 51, 7, 51, 2, 52, 7, 52, 2, 53, 7, 53, 2, 54, 7, 54, 2, 55, 7, 55, 2, 56, 7, 56, 2, 57, 7, 57, 2, 58, 7, 58, 2, 59, 7, 59, 2, 60, 7, 60, 2, 61, 7, 61, 2, 62, 7, 62, 2, 63, 7, 63, 2, 64, 7, 64, 2, 65, 7, 65, 2, 66, 7, 66, 2, 67, 7, 67, 2, 68, 7, 68, 2, 69, 7, 69, 2, 70, 7, 70, 2, 71, 7, 71, 2, 72, 7, 72, 2, 73, 7, 73, 2, 74, 7, 74, 2, 75, 7, 75, 2, 76, 7, 76, 2, 77, 7, 77, 2, 78, 7, 78, 2, 79, 7, 79, 2, 80, 7, 80, 2, 81, 7, 81, 2, 82, 7, 82, 2, 83, 7, 83, 2, 84, 7, 84, 2, 85, 7, 85, 2, 86, 7, 86, 2, 87, 7, 87, 2, 88, 7, 88, 2, 89, 7, 89, 1, 0, 1, 0, 1, 1, 1, 1, 1, 2, 1, 2, 1, 3, 1, 3, 1, 4, 1, 4, 1, 5, 1, 5, 1, 6, 1, 6, 1, 7, 1, 7, 1, 8, 1, 8, 1, 9, 1, 9, 1, 10, 1, 10, 1, 11, 1, 11, 1, 12, 1, 12, 1, 13, 1, 13, 1, 14, 1, 14, 1, 15, 1, 15, 1, 16, 1, 16, 1, 17, 1, 17, 1, 18, 1, 18, 1, 19, 1, 19, 1, 20, 1, 20, 1, 21, 1, 21, 1, 22, 1, 22, 1, 23, 1, 23, 1, 24, 1, 24, 1, 25, 1, 25, 1, 26, 1, 26, 1, 26, 1, 27, 1, 27, 1, 27, 1, 27, 1, 27, 1, 28, 1, 28, 1, 28, 1, 28, 1, 28, 1, 29, 1, 29, 1, 29, 1, 29, 1, 29, 1, 29, 1, 29, 1, 29, 1, 30, 1, 30, 1, 30, 1, 31, 1, 31, 1, 31, 1, 31, 1, 32, 1, 32, 1, 32, 1, 32, 1, 33, 1, 33, 1, 33, 1, 33, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 35, 1, 35, 1, 35, 1, 35, 1, 35, 1, 36, 1, 36, 1, 36, 1, 36, 1, 36, 1, 36, 1, 36, 1, 37, 1, 37, 1, 37, 1, 37, 1, 37, 1, 37, 1, 37, 1, 38, 1, 38, 1, 38, 1, 38, 1, 38, 1, 38, 1, 38, 1, 38, 1, 38, 1, 38, 1, 39, 1, 39, 1, 39, 1, 39, 1, 39, 1, 39, 1, 39, 1, 39, 1, 39, 1, 39, 1, 39, 1, 39, 1, 39, 1, 40, 1, 40, 1, 40, 1, 40, 1, 40, 1, 41, 1, 41, 1, 41, 1, 41, 1, 41, 1, 42, 1, 42, 1, 42, 1, 42, 1, 42, 1, 42, 1, 42, 1, 42, 1, 42, 1, 42, 1, 42, 1, 42, 1, 42, 1, 42, 1, 43, 1, 43, 1, 43, 1, 43, 1, 43, 1, 43, 1, 43, 1, 43, 1, 43, 1, 43, 1, 43, 1, 43, 1, 43, 1, 44, 1, 44, 1, 44, 1, 44, 1, 44, 1, 44, 1, 44, 1, 44, 1, 44, 1, 44, 1, 44, 1, 44, 1, 44, 1, 44, 1, 44, 1, 44, 1, 44, 1, 44, 1, 45, 1, 45, 1, 45, 1, 45, 1, 45, 1, 46, 1, 46, 1, 46, 1, 46, 1, 46, 1, 46, 1, 46, 1, 46, 1, 47, 1, 47, 1, 47, 1, 47, 1, 47, 1, 47, 1, 47, 1, 47, 1, 47, 1, 47, 1, 47, 1, 47, 1, 47, 1, 47, 1, 47, 1, 47, 1, 47, 1, 47, 1, 47, 1, 47, 1, 48, 1, 48, 1, 48, 1, 48, 1, 48, 1, 48, 1, 48, 1, 48, 1, 48, 1, 48, 1, 48, 1, 48, 1, 48, 1, 48, 1, 48, 1, 48, 1, 48, 1, 48, 1, 48, 1, 48, 1, 48, 1, 48, 1, 48, 1, 49, 1, 49, 1, 49, 1, 49, 1, 49, 1, 49, 1, 49, 1, 49, 1, 49, 1, 49, 1, 50, 1, 50, 1, 50, 1, 50, 1, 50, 1, 50, 1, 50, 1, 50, 1, 51, 1, 51, 1, 51, 1, 51, 1, 51, 1, 51, 1, 51, 1, 51, 1, 51, 1, 51, 1, 51, 1, 51, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 53, 1, 53, 1, 53, 1, 53, 1, 53, 1, 53, 1, 53, 1, 53, 1, 54, 1, 54, 1, 54, 1, 54, 1, 54, 1, 55, 1, 55, 1, 55, 1, 55, 1, 56, 1, 56, 1, 56, 1, 56, 1, 57, 1, 57, 1, 57, 1, 58, 1, 58, 1, 58, 1, 58, 1, 59, 1, 59, 1, 59, 1, 60, 1, 60, 1, 60, 1, 61, 1, 61, 1, 62, 1, 62, 1, 62, 1, 63, 1, 63, 1, 63, 1, 64, 1, 64, 1, 64, 1, 65, 1, 65, 1, 66, 1, 66, 1, 67, 1, 67, 1, 68, 1, 68, 1, 69, 1, 69, 1, 70, 1, 70, 1, 71, 1, 71, 1, 72, 1, 72, 1, 73, 1, 73, 1, 74, 1, 74, 1, 75, 1, 75, 1, 76, 1, 76, 1, 77, 1, 77, 1, 78, 1, 78, 1, 79, 1, 79, 1, 80, 1, 80, 1, 81, 1, 81, 1, 82, 3, 82, 545, 8, 82, 1, 82, 1, 82, 1, 83, 1, 83, 1, 83, 5, 83, 552, 8, 83, 10, 83, 12, 83, 555, 9, 83, 1, 84, 1, 84, 1, 84, 1, 84, 5, 84, 561, 8, 84, 10, 84, 12, 84, 564, 9, 84, 1, 84, 1, 84, 1, 85, 1, 85, 1, 85, 1, 85, 5, 85, 572, 8, 85, 10, 85, 12, 85, 575, 9, 85, 1, 85, 1, 85, 1, 85, 4, 85, 580, 8, 85, 11, 85, 12, 85, 581, 1, 85, 1, 85, 4, 85, 586, 8, 85, 11, 85, 12, 85, 587, 1, 85, 5, 85, 591, 8, 85, 10, 85, 12, 85, 594, 9, 85, 1, 85, 5, 85, 597, 8, 85, 10, 85, 12, 85, 600, 9, 85, 1, 85, 1, 85, 1, 85, 1, 85, 1, 85, 1, 86, 4, 86, 608, 8, 86, 11, 86, 12, 86, 609, 1, 86, 1, 86, 1, 87, 1, 87, 3, 87, 616, 8, 87, 1, 87, 3, 87, 619, 8, 87, 1, 88, 1, 88, 5, 88, 623, 8, 88, 10, 88, 12, 88, 626, 9, 88, 1, 88, 3, 88, 629, 8, 88, 1, 89, 1, 89, 0, 0, 90, 1, 0, 3, 0, 5, 0, 7, 0, 9, 0, 11, 0, 13, 0, 15, 0, 17, 0, 19, 0, 21, 0, 23, 0, 25, 0, 27, 0, 29, 0, 31, 0, 33, 0, 35, 0, 37, 0, 39, 0, 41, 0, 43, 0, 45, 0, 47, 0, 49, 0, 51, 0, 53, 1, 55, 2, 57, 3, 59, 4, 61, 5, 63, 6, 65, 7, 67, 8, 69, 9, 71, 10, 73, 11, 75, 12, 77, 13, 79, 14, 81, 15, 83, 16, 85, 17, 87, 18, 89, 19, 91, 20, 93, 21, 95, 22, 97, 23, 99, 24, 101, 25, 103, 26, 105, 27, 107, 28, 109, 29, 111, 30, 113, 31, 115, 32, 117, 33, 119, 34, 121, 35, 123, 36, 125, 37, 127, 38, 129, 39, 131, 40, 133, 41, 135, 42, 137, 43, 139, 44, 141, 45, 143, 46, 145, 47, 147, 48, 149, 49, 151, 50, 153, 51, 155, 52, 157, 53, 159, 54, 161, 55, 163, 56, 165, 57, 167, 58, 169, 59, 171, 60, 173, 61, 175, 62, 177, 0, 179, 0, 1, 0, 30, 2, 0, 65, 65, 97, 97, 2, 0, 66, 66, 98, 98, 2, 0, 67, 67, 99, 99, 2, 0, 68, 68, 100, 100, 2, 0, 69, 69, 101, 101, 2, 0, 70, 70, 102, 102, 2, 0, 71, 71, 103, 103, 2, 0, 72, 72, 104, 104, 2, 0, 73, 73, 105, 105, 2, 0, 74, 74, 106, 106, 2, 0, 75, 75, 107, 107, 2, 0, 76, 76, 108, 108, 2, 0, 77, 77, 109, 109, 2, 0, 78, 78, 110, 110, 2, 0, 79, 79, 111, 111, 2, 0, 80, 80, 112, 112, 2, 0, 81, 81, 113, 113, 2, 0, 82, 82, 114, 114, 2, 0, 83, 83, 115, 115, 2, 0, 84, 84, 116, 116, 2, 0, 85, 85, 117, 117, 2, 0, 86, 86, 118, 118, 2, 0, 87, 87, 119, 119, 2, 0, 88, 88, 120, 120, 2, 0, 89, 89, 121, 121, 2, 0, 90, 90, 122, 122, 4, 0, 36, 36, 65, 90, 95, 95, 97, 122, 2, 0, 10, 10, 13, 13, 2, 0, 42, 42, 47, 47, 2, 0, 9, 9, 32, 32, 620, 0, 53, 1, 0, 0, 0, 0, 55, 1, 0, 0, 0, 0, 57, 1, 0, 0, 0, 0, 59, 1, 0, 0, 0, 0, 61, 1, 0, 0, 0, 0, 63, 1, 0, 0, 0, 0, 65, 1, 0, 0, 0, 0, 67, 1, 0, 0, 0, 0, 69, 1, 0, 0, 0, 0, 71, 1, 0, 0, 0, 0, 73, 1, 0, 0, 0, 0, 75, 1, 0, 0, 0, 0, 77, 1, 0, 0, 0, 0, 79, 1, 0, 0, 0, 0, 81, 1, 0, 0, 0, 0, 83, 1, 0, 0, 0, 0, 85, 1, 0, 0, 0, 0, 87, 1, 0, 0, 0, 0, 89, 1, 0, 0, 0, 0, 91, 1, 0, 0, 0, 0, 93, 1, 0, 0, 0, 0, 95, 1, 0, 0, 0, 0, 97, 1, 0, 0, 0, 0, 99, 1, 0, 0, 0, 0, 101, 1, 0, 0, 0, 0, 103, 1, 0, 0, 0, 0, 105, 1, 0, 0, 0, 0, 107, 1, 0, 0, 0, 0, 109, 1, 0, 0, 0, 0, 111, 1, 0, 0, 0, 0, 113, 1, 0, 0, 0, 0, 115, 1, 0, 0, 0, 0, 117, 1, 0, 0, 0, 0, 119, 1, 0, 0, 0, 0, 121, 1, 0, 0, 0, 0, 123, 1, 0, 0, 0, 0, 125, 1, 0, 0, 0, 0, 127, 1, 0, 0, 0, 0, 129, 1, 0, 0, 0, 0, 131, 1, 0, 0, 0, 0, 133, 1, 0, 0, 0, 0, 135, 1, 0, 0, 0, 0, 137, 1, 0, 0, 0, 0, 139, 1, 0, 0, 0, 0, 141, 1, 0, 0, 0, 0, 143, 1, 0, 0, 0, 0, 145, 1, 0, 0, 0, 0, 147, 1, 0, 0, 0, 0, 149, 1, 0, 0, 0, 0, 151, 1, 0, 0, 0, 0, 153, 1, 0, 0, 0, 0, 155, 1, 0, 0, 0, 0, 157, 1, 0, 0, 0, 0, 159, 1, 0, 0, 0, 0, 161, 1, 0, 0, 0, 0, 163, 1, 0, 0, 0, 0, 165, 1, 0, 0, 0, 0, 167, 1, 0, 0, 0, 0, 169, 1, 0, 0, 0, 0, 171, 1, 0, 0, 0, 0, 173, 1, 0, 0, 0, 0, 175, 1, 0, 0, 0, 1, 181, 1, 0, 0, 0, 3, 183, 1, 0, 0, 0, 5, 185, 1, 0, 0, 0, 7, 187, 1, 0, 0, 0, 9, 189, 1, 0, 0, 0, 11, 191, 1, 0, 0, 0, 13, 193, 1, 0, 0, 0, 15, 195, 1, 0, 0, 0, 17, 197, 1, 0, 0, 0, 19, 199, 1, 0, 0, 0, 21, 201, 1, 0, 0, 0, 23, 203, 1, 0, 0, 0, 25, 205, 1, 0, 0, 0, 27, 207, 1, 0, 0, 0, 29, 209, 1, 0, 0, 0, 31, 211, 1, 0, 0, 0, 33, 213, 1, 0, 0, 0, 35, 215, 1, 0, 0, 0, 37, 217, 1, 0, 0, 0, 39, 219, 1, 0, 0, 0, 41, 221, 1, 0, 0, 0, 43, 223, 1, 0, 0, 0, 45, 225, 1, 0, 0, 0, 47, 227, 1, 0, 0, 0, 49, 229, 1, 0, 0, 0, 51, 231, 1, 0, 0, 0, 53, 233, 1, 0, 0, 0, 55, 236, 1, 0, 0, 0, 57, 241, 1, 0, 0, 0, 59, 246, 1, 0, 0, 0, 61, 254, 1, 0, 0, 0, 63, 257, 1, 0, 0, 0, 65, 261, 1, 0, 0, 0, 67, 265, 1, 0, 0, 0, 69, 269, 1, 0, 0, 0, 71, 274, 1, 0, 0, 0, 73, 279, 1, 0, 0, 0, 75, 286, 1, 0, 0, 0, 77, 293, 1, 0, 0, 0, 79, 303, 1, 0, 0, 0, 81, 316, 1, 0, 0, 0, 83, 321, 1, 0, 0, 0, 85, 326, 1, 0, 0, 0, 87, 340, 1, 0, 0, 0, 89, 353, 1, 0, 0, 0, 91, 371, 1, 0, 0, 0, 93, 376, 1, 0, 0, 0, 95, 384, 1, 0, 0, 0, 97, 404, 1, 0, 0, 0, 99, 427, 1, 0, 0, 0, 101, 437, 1, 0, 0, 0, 103, 445, 1, 0, 0, 0, 105, 457, 1, 0, 0, 0, 107, 464, 1, 0, 0, 0, 109, 472, 1, 0, 0, 0, 111, 477, 1, 0, 0, 0, 113, 481, 1, 0, 0, 0, 115, 485, 1, 0, 0, 0, 117, 488, 1, 0, 0, 0, 119, 492, 1, 0, 0, 0, 121, 495, 1, 0, 0, 0, 123, 498, 1, 0, 0, 0, 125, 500, 1, 0, 0, 0, 127, 503, 1, 0, 0, 0, 129, 506, 1, 0, 0, 0, 131, 509, 1, 0, 0, 0, 133, 511, 1, 0, 0, 0, 135, 513, 1, 0, 0, 0, 137, 515, 1, 0, 0, 0, 139, 517, 1, 0, 0, 0, 141, 519, 1, 0, 0, 0, 143, 521, 1, 0, 0, 0, 145, 523, 1, 0, 0, 0, 147, 525, 1, 0, 0, 0, 149, 527, 1, 0, 0, 0, 151, 529, 1, 0, 0, 0, 153, 531, 1, 0, 0, 0, 155, 533, 1, 0, 0, 0, 157, 535, 1, 0, 0, 0, 159, 537, 1, 0, 0, 0, 161, 539, 1, 0, 0, 0, 163, 541, 1, 0, 0, 0, 165, 544, 1, 0, 0, 0, 167, 548, 1, 0, 0, 0, 169, 556, 1, 0, 0, 0, 171, 567, 1, 0, 0, 0, 173, 607, 1, 0, 0, 0, 175, 618, 1, 0, 0, 0, 177, 628, 1, 0, 0, 0, 179, 630, 1, 0, 0, 0, 181, 182, 7, 0, 0, 0, 182, 2, 1, 0, 0, 0, 183, 184, 7, 1, 0, 0, 184, 4, 1, 0, 0, 0, 185, 186, 7, 2, 0, 0, 186, 6, 1, 0, 0, 0, 187, 188, 7, 3, 0, 0, 188, 8, 1, 0, 0, 0, 189, 190, 7, 4, 0, 0, 190, 10, 1, 0, 0, 0, 191, 192, 7, 5, 0, 0, 192, 12, 1, 0, 0, 0, 193, 194, 7, 6, 0, 0, 194, 14, 1, 0, 0, 0, 195, 196, 7, 7, 0, 0, 196, 16, 1, 0, 0, 0, 197, 198, 7, 8, 0, 0, 198, 18, 1, 0, 0, 0, 199, 200, 7, 9, 0, 0, 200, 20, 1, 0, 0, 0, 201, 202, 7, 10, 0, 0, 202, 22, 1, 0, 0, 0, 203, 204, 7, 11, 0, 0, 204, 24, 1, 0, 0, 0, 205, 206, 7, 12, 0, 0, 206, 26, 1, 0, 0, 0, 207, 208, 7, 13, 0, 0, 208, 28, 1, 0, 0, 0, 209, 210, 7, 14, 0, 0, 210, 30, 1, 0, 0, 0, 211, 212, 7, 15, 0, 0, 212, 32, 1, 0, 0, 0, 213, 214, 7, 16, 0, 0, 214, 34, 1, 0, 0, 0, 215, 216, 7, 17, 0, 0, 216, 36, 1, 0, 0, 0, 217, 218, 7, 18, 0, 0, 218, 38, 1, 0, 0, 0, 219, 220, 7, 19, 0, 0, 220, 40, 1, 0, 0, 0, 221, 222, 7, 20, 0, 0, 222, 42, 1, 0, 0, 0, 223, 224, 7, 21, 0, 0, 224, 44, 1, 0, 0, 0, 225, 226, 7, 22, 0, 0, 226, 46, 1, 0, 0, 0, 227, 228, 7, 23, 0, 0, 228, 48, 1, 0, 0, 0, 229, 230, 7, 24, 0, 0, 230, 50, 1, 0, 0, 0, 231, 232, 7, 25, 0, 0, 232, 52, 1, 0, 0, 0, 233, 234, 3, 17, 8, 0, 234, 235, 3, 11, 5, 0, 235, 54, 1, 0, 0, 0, 236, 237, 3, 39, 19, 0, 237, 238, 3, 15, 7, 0, 238, 239, 3, 9, 4, 0, 239, 240, 3, 27, 13, 0, 240, 56, 1, 0, 0, 0, 241, 242, 3, 9, 4, 0, 242, 243, 3, 23, 11, 0, 243, 244, 3, 37, 18, 0, 244, 245, 3, 9, 4, 0, 245, 58, 1, 0, 0, 0, 246, 247, 3, 3, 1, 0, 247, 248, 3, 29, 14, 0, 248, 249, 3, 29, 14, 0, 249, 250, 3, 23, 11, 0, 250, 251, 3, 9, 4, 0, 251, 252, 3, 1, 0, 0, 252, 253, 3, 27, 13, 0, 253, 60, 1, 0, 0, 0, 254, 255, 3, 17, 8, 0, 255, 256, 5, 56, 0, 0, 256, 62, 1, 0, 0, 0, 257, 258, 3, 17, 8, 0, 258, 259, 5, 49, 0, 0, 259, 260, 5, 54, 0, 0, 260, 64, 1, 0, 0, 0, 261, 262, 3, 17, 8, 0, 262, 263, 5, 51, 0, 0, 263, 264, 5, 50, 0, 0, 264, 66, 1, 0, 0, 0, 265, 266, 3, 17, 8, 0, 266, 267, 5, 54, 0, 0, 267, 268, 5, 52, 0, 0, 268, 68, 1, 0, 0, 0, 269, 270, 3, 11, 5, 0, 270, 271, 3, 31, 15, 0, 271, 272, 5, 51, 0, 0, 272, 273, 5, 50, 0, 0, 273, 70, 1, 0, 0, 0, 274, 275, 3, 11, 5, 0, 275, 276, 3, 31, 15, 0, 276, 277, 5, 54, 0, 0, 277, 278, 5, 52, 0, 0, 278, 72, 1, 0, 0, 0, 279, 280, 3, 37, 18, 0, 280, 281, 3, 39, 19, 0, 281, 282, 3, 35, 17, 0, 282, 283, 3, 17, 8, 0, 283, 284, 3, 27, 13, 0, 284, 285, 3, 13, 6, 0, 285, 74, 1, 0, 0, 0, 286, 287, 3, 3, 1, 0, 287, 288, 3, 17, 8, 0, 288, 289, 3, 27, 13, 0, 289, 290, 3, 1, 0, 0, 290, 291, 3, 35, 17, 0, 291, 292, 3, 49, 24, 0, 292, 76, 1, 0, 0, 0, 293, 294, 3, 39, 19, 0, 294, 295, 3, 17, 8, 0, 295, 296, 3, 25, 12, 0, 296, 297, 3, 9, 4, 0, 297, 298, 3, 37, 18, 0, 298, 299, 3, 39, 19, 0, 299, 300, 3, 1, 0, 0, 300, 301, 3, 25, 12, 0, 301, 302, 3, 31, 15, 0, 302, 78, 1, 0, 0, 0, 303, 304, 3, 39, 19, 0, 304, 305, 3, 17, 8, 0, 305, 306, 3, 25, 12, 0, 306, 307, 3, 9, 4, 0, 307, 308, 3, 37, 18, 0, 308, 309, 3, 39, 19, 0, 309, 310, 3, 1, 0, 0, 310, 311, 3, 25, 12, 0, 311, 312, 3, 31, 15, 0, 312, 313, 5, 95, 0, 0, 313, 314, 3, 39, 19, 0, 314, 315, 3, 51, 25, 0, 315, 80, 1, 0, 0, 0, 316, 317, 3, 7, 3, 0, 317, 318, 3, 1, 0, 0, 318, 319, 3, 39, 19, 0, 319, 320, 3, 9, 4, 0, 320, 82, 1, 0, 0, 0, 321, 322, 3, 39, 19, 0, 322, 323, 3, 17, 8, 0, 323, 324, 3, 25, 12, 0, 324, 325, 3, 9, 4, 0, 325, 84, 1, 0, 0, 0, 326, 327, 3, 17, 8, 0, 327, 328, 3, 27, 13, 0, 328, 329, 3, 39, 19, 0, 329, 330, 3, 9, 4, 0, 330, 331, 3, 35, 17, 0, 331, 332, 3, 43, 21, 0, 332, 333, 3, 1, 0, 0, 333, 334, 3, 23, 11, 0, 334, 335, 5, 95, 0, 0, 335, 336, 3, 49, 24, 0, 336, 337, 3, 9, 4, 0, 337, 338, 3, 1, 0, 0, 338, 339, 3, 35, 17, 0, 339, 86, 1, 0, 0, 0, 340, 341, 3, 17, 8, 0, 341, 342, 3, 27, 13, 0, 342, 343, 3, 39, 19, 0, 343, 344, 3, 9, 4, 0, 344, 345, 3, 35, 17, 0, 345, 346, 3, 43, 21, 0, 346, 347, 3, 1, 0, 0, 347, 348, 3, 23, 11, 0, 348, 349, 5, 95, 0, 0, 349, 350, 3, 7, 3, 0, 350, 351, 3, 1, 0, 0, 351, 352, 3, 49, 24, 0, 352, 88, 1, 0, 0, 0, 353, 354, 3, 17, 8, 0, 354, 355, 3, 27, 13, 0, 355, 356, 3, 39, 19, 0, 356, 357, 3, 9, 4, 0, 357, 358, 3, 35, 17, 0, 358, 359, 3, 43, 21, 0, 359, 360, 3, 1, 0, 0, 360, 361, 3, 23, 11, 0, 361, 362, 5, 95, 0, 0, 362, 363, 3, 5, 2, 0, 363, 364, 3, 29, 14, 0, 364, 365, 3, 25, 12, 0, 365, 366, 3, 31, 15, 0, 366, 367, 3, 29, 14, 0, 367, 368, 3, 41, 20, 0, 368, 369, 3, 27, 13, 0, 369, 370, 3, 7, 3, 0, 370, 90, 1, 0, 0, 0, 371, 372, 3, 41, 20, 0, 372, 373, 3, 41, 20, 0, 373, 374, 3, 17, 8, 0, 374, 375, 3, 7, 3, 0, 375, 92, 1, 0, 0, 0, 376, 377, 3, 7, 3, 0, 377, 378, 3, 9, 4, 0, 378, 379, 3, 5, 2, 0, 379, 380, 3, 17, 8, 0, 380, 381, 3, 25, 12, 0, 381, 382, 3, 1, 0, 0, 382, 383, 3, 23, 11, 0, 383, 94, 1, 0, 0, 0, 384, 385, 3, 31, 15, 0, 385, 386, 3, 35, 17, 0, 386, 387, 3, 9, 4, 0, 387, 388, 3, 5, 2, 0, 388, 389, 3, 17, 8, 0, 389, 390, 3, 37, 18, 0, 390, 391, 3, 17, 8, 0, 391, 392, 3, 29, 14, 0, 392, 393, 3, 27, 13, 0, 393, 394, 5, 95, 0, 0, 394, 395, 3, 39, 19, 0, 395, 396, 3, 17, 8, 0, 396, 397, 3, 25, 12, 0, 397, 398, 3, 9, 4, 0, 398, 399, 3, 37, 18, 0, 399, 400, 3, 39, 19, 0, 400, 401, 3, 1, 0, 0, 401, 402, 3, 25, 12, 0, 402, 403, 3, 31, 15, 0, 403, 96, 1, 0, 0, 0, 404, 405, 3, 31, 15, 0, 405, 406, 3, 35, 17, 0, 406, 407, 3, 9, 4, 0, 407, 408, 3, 5, 2, 0, 408, 409, 3, 17, 8, 0, 409, 410, 3, 37, 18, 0, 410, 411, 3, 17, 8, 0, 411, 412, 3, 29, 14, 0, 412, 413, 3, 27, 13, 0, 413, 414, 5, 95, 0, 0, 414, 415, 3, 39, 19, 0, 415, 416, 3, 17, 8, 0, 416, 417, 3, 25, 12, 0, 417, 418, 3, 9, 4, 0, 418, 419, 3, 37, 18, 0, 419, 420, 3, 39, 19, 0, 420, 421, 3, 1, 0, 0, 421, 422, 3, 25, 12, 0, 422, 423, 3, 31, 15, 0, 423, 424, 5, 95, 0, 0, 424, 425, 3, 39, 19, 0, 425, 426, 3, 51, 25, 0, 426, 98, 1, 0, 0, 0, 427, 428, 3, 11, 5, 0, 428, 429, 3, 17, 8, 0, 429, 430, 3, 47, 23, 0, 430, 431, 3, 9, 4, 0, 431, 432, 3, 7, 3, 0, 432, 433, 3, 5, 2, 0, 433, 434, 3, 15, 7, 0, 434, 435, 3, 1, 0, 0, 435, 436, 3, 35, 17, 0, 436, 100, 1, 0, 0, 0, 437, 438, 3, 43, 21, 0, 438, 439, 3, 1, 0, 0, 439, 440, 3, 35, 17, 0, 440, 441, 3, 5, 2, 0, 441, 442, 3, 15, 7, 0, 442, 443, 3, 1, 0, 0, 443, 444, 3, 35, 17, 0, 444, 102, 1, 0, 0, 0, 445, 446, 3, 11, 5, 0, 446, 447, 3, 17, 8, 0, 447, 448, 3, 47, 23, 0, 448, 449, 3, 9, 4, 0, 449, 450, 3, 7, 3, 0, 450, 451, 3, 3, 1, 0, 451, 452, 3, 17, 8, 0, 452, 453, 3, 27, 13, 0, 453, 454, 3, 1, 0, 0, 454, 455, 3, 35, 17, 0, 455, 456, 3, 49, 24, 0, 456, 104, 1, 0, 0, 0, 457, 458, 3, 37, 18, 0, 458, 459, 3, 39, 19, 0, 459, 460, 3, 35, 17, 0, 460, 461, 3, 41, 20, 0, 461, 462, 3, 5, 2, 0, 462, 463, 3, 39, 19, 0, 463, 106, 1, 0, 0, 0, 464, 465, 3, 27, 13, 0, 465, 466, 3, 37, 18, 0, 466, 467, 3, 39, 19, 0, 467, 468, 3, 35, 17, 0, 468, 469, 3, 41, 20, 0, 469, 470, 3, 5, 2, 0, 470, 471, 3, 39, 19, 0, 471, 108, 1, 0, 0, 0, 472, 473, 3, 23, 11, 0, 473, 474, 3, 17, 8, 0, 474, 475, 3, 37, 18, 0, 475, 476, 3, 39, 19, 0, 476, 110, 1, 0, 0, 0, 477, 478, 3, 25, 12, 0, 478, 479, 3, 1, 0, 0, 479, 480, 3, 31, 15, 0, 480, 112, 1, 0, 0, 0, 481, 482, 3, 1, 0, 0, 482, 483, 3, 27, 13, 0, 483, 484, 3, 49, 24, 0, 484, 114, 1, 0, 0, 0, 485, 486, 3, 41, 20, 0, 486, 487, 5, 33, 0, 0, 487, 116, 1, 0, 0, 0, 488, 489, 3, 1, 0, 0, 489, 490, 3, 27, 13, 0, 490, 491, 3, 7, 3, 0, 491, 118, 1, 0, 0, 0, 492, 493, 3, 29, 14, 0, 493, 494, 3, 35, 17, 0, 494, 120, 1, 0, 0, 0, 495, 496, 5, 58, 0, 0, 496, 497, 5, 61, 0, 0, 497, 122, 1, 0, 0, 0, 498, 499, 5, 61, 0, 0, 499, 124, 1, 0, 0, 0, 500, 501, 5, 33, 0, 0, 501, 502, 5, 61, 0, 0, 502, 126, 1, 0, 0, 0, 503, 504, 5, 62, 0, 0, 504, 505, 5, 61, 0, 0, 505, 128, 1, 0, 0, 0, 506, 507, 5, 60, 0, 0, 507, 508, 5, 61, 0, 0, 508, 130, 1, 0, 0, 0, 509, 510, 5, 62, 0, 0, 510, 132, 1, 0, 0, 0, 511, 512, 5, 60, 0, 0, 512, 134, 1, 0, 0, 0, 513, 514, 5, 33, 0, 0, 514, 136, 1, 0, 0, 0, 515, 516, 5, 43, 0, 0, 516, 138, 1, 0, 0, 0, 517, 518, 5, 45, 0, 0, 518, 140, 1, 0, 0, 0, 519, 520, 5, 42, 0, 0, 520, 142, 1, 0, 0, 0, 521, 522, 5, 47, 0, 0, 522, 144, 1, 0, 0, 0, 523, 524, 5, 37, 0, 0, 524, 146, 1, 0, 0, 0, 525, 526, 5, 91, 0, 0, 526, 148, 1, 0, 0, 0, 527, 528, 5, 93, 0, 0, 528, 150, 1, 0, 0, 0, 529, 530, 5, 40, 0, 0, 530, 152, 1, 0, 0, 0, 531, 532, 5, 41, 0, 0, 532, 154, 1, 0, 0, 0, 533, 534, 5, 59, 0, 0, 534, 156, 1, 0, 0, 0, 535, 536, 5, 44, 0, 0, 536, 158, 1, 0, 0, 0, 537, 538, 5, 63, 0, 0, 538, 160, 1, 0, 0, 0, 539, 540, 5, 58, 0, 0, 540, 162, 1, 0, 0, 0, 541, 542, 5, 39, 0, 0, 542, 164, 1, 0, 0, 0, 543, 545, 5, 45, 0, 0, 544, 543, 1, 0, 0, 0, 544, 545, 1, 0, 0, 0, 545, 546, 1, 0, 0, 0, 546, 547, 3, 177, 88, 0, 547, 166, 1, 0, 0, 0, 548, 553, 7, 26, 0, 0, 549, 552, 7, 26, 0, 0, 550, 552, 3, 179, 89, 0, 551, 549, 1, 0, 0, 0, 551, 550, 1, 0, 0, 0, 552, 555, 1, 0, 0, 0, 553, 551, 1, 0, 0, 0, 553, 554, 1, 0, 0, 0, 554, 168, 1, 0, 0, 0, 555, 553, 1, 0, 0, 0, 556, 557, 5, 47, 0, 0, 557, 558, 5, 47, 0, 0, 558, 562, 1, 0, 0, 0, 559, 561, 8, 27, 0, 0, 560, 559, 1, 0, 0, 0, 561, 564, 1, 0, 0, 0, 562, 560, 1, 0, 0, 0, 562, 563, 1, 0, 0, 0, 563, 565, 1, 0, 0, 0, 564, 562, 1, 0, 0, 0, 565, 566, 6, 84, 0, 0, 566, 170, 1, 0, 0, 0, 567, 568, 5, 47, 0, 0, 568, 569, 5, 42, 0, 0, 569, 592, 1, 0, 0, 0, 570, 572, 5, 47, 0, 0, 571, 570, 1, 0, 0, 0, 572, 575, 1, 0, 0, 0, 573, 571, 1, 0, 0, 0, 573, 574, 1, 0, 0, 0, 574, 576, 1, 0, 0, 0, 575, 573, 1, 0, 0, 0, 576, 591, 3, 171, 85, 0, 577, 591, 8, 28, 0, 0, 578, 580, 5, 47, 0, 0, 579, 578, 1, 0, 0, 0, 580, 581, 1, 0, 0, 0, 581, 579, 1, 0, 0, 0, 581, 582, 1, 0, 0, 0, 582, 583, 1, 0, 0, 0, 583, 591, 8, 28, 0, 0, 584, 586, 5, 42, 0, 0, 585, 584, 1, 0, 0, 0, 586, 587, 1, 0, 0, 0, 587, 585, 1, 0, 0, 0, 587, 588, 1, 0, 0, 0, 588, 589, 1, 0, 0, 0, 589, 591, 8, 28, 0, 0, 590, 573, 1, 0, 0, 0, 590, 577, 1, 0, 0, 0, 590, 579, 1, 0, 0, 0, 590, 585, 1, 0, 0, 0, 591, 594, 1, 0, 0, 0, 592, 590, 1, 0, 0, 0, 592, 593, 1, 0, 0, 0, 593, 598, 1, 0, 0, 0, 594, 592, 1, 0, 0, 0, 595, 597, 5, 42, 0, 0, 596, 595, 1, 0, 0, 0, 597, 600, 1, 0, 0, 0, 598, 596, 1, 0, 0, 0, 598, 599, 1, 0, 0, 0, 599, 601, 1, 0, 0, 0, 600, 598, 1, 0, 0, 0, 601, 602, 5, 42, 0, 0, 602, 603, 5, 47, 0, 0, 603, 604, 1, 0, 0, 0, 604, 605, 6, 85, 0, 0, 605, 172, 1, 0, 0, 0, 606, 608, 7, 29, 0, 0, 607, 606, 1, 0, 0, 0, 608, 609, 1, 0, 0, 0, 609, 607, 1, 0, 0, 0, 609, 610, 1, 0, 0, 0, 610, 611, 1, 0, 0, 0, 611, 612, 6, 86, 0, 0, 612, 174, 1, 0, 0, 0, 613, 615, 5, 13, 0, 0, 614, 616, 5, 10, 0, 0, 615, 614, 1, 0, 0, 0, 615, 616, 1, 0, 0, 0, 616, 619, 1, 0, 0, 0, 617, 619, 5, 10, 0, 0, 618, 613, 1, 0, 0, 0, 618, 617, 1, 0, 0, 0, 619, 176, 1, 0, 0, 0, 620, 624, 2, 49, 57, 0, 621, 623, 3, 179, 89, 0, 622, 621, 1, 0, 0, 0, 623, 626, 1, 0, 0, 0, 624, 622, 1, 0, 0, 0, 624, 625, 1, 0, 0, 0, 625, 629, 1, 0, 0, 0, 626, 624, 1, 0, 0, 0, 627, 629, 5, 48, 0, 0, 628, 620, 1, 0, 0, 0, 628, 627, 1, 0, 0, 0, 629, 178, 1, 0, 0, 0, 630, 631, 2, 48, 57, 0, 631, 180, 1, 0, 0, 0, 16, 0, 544, 551, 553, 562, 573, 581, 587, 590, 592, 598, 609, 615, 618, 624, 628, 1, 0, 1, 0] \ No newline at end of file diff --git a/src/substrait/gen/antlr/SubstraitTypeLexer.py b/src/substrait/gen/antlr/SubstraitTypeLexer.py new file mode 100644 index 0000000..3fb17be --- /dev/null +++ b/src/substrait/gen/antlr/SubstraitTypeLexer.py @@ -0,0 +1,353 @@ +# Generated from SubstraitType.g4 by ANTLR 4.13.1 +from antlr4 import * +from io import StringIO +import sys +if sys.version_info[1] > 5: + from typing import TextIO +else: + from typing.io import TextIO + + +def serializedATN(): + return [ + 4,0,62,632,6,-1,2,0,7,0,2,1,7,1,2,2,7,2,2,3,7,3,2,4,7,4,2,5,7,5, + 2,6,7,6,2,7,7,7,2,8,7,8,2,9,7,9,2,10,7,10,2,11,7,11,2,12,7,12,2, + 13,7,13,2,14,7,14,2,15,7,15,2,16,7,16,2,17,7,17,2,18,7,18,2,19,7, + 19,2,20,7,20,2,21,7,21,2,22,7,22,2,23,7,23,2,24,7,24,2,25,7,25,2, + 26,7,26,2,27,7,27,2,28,7,28,2,29,7,29,2,30,7,30,2,31,7,31,2,32,7, + 32,2,33,7,33,2,34,7,34,2,35,7,35,2,36,7,36,2,37,7,37,2,38,7,38,2, + 39,7,39,2,40,7,40,2,41,7,41,2,42,7,42,2,43,7,43,2,44,7,44,2,45,7, + 45,2,46,7,46,2,47,7,47,2,48,7,48,2,49,7,49,2,50,7,50,2,51,7,51,2, + 52,7,52,2,53,7,53,2,54,7,54,2,55,7,55,2,56,7,56,2,57,7,57,2,58,7, + 58,2,59,7,59,2,60,7,60,2,61,7,61,2,62,7,62,2,63,7,63,2,64,7,64,2, + 65,7,65,2,66,7,66,2,67,7,67,2,68,7,68,2,69,7,69,2,70,7,70,2,71,7, + 71,2,72,7,72,2,73,7,73,2,74,7,74,2,75,7,75,2,76,7,76,2,77,7,77,2, + 78,7,78,2,79,7,79,2,80,7,80,2,81,7,81,2,82,7,82,2,83,7,83,2,84,7, + 84,2,85,7,85,2,86,7,86,2,87,7,87,2,88,7,88,2,89,7,89,1,0,1,0,1,1, + 1,1,1,2,1,2,1,3,1,3,1,4,1,4,1,5,1,5,1,6,1,6,1,7,1,7,1,8,1,8,1,9, + 1,9,1,10,1,10,1,11,1,11,1,12,1,12,1,13,1,13,1,14,1,14,1,15,1,15, + 1,16,1,16,1,17,1,17,1,18,1,18,1,19,1,19,1,20,1,20,1,21,1,21,1,22, + 1,22,1,23,1,23,1,24,1,24,1,25,1,25,1,26,1,26,1,26,1,27,1,27,1,27, + 1,27,1,27,1,28,1,28,1,28,1,28,1,28,1,29,1,29,1,29,1,29,1,29,1,29, + 1,29,1,29,1,30,1,30,1,30,1,31,1,31,1,31,1,31,1,32,1,32,1,32,1,32, + 1,33,1,33,1,33,1,33,1,34,1,34,1,34,1,34,1,34,1,35,1,35,1,35,1,35, + 1,35,1,36,1,36,1,36,1,36,1,36,1,36,1,36,1,37,1,37,1,37,1,37,1,37, + 1,37,1,37,1,38,1,38,1,38,1,38,1,38,1,38,1,38,1,38,1,38,1,38,1,39, + 1,39,1,39,1,39,1,39,1,39,1,39,1,39,1,39,1,39,1,39,1,39,1,39,1,40, + 1,40,1,40,1,40,1,40,1,41,1,41,1,41,1,41,1,41,1,42,1,42,1,42,1,42, + 1,42,1,42,1,42,1,42,1,42,1,42,1,42,1,42,1,42,1,42,1,43,1,43,1,43, + 1,43,1,43,1,43,1,43,1,43,1,43,1,43,1,43,1,43,1,43,1,44,1,44,1,44, + 1,44,1,44,1,44,1,44,1,44,1,44,1,44,1,44,1,44,1,44,1,44,1,44,1,44, + 1,44,1,44,1,45,1,45,1,45,1,45,1,45,1,46,1,46,1,46,1,46,1,46,1,46, + 1,46,1,46,1,47,1,47,1,47,1,47,1,47,1,47,1,47,1,47,1,47,1,47,1,47, + 1,47,1,47,1,47,1,47,1,47,1,47,1,47,1,47,1,47,1,48,1,48,1,48,1,48, + 1,48,1,48,1,48,1,48,1,48,1,48,1,48,1,48,1,48,1,48,1,48,1,48,1,48, + 1,48,1,48,1,48,1,48,1,48,1,48,1,49,1,49,1,49,1,49,1,49,1,49,1,49, + 1,49,1,49,1,49,1,50,1,50,1,50,1,50,1,50,1,50,1,50,1,50,1,51,1,51, + 1,51,1,51,1,51,1,51,1,51,1,51,1,51,1,51,1,51,1,51,1,52,1,52,1,52, + 1,52,1,52,1,52,1,52,1,53,1,53,1,53,1,53,1,53,1,53,1,53,1,53,1,54, + 1,54,1,54,1,54,1,54,1,55,1,55,1,55,1,55,1,56,1,56,1,56,1,56,1,57, + 1,57,1,57,1,58,1,58,1,58,1,58,1,59,1,59,1,59,1,60,1,60,1,60,1,61, + 1,61,1,62,1,62,1,62,1,63,1,63,1,63,1,64,1,64,1,64,1,65,1,65,1,66, + 1,66,1,67,1,67,1,68,1,68,1,69,1,69,1,70,1,70,1,71,1,71,1,72,1,72, + 1,73,1,73,1,74,1,74,1,75,1,75,1,76,1,76,1,77,1,77,1,78,1,78,1,79, + 1,79,1,80,1,80,1,81,1,81,1,82,3,82,545,8,82,1,82,1,82,1,83,1,83, + 1,83,5,83,552,8,83,10,83,12,83,555,9,83,1,84,1,84,1,84,1,84,5,84, + 561,8,84,10,84,12,84,564,9,84,1,84,1,84,1,85,1,85,1,85,1,85,5,85, + 572,8,85,10,85,12,85,575,9,85,1,85,1,85,1,85,4,85,580,8,85,11,85, + 12,85,581,1,85,1,85,4,85,586,8,85,11,85,12,85,587,1,85,5,85,591, + 8,85,10,85,12,85,594,9,85,1,85,5,85,597,8,85,10,85,12,85,600,9,85, + 1,85,1,85,1,85,1,85,1,85,1,86,4,86,608,8,86,11,86,12,86,609,1,86, + 1,86,1,87,1,87,3,87,616,8,87,1,87,3,87,619,8,87,1,88,1,88,5,88,623, + 8,88,10,88,12,88,626,9,88,1,88,3,88,629,8,88,1,89,1,89,0,0,90,1, + 0,3,0,5,0,7,0,9,0,11,0,13,0,15,0,17,0,19,0,21,0,23,0,25,0,27,0,29, + 0,31,0,33,0,35,0,37,0,39,0,41,0,43,0,45,0,47,0,49,0,51,0,53,1,55, + 2,57,3,59,4,61,5,63,6,65,7,67,8,69,9,71,10,73,11,75,12,77,13,79, + 14,81,15,83,16,85,17,87,18,89,19,91,20,93,21,95,22,97,23,99,24,101, + 25,103,26,105,27,107,28,109,29,111,30,113,31,115,32,117,33,119,34, + 121,35,123,36,125,37,127,38,129,39,131,40,133,41,135,42,137,43,139, + 44,141,45,143,46,145,47,147,48,149,49,151,50,153,51,155,52,157,53, + 159,54,161,55,163,56,165,57,167,58,169,59,171,60,173,61,175,62,177, + 0,179,0,1,0,30,2,0,65,65,97,97,2,0,66,66,98,98,2,0,67,67,99,99,2, + 0,68,68,100,100,2,0,69,69,101,101,2,0,70,70,102,102,2,0,71,71,103, + 103,2,0,72,72,104,104,2,0,73,73,105,105,2,0,74,74,106,106,2,0,75, + 75,107,107,2,0,76,76,108,108,2,0,77,77,109,109,2,0,78,78,110,110, + 2,0,79,79,111,111,2,0,80,80,112,112,2,0,81,81,113,113,2,0,82,82, + 114,114,2,0,83,83,115,115,2,0,84,84,116,116,2,0,85,85,117,117,2, + 0,86,86,118,118,2,0,87,87,119,119,2,0,88,88,120,120,2,0,89,89,121, + 121,2,0,90,90,122,122,4,0,36,36,65,90,95,95,97,122,2,0,10,10,13, + 13,2,0,42,42,47,47,2,0,9,9,32,32,620,0,53,1,0,0,0,0,55,1,0,0,0,0, + 57,1,0,0,0,0,59,1,0,0,0,0,61,1,0,0,0,0,63,1,0,0,0,0,65,1,0,0,0,0, + 67,1,0,0,0,0,69,1,0,0,0,0,71,1,0,0,0,0,73,1,0,0,0,0,75,1,0,0,0,0, + 77,1,0,0,0,0,79,1,0,0,0,0,81,1,0,0,0,0,83,1,0,0,0,0,85,1,0,0,0,0, + 87,1,0,0,0,0,89,1,0,0,0,0,91,1,0,0,0,0,93,1,0,0,0,0,95,1,0,0,0,0, + 97,1,0,0,0,0,99,1,0,0,0,0,101,1,0,0,0,0,103,1,0,0,0,0,105,1,0,0, + 0,0,107,1,0,0,0,0,109,1,0,0,0,0,111,1,0,0,0,0,113,1,0,0,0,0,115, + 1,0,0,0,0,117,1,0,0,0,0,119,1,0,0,0,0,121,1,0,0,0,0,123,1,0,0,0, + 0,125,1,0,0,0,0,127,1,0,0,0,0,129,1,0,0,0,0,131,1,0,0,0,0,133,1, + 0,0,0,0,135,1,0,0,0,0,137,1,0,0,0,0,139,1,0,0,0,0,141,1,0,0,0,0, + 143,1,0,0,0,0,145,1,0,0,0,0,147,1,0,0,0,0,149,1,0,0,0,0,151,1,0, + 0,0,0,153,1,0,0,0,0,155,1,0,0,0,0,157,1,0,0,0,0,159,1,0,0,0,0,161, + 1,0,0,0,0,163,1,0,0,0,0,165,1,0,0,0,0,167,1,0,0,0,0,169,1,0,0,0, + 0,171,1,0,0,0,0,173,1,0,0,0,0,175,1,0,0,0,1,181,1,0,0,0,3,183,1, + 0,0,0,5,185,1,0,0,0,7,187,1,0,0,0,9,189,1,0,0,0,11,191,1,0,0,0,13, + 193,1,0,0,0,15,195,1,0,0,0,17,197,1,0,0,0,19,199,1,0,0,0,21,201, + 1,0,0,0,23,203,1,0,0,0,25,205,1,0,0,0,27,207,1,0,0,0,29,209,1,0, + 0,0,31,211,1,0,0,0,33,213,1,0,0,0,35,215,1,0,0,0,37,217,1,0,0,0, + 39,219,1,0,0,0,41,221,1,0,0,0,43,223,1,0,0,0,45,225,1,0,0,0,47,227, + 1,0,0,0,49,229,1,0,0,0,51,231,1,0,0,0,53,233,1,0,0,0,55,236,1,0, + 0,0,57,241,1,0,0,0,59,246,1,0,0,0,61,254,1,0,0,0,63,257,1,0,0,0, + 65,261,1,0,0,0,67,265,1,0,0,0,69,269,1,0,0,0,71,274,1,0,0,0,73,279, + 1,0,0,0,75,286,1,0,0,0,77,293,1,0,0,0,79,303,1,0,0,0,81,316,1,0, + 0,0,83,321,1,0,0,0,85,326,1,0,0,0,87,340,1,0,0,0,89,353,1,0,0,0, + 91,371,1,0,0,0,93,376,1,0,0,0,95,384,1,0,0,0,97,404,1,0,0,0,99,427, + 1,0,0,0,101,437,1,0,0,0,103,445,1,0,0,0,105,457,1,0,0,0,107,464, + 1,0,0,0,109,472,1,0,0,0,111,477,1,0,0,0,113,481,1,0,0,0,115,485, + 1,0,0,0,117,488,1,0,0,0,119,492,1,0,0,0,121,495,1,0,0,0,123,498, + 1,0,0,0,125,500,1,0,0,0,127,503,1,0,0,0,129,506,1,0,0,0,131,509, + 1,0,0,0,133,511,1,0,0,0,135,513,1,0,0,0,137,515,1,0,0,0,139,517, + 1,0,0,0,141,519,1,0,0,0,143,521,1,0,0,0,145,523,1,0,0,0,147,525, + 1,0,0,0,149,527,1,0,0,0,151,529,1,0,0,0,153,531,1,0,0,0,155,533, + 1,0,0,0,157,535,1,0,0,0,159,537,1,0,0,0,161,539,1,0,0,0,163,541, + 1,0,0,0,165,544,1,0,0,0,167,548,1,0,0,0,169,556,1,0,0,0,171,567, + 1,0,0,0,173,607,1,0,0,0,175,618,1,0,0,0,177,628,1,0,0,0,179,630, + 1,0,0,0,181,182,7,0,0,0,182,2,1,0,0,0,183,184,7,1,0,0,184,4,1,0, + 0,0,185,186,7,2,0,0,186,6,1,0,0,0,187,188,7,3,0,0,188,8,1,0,0,0, + 189,190,7,4,0,0,190,10,1,0,0,0,191,192,7,5,0,0,192,12,1,0,0,0,193, + 194,7,6,0,0,194,14,1,0,0,0,195,196,7,7,0,0,196,16,1,0,0,0,197,198, + 7,8,0,0,198,18,1,0,0,0,199,200,7,9,0,0,200,20,1,0,0,0,201,202,7, + 10,0,0,202,22,1,0,0,0,203,204,7,11,0,0,204,24,1,0,0,0,205,206,7, + 12,0,0,206,26,1,0,0,0,207,208,7,13,0,0,208,28,1,0,0,0,209,210,7, + 14,0,0,210,30,1,0,0,0,211,212,7,15,0,0,212,32,1,0,0,0,213,214,7, + 16,0,0,214,34,1,0,0,0,215,216,7,17,0,0,216,36,1,0,0,0,217,218,7, + 18,0,0,218,38,1,0,0,0,219,220,7,19,0,0,220,40,1,0,0,0,221,222,7, + 20,0,0,222,42,1,0,0,0,223,224,7,21,0,0,224,44,1,0,0,0,225,226,7, + 22,0,0,226,46,1,0,0,0,227,228,7,23,0,0,228,48,1,0,0,0,229,230,7, + 24,0,0,230,50,1,0,0,0,231,232,7,25,0,0,232,52,1,0,0,0,233,234,3, + 17,8,0,234,235,3,11,5,0,235,54,1,0,0,0,236,237,3,39,19,0,237,238, + 3,15,7,0,238,239,3,9,4,0,239,240,3,27,13,0,240,56,1,0,0,0,241,242, + 3,9,4,0,242,243,3,23,11,0,243,244,3,37,18,0,244,245,3,9,4,0,245, + 58,1,0,0,0,246,247,3,3,1,0,247,248,3,29,14,0,248,249,3,29,14,0,249, + 250,3,23,11,0,250,251,3,9,4,0,251,252,3,1,0,0,252,253,3,27,13,0, + 253,60,1,0,0,0,254,255,3,17,8,0,255,256,5,56,0,0,256,62,1,0,0,0, + 257,258,3,17,8,0,258,259,5,49,0,0,259,260,5,54,0,0,260,64,1,0,0, + 0,261,262,3,17,8,0,262,263,5,51,0,0,263,264,5,50,0,0,264,66,1,0, + 0,0,265,266,3,17,8,0,266,267,5,54,0,0,267,268,5,52,0,0,268,68,1, + 0,0,0,269,270,3,11,5,0,270,271,3,31,15,0,271,272,5,51,0,0,272,273, + 5,50,0,0,273,70,1,0,0,0,274,275,3,11,5,0,275,276,3,31,15,0,276,277, + 5,54,0,0,277,278,5,52,0,0,278,72,1,0,0,0,279,280,3,37,18,0,280,281, + 3,39,19,0,281,282,3,35,17,0,282,283,3,17,8,0,283,284,3,27,13,0,284, + 285,3,13,6,0,285,74,1,0,0,0,286,287,3,3,1,0,287,288,3,17,8,0,288, + 289,3,27,13,0,289,290,3,1,0,0,290,291,3,35,17,0,291,292,3,49,24, + 0,292,76,1,0,0,0,293,294,3,39,19,0,294,295,3,17,8,0,295,296,3,25, + 12,0,296,297,3,9,4,0,297,298,3,37,18,0,298,299,3,39,19,0,299,300, + 3,1,0,0,300,301,3,25,12,0,301,302,3,31,15,0,302,78,1,0,0,0,303,304, + 3,39,19,0,304,305,3,17,8,0,305,306,3,25,12,0,306,307,3,9,4,0,307, + 308,3,37,18,0,308,309,3,39,19,0,309,310,3,1,0,0,310,311,3,25,12, + 0,311,312,3,31,15,0,312,313,5,95,0,0,313,314,3,39,19,0,314,315,3, + 51,25,0,315,80,1,0,0,0,316,317,3,7,3,0,317,318,3,1,0,0,318,319,3, + 39,19,0,319,320,3,9,4,0,320,82,1,0,0,0,321,322,3,39,19,0,322,323, + 3,17,8,0,323,324,3,25,12,0,324,325,3,9,4,0,325,84,1,0,0,0,326,327, + 3,17,8,0,327,328,3,27,13,0,328,329,3,39,19,0,329,330,3,9,4,0,330, + 331,3,35,17,0,331,332,3,43,21,0,332,333,3,1,0,0,333,334,3,23,11, + 0,334,335,5,95,0,0,335,336,3,49,24,0,336,337,3,9,4,0,337,338,3,1, + 0,0,338,339,3,35,17,0,339,86,1,0,0,0,340,341,3,17,8,0,341,342,3, + 27,13,0,342,343,3,39,19,0,343,344,3,9,4,0,344,345,3,35,17,0,345, + 346,3,43,21,0,346,347,3,1,0,0,347,348,3,23,11,0,348,349,5,95,0,0, + 349,350,3,7,3,0,350,351,3,1,0,0,351,352,3,49,24,0,352,88,1,0,0,0, + 353,354,3,17,8,0,354,355,3,27,13,0,355,356,3,39,19,0,356,357,3,9, + 4,0,357,358,3,35,17,0,358,359,3,43,21,0,359,360,3,1,0,0,360,361, + 3,23,11,0,361,362,5,95,0,0,362,363,3,5,2,0,363,364,3,29,14,0,364, + 365,3,25,12,0,365,366,3,31,15,0,366,367,3,29,14,0,367,368,3,41,20, + 0,368,369,3,27,13,0,369,370,3,7,3,0,370,90,1,0,0,0,371,372,3,41, + 20,0,372,373,3,41,20,0,373,374,3,17,8,0,374,375,3,7,3,0,375,92,1, + 0,0,0,376,377,3,7,3,0,377,378,3,9,4,0,378,379,3,5,2,0,379,380,3, + 17,8,0,380,381,3,25,12,0,381,382,3,1,0,0,382,383,3,23,11,0,383,94, + 1,0,0,0,384,385,3,31,15,0,385,386,3,35,17,0,386,387,3,9,4,0,387, + 388,3,5,2,0,388,389,3,17,8,0,389,390,3,37,18,0,390,391,3,17,8,0, + 391,392,3,29,14,0,392,393,3,27,13,0,393,394,5,95,0,0,394,395,3,39, + 19,0,395,396,3,17,8,0,396,397,3,25,12,0,397,398,3,9,4,0,398,399, + 3,37,18,0,399,400,3,39,19,0,400,401,3,1,0,0,401,402,3,25,12,0,402, + 403,3,31,15,0,403,96,1,0,0,0,404,405,3,31,15,0,405,406,3,35,17,0, + 406,407,3,9,4,0,407,408,3,5,2,0,408,409,3,17,8,0,409,410,3,37,18, + 0,410,411,3,17,8,0,411,412,3,29,14,0,412,413,3,27,13,0,413,414,5, + 95,0,0,414,415,3,39,19,0,415,416,3,17,8,0,416,417,3,25,12,0,417, + 418,3,9,4,0,418,419,3,37,18,0,419,420,3,39,19,0,420,421,3,1,0,0, + 421,422,3,25,12,0,422,423,3,31,15,0,423,424,5,95,0,0,424,425,3,39, + 19,0,425,426,3,51,25,0,426,98,1,0,0,0,427,428,3,11,5,0,428,429,3, + 17,8,0,429,430,3,47,23,0,430,431,3,9,4,0,431,432,3,7,3,0,432,433, + 3,5,2,0,433,434,3,15,7,0,434,435,3,1,0,0,435,436,3,35,17,0,436,100, + 1,0,0,0,437,438,3,43,21,0,438,439,3,1,0,0,439,440,3,35,17,0,440, + 441,3,5,2,0,441,442,3,15,7,0,442,443,3,1,0,0,443,444,3,35,17,0,444, + 102,1,0,0,0,445,446,3,11,5,0,446,447,3,17,8,0,447,448,3,47,23,0, + 448,449,3,9,4,0,449,450,3,7,3,0,450,451,3,3,1,0,451,452,3,17,8,0, + 452,453,3,27,13,0,453,454,3,1,0,0,454,455,3,35,17,0,455,456,3,49, + 24,0,456,104,1,0,0,0,457,458,3,37,18,0,458,459,3,39,19,0,459,460, + 3,35,17,0,460,461,3,41,20,0,461,462,3,5,2,0,462,463,3,39,19,0,463, + 106,1,0,0,0,464,465,3,27,13,0,465,466,3,37,18,0,466,467,3,39,19, + 0,467,468,3,35,17,0,468,469,3,41,20,0,469,470,3,5,2,0,470,471,3, + 39,19,0,471,108,1,0,0,0,472,473,3,23,11,0,473,474,3,17,8,0,474,475, + 3,37,18,0,475,476,3,39,19,0,476,110,1,0,0,0,477,478,3,25,12,0,478, + 479,3,1,0,0,479,480,3,31,15,0,480,112,1,0,0,0,481,482,3,1,0,0,482, + 483,3,27,13,0,483,484,3,49,24,0,484,114,1,0,0,0,485,486,3,41,20, + 0,486,487,5,33,0,0,487,116,1,0,0,0,488,489,3,1,0,0,489,490,3,27, + 13,0,490,491,3,7,3,0,491,118,1,0,0,0,492,493,3,29,14,0,493,494,3, + 35,17,0,494,120,1,0,0,0,495,496,5,58,0,0,496,497,5,61,0,0,497,122, + 1,0,0,0,498,499,5,61,0,0,499,124,1,0,0,0,500,501,5,33,0,0,501,502, + 5,61,0,0,502,126,1,0,0,0,503,504,5,62,0,0,504,505,5,61,0,0,505,128, + 1,0,0,0,506,507,5,60,0,0,507,508,5,61,0,0,508,130,1,0,0,0,509,510, + 5,62,0,0,510,132,1,0,0,0,511,512,5,60,0,0,512,134,1,0,0,0,513,514, + 5,33,0,0,514,136,1,0,0,0,515,516,5,43,0,0,516,138,1,0,0,0,517,518, + 5,45,0,0,518,140,1,0,0,0,519,520,5,42,0,0,520,142,1,0,0,0,521,522, + 5,47,0,0,522,144,1,0,0,0,523,524,5,37,0,0,524,146,1,0,0,0,525,526, + 5,91,0,0,526,148,1,0,0,0,527,528,5,93,0,0,528,150,1,0,0,0,529,530, + 5,40,0,0,530,152,1,0,0,0,531,532,5,41,0,0,532,154,1,0,0,0,533,534, + 5,59,0,0,534,156,1,0,0,0,535,536,5,44,0,0,536,158,1,0,0,0,537,538, + 5,63,0,0,538,160,1,0,0,0,539,540,5,58,0,0,540,162,1,0,0,0,541,542, + 5,39,0,0,542,164,1,0,0,0,543,545,5,45,0,0,544,543,1,0,0,0,544,545, + 1,0,0,0,545,546,1,0,0,0,546,547,3,177,88,0,547,166,1,0,0,0,548,553, + 7,26,0,0,549,552,7,26,0,0,550,552,3,179,89,0,551,549,1,0,0,0,551, + 550,1,0,0,0,552,555,1,0,0,0,553,551,1,0,0,0,553,554,1,0,0,0,554, + 168,1,0,0,0,555,553,1,0,0,0,556,557,5,47,0,0,557,558,5,47,0,0,558, + 562,1,0,0,0,559,561,8,27,0,0,560,559,1,0,0,0,561,564,1,0,0,0,562, + 560,1,0,0,0,562,563,1,0,0,0,563,565,1,0,0,0,564,562,1,0,0,0,565, + 566,6,84,0,0,566,170,1,0,0,0,567,568,5,47,0,0,568,569,5,42,0,0,569, + 592,1,0,0,0,570,572,5,47,0,0,571,570,1,0,0,0,572,575,1,0,0,0,573, + 571,1,0,0,0,573,574,1,0,0,0,574,576,1,0,0,0,575,573,1,0,0,0,576, + 591,3,171,85,0,577,591,8,28,0,0,578,580,5,47,0,0,579,578,1,0,0,0, + 580,581,1,0,0,0,581,579,1,0,0,0,581,582,1,0,0,0,582,583,1,0,0,0, + 583,591,8,28,0,0,584,586,5,42,0,0,585,584,1,0,0,0,586,587,1,0,0, + 0,587,585,1,0,0,0,587,588,1,0,0,0,588,589,1,0,0,0,589,591,8,28,0, + 0,590,573,1,0,0,0,590,577,1,0,0,0,590,579,1,0,0,0,590,585,1,0,0, + 0,591,594,1,0,0,0,592,590,1,0,0,0,592,593,1,0,0,0,593,598,1,0,0, + 0,594,592,1,0,0,0,595,597,5,42,0,0,596,595,1,0,0,0,597,600,1,0,0, + 0,598,596,1,0,0,0,598,599,1,0,0,0,599,601,1,0,0,0,600,598,1,0,0, + 0,601,602,5,42,0,0,602,603,5,47,0,0,603,604,1,0,0,0,604,605,6,85, + 0,0,605,172,1,0,0,0,606,608,7,29,0,0,607,606,1,0,0,0,608,609,1,0, + 0,0,609,607,1,0,0,0,609,610,1,0,0,0,610,611,1,0,0,0,611,612,6,86, + 0,0,612,174,1,0,0,0,613,615,5,13,0,0,614,616,5,10,0,0,615,614,1, + 0,0,0,615,616,1,0,0,0,616,619,1,0,0,0,617,619,5,10,0,0,618,613,1, + 0,0,0,618,617,1,0,0,0,619,176,1,0,0,0,620,624,2,49,57,0,621,623, + 3,179,89,0,622,621,1,0,0,0,623,626,1,0,0,0,624,622,1,0,0,0,624,625, + 1,0,0,0,625,629,1,0,0,0,626,624,1,0,0,0,627,629,5,48,0,0,628,620, + 1,0,0,0,628,627,1,0,0,0,629,178,1,0,0,0,630,631,2,48,57,0,631,180, + 1,0,0,0,16,0,544,551,553,562,573,581,587,590,592,598,609,615,618, + 624,628,1,0,1,0 + ] + +class SubstraitTypeLexer(Lexer): + + atn = ATNDeserializer().deserialize(serializedATN()) + + decisionsToDFA = [ DFA(ds, i) for i, ds in enumerate(atn.decisionToState) ] + + If = 1 + Then = 2 + Else = 3 + Boolean = 4 + I8 = 5 + I16 = 6 + I32 = 7 + I64 = 8 + FP32 = 9 + FP64 = 10 + String = 11 + Binary = 12 + Timestamp = 13 + TimestampTZ = 14 + Date = 15 + Time = 16 + IntervalYear = 17 + IntervalDay = 18 + IntervalCompound = 19 + UUID = 20 + Decimal = 21 + PrecisionTimestamp = 22 + PrecisionTimestampTZ = 23 + FixedChar = 24 + VarChar = 25 + FixedBinary = 26 + Struct = 27 + NStruct = 28 + List = 29 + Map = 30 + ANY = 31 + UserDefined = 32 + And = 33 + Or = 34 + Assign = 35 + Eq = 36 + NotEquals = 37 + Gte = 38 + Lte = 39 + Gt = 40 + Lt = 41 + Bang = 42 + Plus = 43 + Minus = 44 + Asterisk = 45 + ForwardSlash = 46 + Percent = 47 + OBracket = 48 + CBracket = 49 + OParen = 50 + CParen = 51 + SColon = 52 + Comma = 53 + QMark = 54 + Colon = 55 + SingleQuote = 56 + Number = 57 + Identifier = 58 + LineComment = 59 + BlockComment = 60 + Whitespace = 61 + Newline = 62 + + channelNames = [ u"DEFAULT_TOKEN_CHANNEL", u"HIDDEN" ] + + modeNames = [ "DEFAULT_MODE" ] + + literalNames = [ "", + "':='", "'='", "'!='", "'>='", "'<='", "'>'", "'<'", "'!'", + "'+'", "'-'", "'*'", "'/'", "'%'", "'['", "']'", "'('", "')'", + "';'", "','", "'?'", "':'", "'''" ] + + symbolicNames = [ "", + "If", "Then", "Else", "Boolean", "I8", "I16", "I32", "I64", + "FP32", "FP64", "String", "Binary", "Timestamp", "TimestampTZ", + "Date", "Time", "IntervalYear", "IntervalDay", "IntervalCompound", + "UUID", "Decimal", "PrecisionTimestamp", "PrecisionTimestampTZ", + "FixedChar", "VarChar", "FixedBinary", "Struct", "NStruct", + "List", "Map", "ANY", "UserDefined", "And", "Or", "Assign", + "Eq", "NotEquals", "Gte", "Lte", "Gt", "Lt", "Bang", "Plus", + "Minus", "Asterisk", "ForwardSlash", "Percent", "OBracket", + "CBracket", "OParen", "CParen", "SColon", "Comma", "QMark", + "Colon", "SingleQuote", "Number", "Identifier", "LineComment", + "BlockComment", "Whitespace", "Newline" ] + + ruleNames = [ "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", + "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", + "W", "X", "Y", "Z", "If", "Then", "Else", "Boolean", "I8", + "I16", "I32", "I64", "FP32", "FP64", "String", "Binary", + "Timestamp", "TimestampTZ", "Date", "Time", "IntervalYear", + "IntervalDay", "IntervalCompound", "UUID", "Decimal", + "PrecisionTimestamp", "PrecisionTimestampTZ", "FixedChar", + "VarChar", "FixedBinary", "Struct", "NStruct", "List", + "Map", "ANY", "UserDefined", "And", "Or", "Assign", "Eq", + "NotEquals", "Gte", "Lte", "Gt", "Lt", "Bang", "Plus", + "Minus", "Asterisk", "ForwardSlash", "Percent", "OBracket", + "CBracket", "OParen", "CParen", "SColon", "Comma", "QMark", + "Colon", "SingleQuote", "Number", "Identifier", "LineComment", + "BlockComment", "Whitespace", "Newline", "Int", "Digit" ] + + grammarFileName = "SubstraitType.g4" + + def __init__(self, input=None, output:TextIO = sys.stdout): + super().__init__(input, output) + self.checkVersion("4.13.1") + self._interp = LexerATNSimulator(self, self.atn, self.decisionsToDFA, PredictionContextCache()) + self._actions = None + self._predicates = None + + diff --git a/src/substrait/gen/antlr/SubstraitTypeLexer.tokens b/src/substrait/gen/antlr/SubstraitTypeLexer.tokens new file mode 100644 index 0000000..20c69d8 --- /dev/null +++ b/src/substrait/gen/antlr/SubstraitTypeLexer.tokens @@ -0,0 +1,84 @@ +If=1 +Then=2 +Else=3 +Boolean=4 +I8=5 +I16=6 +I32=7 +I64=8 +FP32=9 +FP64=10 +String=11 +Binary=12 +Timestamp=13 +TimestampTZ=14 +Date=15 +Time=16 +IntervalYear=17 +IntervalDay=18 +IntervalCompound=19 +UUID=20 +Decimal=21 +PrecisionTimestamp=22 +PrecisionTimestampTZ=23 +FixedChar=24 +VarChar=25 +FixedBinary=26 +Struct=27 +NStruct=28 +List=29 +Map=30 +ANY=31 +UserDefined=32 +And=33 +Or=34 +Assign=35 +Eq=36 +NotEquals=37 +Gte=38 +Lte=39 +Gt=40 +Lt=41 +Bang=42 +Plus=43 +Minus=44 +Asterisk=45 +ForwardSlash=46 +Percent=47 +OBracket=48 +CBracket=49 +OParen=50 +CParen=51 +SColon=52 +Comma=53 +QMark=54 +Colon=55 +SingleQuote=56 +Number=57 +Identifier=58 +LineComment=59 +BlockComment=60 +Whitespace=61 +Newline=62 +':='=35 +'='=36 +'!='=37 +'>='=38 +'<='=39 +'>'=40 +'<'=41 +'!'=42 +'+'=43 +'-'=44 +'*'=45 +'/'=46 +'%'=47 +'['=48 +']'=49 +'('=50 +')'=51 +';'=52 +','=53 +'?'=54 +':'=55 +'\''=56 diff --git a/src/substrait/gen/antlr/SubstraitTypeListener.py b/src/substrait/gen/antlr/SubstraitTypeListener.py new file mode 100644 index 0000000..29c4d48 --- /dev/null +++ b/src/substrait/gen/antlr/SubstraitTypeListener.py @@ -0,0 +1,408 @@ +# Generated from SubstraitType.g4 by ANTLR 4.13.1 +from antlr4 import * +if "." in __name__: + from .SubstraitTypeParser import SubstraitTypeParser +else: + from SubstraitTypeParser import SubstraitTypeParser + +# This class defines a complete listener for a parse tree produced by SubstraitTypeParser. +class SubstraitTypeListener(ParseTreeListener): + + # Enter a parse tree produced by SubstraitTypeParser#start. + def enterStart(self, ctx:SubstraitTypeParser.StartContext): + pass + + # Exit a parse tree produced by SubstraitTypeParser#start. + def exitStart(self, ctx:SubstraitTypeParser.StartContext): + pass + + + # Enter a parse tree produced by SubstraitTypeParser#Boolean. + def enterBoolean(self, ctx:SubstraitTypeParser.BooleanContext): + pass + + # Exit a parse tree produced by SubstraitTypeParser#Boolean. + def exitBoolean(self, ctx:SubstraitTypeParser.BooleanContext): + pass + + + # Enter a parse tree produced by SubstraitTypeParser#i8. + def enterI8(self, ctx:SubstraitTypeParser.I8Context): + pass + + # Exit a parse tree produced by SubstraitTypeParser#i8. + def exitI8(self, ctx:SubstraitTypeParser.I8Context): + pass + + + # Enter a parse tree produced by SubstraitTypeParser#i16. + def enterI16(self, ctx:SubstraitTypeParser.I16Context): + pass + + # Exit a parse tree produced by SubstraitTypeParser#i16. + def exitI16(self, ctx:SubstraitTypeParser.I16Context): + pass + + + # Enter a parse tree produced by SubstraitTypeParser#i32. + def enterI32(self, ctx:SubstraitTypeParser.I32Context): + pass + + # Exit a parse tree produced by SubstraitTypeParser#i32. + def exitI32(self, ctx:SubstraitTypeParser.I32Context): + pass + + + # Enter a parse tree produced by SubstraitTypeParser#i64. + def enterI64(self, ctx:SubstraitTypeParser.I64Context): + pass + + # Exit a parse tree produced by SubstraitTypeParser#i64. + def exitI64(self, ctx:SubstraitTypeParser.I64Context): + pass + + + # Enter a parse tree produced by SubstraitTypeParser#fp32. + def enterFp32(self, ctx:SubstraitTypeParser.Fp32Context): + pass + + # Exit a parse tree produced by SubstraitTypeParser#fp32. + def exitFp32(self, ctx:SubstraitTypeParser.Fp32Context): + pass + + + # Enter a parse tree produced by SubstraitTypeParser#fp64. + def enterFp64(self, ctx:SubstraitTypeParser.Fp64Context): + pass + + # Exit a parse tree produced by SubstraitTypeParser#fp64. + def exitFp64(self, ctx:SubstraitTypeParser.Fp64Context): + pass + + + # Enter a parse tree produced by SubstraitTypeParser#string. + def enterString(self, ctx:SubstraitTypeParser.StringContext): + pass + + # Exit a parse tree produced by SubstraitTypeParser#string. + def exitString(self, ctx:SubstraitTypeParser.StringContext): + pass + + + # Enter a parse tree produced by SubstraitTypeParser#binary. + def enterBinary(self, ctx:SubstraitTypeParser.BinaryContext): + pass + + # Exit a parse tree produced by SubstraitTypeParser#binary. + def exitBinary(self, ctx:SubstraitTypeParser.BinaryContext): + pass + + + # Enter a parse tree produced by SubstraitTypeParser#timestamp. + def enterTimestamp(self, ctx:SubstraitTypeParser.TimestampContext): + pass + + # Exit a parse tree produced by SubstraitTypeParser#timestamp. + def exitTimestamp(self, ctx:SubstraitTypeParser.TimestampContext): + pass + + + # Enter a parse tree produced by SubstraitTypeParser#timestampTz. + def enterTimestampTz(self, ctx:SubstraitTypeParser.TimestampTzContext): + pass + + # Exit a parse tree produced by SubstraitTypeParser#timestampTz. + def exitTimestampTz(self, ctx:SubstraitTypeParser.TimestampTzContext): + pass + + + # Enter a parse tree produced by SubstraitTypeParser#date. + def enterDate(self, ctx:SubstraitTypeParser.DateContext): + pass + + # Exit a parse tree produced by SubstraitTypeParser#date. + def exitDate(self, ctx:SubstraitTypeParser.DateContext): + pass + + + # Enter a parse tree produced by SubstraitTypeParser#time. + def enterTime(self, ctx:SubstraitTypeParser.TimeContext): + pass + + # Exit a parse tree produced by SubstraitTypeParser#time. + def exitTime(self, ctx:SubstraitTypeParser.TimeContext): + pass + + + # Enter a parse tree produced by SubstraitTypeParser#intervalYear. + def enterIntervalYear(self, ctx:SubstraitTypeParser.IntervalYearContext): + pass + + # Exit a parse tree produced by SubstraitTypeParser#intervalYear. + def exitIntervalYear(self, ctx:SubstraitTypeParser.IntervalYearContext): + pass + + + # Enter a parse tree produced by SubstraitTypeParser#uuid. + def enterUuid(self, ctx:SubstraitTypeParser.UuidContext): + pass + + # Exit a parse tree produced by SubstraitTypeParser#uuid. + def exitUuid(self, ctx:SubstraitTypeParser.UuidContext): + pass + + + # Enter a parse tree produced by SubstraitTypeParser#userDefined. + def enterUserDefined(self, ctx:SubstraitTypeParser.UserDefinedContext): + pass + + # Exit a parse tree produced by SubstraitTypeParser#userDefined. + def exitUserDefined(self, ctx:SubstraitTypeParser.UserDefinedContext): + pass + + + # Enter a parse tree produced by SubstraitTypeParser#fixedChar. + def enterFixedChar(self, ctx:SubstraitTypeParser.FixedCharContext): + pass + + # Exit a parse tree produced by SubstraitTypeParser#fixedChar. + def exitFixedChar(self, ctx:SubstraitTypeParser.FixedCharContext): + pass + + + # Enter a parse tree produced by SubstraitTypeParser#varChar. + def enterVarChar(self, ctx:SubstraitTypeParser.VarCharContext): + pass + + # Exit a parse tree produced by SubstraitTypeParser#varChar. + def exitVarChar(self, ctx:SubstraitTypeParser.VarCharContext): + pass + + + # Enter a parse tree produced by SubstraitTypeParser#fixedBinary. + def enterFixedBinary(self, ctx:SubstraitTypeParser.FixedBinaryContext): + pass + + # Exit a parse tree produced by SubstraitTypeParser#fixedBinary. + def exitFixedBinary(self, ctx:SubstraitTypeParser.FixedBinaryContext): + pass + + + # Enter a parse tree produced by SubstraitTypeParser#decimal. + def enterDecimal(self, ctx:SubstraitTypeParser.DecimalContext): + pass + + # Exit a parse tree produced by SubstraitTypeParser#decimal. + def exitDecimal(self, ctx:SubstraitTypeParser.DecimalContext): + pass + + + # Enter a parse tree produced by SubstraitTypeParser#intervalDay. + def enterIntervalDay(self, ctx:SubstraitTypeParser.IntervalDayContext): + pass + + # Exit a parse tree produced by SubstraitTypeParser#intervalDay. + def exitIntervalDay(self, ctx:SubstraitTypeParser.IntervalDayContext): + pass + + + # Enter a parse tree produced by SubstraitTypeParser#intervalCompound. + def enterIntervalCompound(self, ctx:SubstraitTypeParser.IntervalCompoundContext): + pass + + # Exit a parse tree produced by SubstraitTypeParser#intervalCompound. + def exitIntervalCompound(self, ctx:SubstraitTypeParser.IntervalCompoundContext): + pass + + + # Enter a parse tree produced by SubstraitTypeParser#precisionTimestamp. + def enterPrecisionTimestamp(self, ctx:SubstraitTypeParser.PrecisionTimestampContext): + pass + + # Exit a parse tree produced by SubstraitTypeParser#precisionTimestamp. + def exitPrecisionTimestamp(self, ctx:SubstraitTypeParser.PrecisionTimestampContext): + pass + + + # Enter a parse tree produced by SubstraitTypeParser#precisionTimestampTZ. + def enterPrecisionTimestampTZ(self, ctx:SubstraitTypeParser.PrecisionTimestampTZContext): + pass + + # Exit a parse tree produced by SubstraitTypeParser#precisionTimestampTZ. + def exitPrecisionTimestampTZ(self, ctx:SubstraitTypeParser.PrecisionTimestampTZContext): + pass + + + # Enter a parse tree produced by SubstraitTypeParser#struct. + def enterStruct(self, ctx:SubstraitTypeParser.StructContext): + pass + + # Exit a parse tree produced by SubstraitTypeParser#struct. + def exitStruct(self, ctx:SubstraitTypeParser.StructContext): + pass + + + # Enter a parse tree produced by SubstraitTypeParser#nStruct. + def enterNStruct(self, ctx:SubstraitTypeParser.NStructContext): + pass + + # Exit a parse tree produced by SubstraitTypeParser#nStruct. + def exitNStruct(self, ctx:SubstraitTypeParser.NStructContext): + pass + + + # Enter a parse tree produced by SubstraitTypeParser#list. + def enterList(self, ctx:SubstraitTypeParser.ListContext): + pass + + # Exit a parse tree produced by SubstraitTypeParser#list. + def exitList(self, ctx:SubstraitTypeParser.ListContext): + pass + + + # Enter a parse tree produced by SubstraitTypeParser#map. + def enterMap(self, ctx:SubstraitTypeParser.MapContext): + pass + + # Exit a parse tree produced by SubstraitTypeParser#map. + def exitMap(self, ctx:SubstraitTypeParser.MapContext): + pass + + + # Enter a parse tree produced by SubstraitTypeParser#numericLiteral. + def enterNumericLiteral(self, ctx:SubstraitTypeParser.NumericLiteralContext): + pass + + # Exit a parse tree produced by SubstraitTypeParser#numericLiteral. + def exitNumericLiteral(self, ctx:SubstraitTypeParser.NumericLiteralContext): + pass + + + # Enter a parse tree produced by SubstraitTypeParser#numericParameterName. + def enterNumericParameterName(self, ctx:SubstraitTypeParser.NumericParameterNameContext): + pass + + # Exit a parse tree produced by SubstraitTypeParser#numericParameterName. + def exitNumericParameterName(self, ctx:SubstraitTypeParser.NumericParameterNameContext): + pass + + + # Enter a parse tree produced by SubstraitTypeParser#numericExpression. + def enterNumericExpression(self, ctx:SubstraitTypeParser.NumericExpressionContext): + pass + + # Exit a parse tree produced by SubstraitTypeParser#numericExpression. + def exitNumericExpression(self, ctx:SubstraitTypeParser.NumericExpressionContext): + pass + + + # Enter a parse tree produced by SubstraitTypeParser#anyType. + def enterAnyType(self, ctx:SubstraitTypeParser.AnyTypeContext): + pass + + # Exit a parse tree produced by SubstraitTypeParser#anyType. + def exitAnyType(self, ctx:SubstraitTypeParser.AnyTypeContext): + pass + + + # Enter a parse tree produced by SubstraitTypeParser#type. + def enterType(self, ctx:SubstraitTypeParser.TypeContext): + pass + + # Exit a parse tree produced by SubstraitTypeParser#type. + def exitType(self, ctx:SubstraitTypeParser.TypeContext): + pass + + + # Enter a parse tree produced by SubstraitTypeParser#IfExpr. + def enterIfExpr(self, ctx:SubstraitTypeParser.IfExprContext): + pass + + # Exit a parse tree produced by SubstraitTypeParser#IfExpr. + def exitIfExpr(self, ctx:SubstraitTypeParser.IfExprContext): + pass + + + # Enter a parse tree produced by SubstraitTypeParser#TypeLiteral. + def enterTypeLiteral(self, ctx:SubstraitTypeParser.TypeLiteralContext): + pass + + # Exit a parse tree produced by SubstraitTypeParser#TypeLiteral. + def exitTypeLiteral(self, ctx:SubstraitTypeParser.TypeLiteralContext): + pass + + + # Enter a parse tree produced by SubstraitTypeParser#MultilineDefinition. + def enterMultilineDefinition(self, ctx:SubstraitTypeParser.MultilineDefinitionContext): + pass + + # Exit a parse tree produced by SubstraitTypeParser#MultilineDefinition. + def exitMultilineDefinition(self, ctx:SubstraitTypeParser.MultilineDefinitionContext): + pass + + + # Enter a parse tree produced by SubstraitTypeParser#Ternary. + def enterTernary(self, ctx:SubstraitTypeParser.TernaryContext): + pass + + # Exit a parse tree produced by SubstraitTypeParser#Ternary. + def exitTernary(self, ctx:SubstraitTypeParser.TernaryContext): + pass + + + # Enter a parse tree produced by SubstraitTypeParser#BinaryExpr. + def enterBinaryExpr(self, ctx:SubstraitTypeParser.BinaryExprContext): + pass + + # Exit a parse tree produced by SubstraitTypeParser#BinaryExpr. + def exitBinaryExpr(self, ctx:SubstraitTypeParser.BinaryExprContext): + pass + + + # Enter a parse tree produced by SubstraitTypeParser#TypeParam. + def enterTypeParam(self, ctx:SubstraitTypeParser.TypeParamContext): + pass + + # Exit a parse tree produced by SubstraitTypeParser#TypeParam. + def exitTypeParam(self, ctx:SubstraitTypeParser.TypeParamContext): + pass + + + # Enter a parse tree produced by SubstraitTypeParser#ParenExpression. + def enterParenExpression(self, ctx:SubstraitTypeParser.ParenExpressionContext): + pass + + # Exit a parse tree produced by SubstraitTypeParser#ParenExpression. + def exitParenExpression(self, ctx:SubstraitTypeParser.ParenExpressionContext): + pass + + + # Enter a parse tree produced by SubstraitTypeParser#FunctionCall. + def enterFunctionCall(self, ctx:SubstraitTypeParser.FunctionCallContext): + pass + + # Exit a parse tree produced by SubstraitTypeParser#FunctionCall. + def exitFunctionCall(self, ctx:SubstraitTypeParser.FunctionCallContext): + pass + + + # Enter a parse tree produced by SubstraitTypeParser#NotExpr. + def enterNotExpr(self, ctx:SubstraitTypeParser.NotExprContext): + pass + + # Exit a parse tree produced by SubstraitTypeParser#NotExpr. + def exitNotExpr(self, ctx:SubstraitTypeParser.NotExprContext): + pass + + + # Enter a parse tree produced by SubstraitTypeParser#LiteralNumber. + def enterLiteralNumber(self, ctx:SubstraitTypeParser.LiteralNumberContext): + pass + + # Exit a parse tree produced by SubstraitTypeParser#LiteralNumber. + def exitLiteralNumber(self, ctx:SubstraitTypeParser.LiteralNumberContext): + pass + + + +del SubstraitTypeParser \ No newline at end of file diff --git a/src/substrait/gen/antlr/SubstraitTypeParser.py b/src/substrait/gen/antlr/SubstraitTypeParser.py new file mode 100644 index 0000000..da3a528 --- /dev/null +++ b/src/substrait/gen/antlr/SubstraitTypeParser.py @@ -0,0 +1,2210 @@ +# Generated from SubstraitType.g4 by ANTLR 4.13.1 +# encoding: utf-8 +from antlr4 import * +from io import StringIO +import sys +if sys.version_info[1] > 5: + from typing import TextIO +else: + from typing.io import TextIO + +def serializedATN(): + return [ + 4,1,62,250,2,0,7,0,2,1,7,1,2,2,7,2,2,3,7,3,2,4,7,4,2,5,7,5,2,6,7, + 6,1,0,1,0,1,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, + 1,1,1,1,1,1,1,1,1,3,1,35,8,1,1,2,1,2,3,2,39,8,2,1,2,1,2,1,2,1,2, + 1,2,1,2,3,2,47,8,2,1,2,1,2,1,2,1,2,1,2,1,2,3,2,55,8,2,1,2,1,2,1, + 2,1,2,1,2,1,2,3,2,63,8,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,3,2,73, + 8,2,1,2,1,2,1,2,1,2,1,2,1,2,3,2,81,8,2,1,2,1,2,1,2,1,2,1,2,1,2,3, + 2,89,8,2,1,2,1,2,1,2,1,2,1,2,1,2,3,2,97,8,2,1,2,1,2,1,2,1,2,1,2, + 1,2,3,2,105,8,2,1,2,1,2,1,2,1,2,5,2,111,8,2,10,2,12,2,114,9,2,1, + 2,1,2,1,2,1,2,3,2,120,8,2,1,2,1,2,1,2,1,2,1,2,1,2,5,2,128,8,2,10, + 2,12,2,131,9,2,1,2,1,2,1,2,1,2,3,2,137,8,2,1,2,1,2,1,2,1,2,1,2,1, + 2,3,2,145,8,2,1,2,1,2,1,2,1,2,1,2,1,2,3,2,153,8,2,1,3,1,3,1,3,3, + 3,158,8,3,1,4,1,4,1,5,1,5,3,5,164,8,5,1,5,1,5,1,5,3,5,169,8,5,3, + 5,171,8,5,1,6,1,6,1,6,1,6,1,6,1,6,1,6,1,6,1,6,4,6,182,8,6,11,6,12, + 6,183,1,6,1,6,1,6,1,6,4,6,190,8,6,11,6,12,6,191,5,6,194,8,6,10,6, + 12,6,197,9,6,1,6,1,6,5,6,201,8,6,10,6,12,6,204,9,6,1,6,1,6,1,6,1, + 6,3,6,210,8,6,1,6,1,6,1,6,1,6,1,6,5,6,217,8,6,10,6,12,6,220,9,6, + 3,6,222,8,6,1,6,1,6,1,6,1,6,1,6,1,6,1,6,1,6,1,6,1,6,3,6,234,8,6, + 1,6,1,6,1,6,1,6,1,6,1,6,1,6,1,6,1,6,5,6,245,8,6,10,6,12,6,248,9, + 6,1,6,0,1,12,7,0,2,4,6,8,10,12,0,1,3,0,33,34,36,41,43,46,304,0,14, + 1,0,0,0,2,34,1,0,0,0,4,152,1,0,0,0,6,157,1,0,0,0,8,159,1,0,0,0,10, + 170,1,0,0,0,12,233,1,0,0,0,14,15,3,12,6,0,15,16,5,0,0,1,16,1,1,0, + 0,0,17,35,5,4,0,0,18,35,5,5,0,0,19,35,5,6,0,0,20,35,5,7,0,0,21,35, + 5,8,0,0,22,35,5,9,0,0,23,35,5,10,0,0,24,35,5,11,0,0,25,35,5,12,0, + 0,26,35,5,13,0,0,27,35,5,14,0,0,28,35,5,15,0,0,29,35,5,16,0,0,30, + 35,5,17,0,0,31,35,5,20,0,0,32,33,5,32,0,0,33,35,5,58,0,0,34,17,1, + 0,0,0,34,18,1,0,0,0,34,19,1,0,0,0,34,20,1,0,0,0,34,21,1,0,0,0,34, + 22,1,0,0,0,34,23,1,0,0,0,34,24,1,0,0,0,34,25,1,0,0,0,34,26,1,0,0, + 0,34,27,1,0,0,0,34,28,1,0,0,0,34,29,1,0,0,0,34,30,1,0,0,0,34,31, + 1,0,0,0,34,32,1,0,0,0,35,3,1,0,0,0,36,38,5,24,0,0,37,39,5,54,0,0, + 38,37,1,0,0,0,38,39,1,0,0,0,39,40,1,0,0,0,40,41,5,41,0,0,41,42,3, + 6,3,0,42,43,5,40,0,0,43,153,1,0,0,0,44,46,5,25,0,0,45,47,5,54,0, + 0,46,45,1,0,0,0,46,47,1,0,0,0,47,48,1,0,0,0,48,49,5,41,0,0,49,50, + 3,6,3,0,50,51,5,40,0,0,51,153,1,0,0,0,52,54,5,26,0,0,53,55,5,54, + 0,0,54,53,1,0,0,0,54,55,1,0,0,0,55,56,1,0,0,0,56,57,5,41,0,0,57, + 58,3,6,3,0,58,59,5,40,0,0,59,153,1,0,0,0,60,62,5,21,0,0,61,63,5, + 54,0,0,62,61,1,0,0,0,62,63,1,0,0,0,63,64,1,0,0,0,64,65,5,41,0,0, + 65,66,3,6,3,0,66,67,5,53,0,0,67,68,3,6,3,0,68,69,5,40,0,0,69,153, + 1,0,0,0,70,72,5,18,0,0,71,73,5,54,0,0,72,71,1,0,0,0,72,73,1,0,0, + 0,73,74,1,0,0,0,74,75,5,41,0,0,75,76,3,6,3,0,76,77,5,40,0,0,77,153, + 1,0,0,0,78,80,5,19,0,0,79,81,5,54,0,0,80,79,1,0,0,0,80,81,1,0,0, + 0,81,82,1,0,0,0,82,83,5,41,0,0,83,84,3,6,3,0,84,85,5,40,0,0,85,153, + 1,0,0,0,86,88,5,22,0,0,87,89,5,54,0,0,88,87,1,0,0,0,88,89,1,0,0, + 0,89,90,1,0,0,0,90,91,5,41,0,0,91,92,3,6,3,0,92,93,5,40,0,0,93,153, + 1,0,0,0,94,96,5,23,0,0,95,97,5,54,0,0,96,95,1,0,0,0,96,97,1,0,0, + 0,97,98,1,0,0,0,98,99,5,41,0,0,99,100,3,6,3,0,100,101,5,40,0,0,101, + 153,1,0,0,0,102,104,5,27,0,0,103,105,5,54,0,0,104,103,1,0,0,0,104, + 105,1,0,0,0,105,106,1,0,0,0,106,107,5,41,0,0,107,112,3,12,6,0,108, + 109,5,53,0,0,109,111,3,12,6,0,110,108,1,0,0,0,111,114,1,0,0,0,112, + 110,1,0,0,0,112,113,1,0,0,0,113,115,1,0,0,0,114,112,1,0,0,0,115, + 116,5,40,0,0,116,153,1,0,0,0,117,119,5,28,0,0,118,120,5,54,0,0,119, + 118,1,0,0,0,119,120,1,0,0,0,120,121,1,0,0,0,121,122,5,41,0,0,122, + 123,5,58,0,0,123,129,3,12,6,0,124,125,5,53,0,0,125,126,5,58,0,0, + 126,128,3,12,6,0,127,124,1,0,0,0,128,131,1,0,0,0,129,127,1,0,0,0, + 129,130,1,0,0,0,130,132,1,0,0,0,131,129,1,0,0,0,132,133,5,40,0,0, + 133,153,1,0,0,0,134,136,5,29,0,0,135,137,5,54,0,0,136,135,1,0,0, + 0,136,137,1,0,0,0,137,138,1,0,0,0,138,139,5,41,0,0,139,140,3,12, + 6,0,140,141,5,40,0,0,141,153,1,0,0,0,142,144,5,30,0,0,143,145,5, + 54,0,0,144,143,1,0,0,0,144,145,1,0,0,0,145,146,1,0,0,0,146,147,5, + 41,0,0,147,148,3,12,6,0,148,149,5,53,0,0,149,150,3,12,6,0,150,151, + 5,40,0,0,151,153,1,0,0,0,152,36,1,0,0,0,152,44,1,0,0,0,152,52,1, + 0,0,0,152,60,1,0,0,0,152,70,1,0,0,0,152,78,1,0,0,0,152,86,1,0,0, + 0,152,94,1,0,0,0,152,102,1,0,0,0,152,117,1,0,0,0,152,134,1,0,0,0, + 152,142,1,0,0,0,153,5,1,0,0,0,154,158,5,57,0,0,155,158,5,58,0,0, + 156,158,3,12,6,0,157,154,1,0,0,0,157,155,1,0,0,0,157,156,1,0,0,0, + 158,7,1,0,0,0,159,160,5,31,0,0,160,9,1,0,0,0,161,163,3,2,1,0,162, + 164,5,54,0,0,163,162,1,0,0,0,163,164,1,0,0,0,164,171,1,0,0,0,165, + 171,3,4,2,0,166,168,3,8,4,0,167,169,5,54,0,0,168,167,1,0,0,0,168, + 169,1,0,0,0,169,171,1,0,0,0,170,161,1,0,0,0,170,165,1,0,0,0,170, + 166,1,0,0,0,171,11,1,0,0,0,172,173,6,6,-1,0,173,174,5,50,0,0,174, + 175,3,12,6,0,175,176,5,51,0,0,176,234,1,0,0,0,177,178,5,58,0,0,178, + 179,5,36,0,0,179,181,3,12,6,0,180,182,5,62,0,0,181,180,1,0,0,0,182, + 183,1,0,0,0,183,181,1,0,0,0,183,184,1,0,0,0,184,195,1,0,0,0,185, + 186,5,58,0,0,186,187,5,36,0,0,187,189,3,12,6,0,188,190,5,62,0,0, + 189,188,1,0,0,0,190,191,1,0,0,0,191,189,1,0,0,0,191,192,1,0,0,0, + 192,194,1,0,0,0,193,185,1,0,0,0,194,197,1,0,0,0,195,193,1,0,0,0, + 195,196,1,0,0,0,196,198,1,0,0,0,197,195,1,0,0,0,198,202,3,10,5,0, + 199,201,5,62,0,0,200,199,1,0,0,0,201,204,1,0,0,0,202,200,1,0,0,0, + 202,203,1,0,0,0,203,234,1,0,0,0,204,202,1,0,0,0,205,234,3,10,5,0, + 206,234,5,57,0,0,207,209,5,58,0,0,208,210,5,54,0,0,209,208,1,0,0, + 0,209,210,1,0,0,0,210,234,1,0,0,0,211,212,5,58,0,0,212,221,5,50, + 0,0,213,218,3,12,6,0,214,215,5,53,0,0,215,217,3,12,6,0,216,214,1, + 0,0,0,217,220,1,0,0,0,218,216,1,0,0,0,218,219,1,0,0,0,219,222,1, + 0,0,0,220,218,1,0,0,0,221,213,1,0,0,0,221,222,1,0,0,0,222,223,1, + 0,0,0,223,234,5,51,0,0,224,225,5,1,0,0,225,226,3,12,6,0,226,227, + 5,2,0,0,227,228,3,12,6,0,228,229,5,3,0,0,229,230,3,12,6,3,230,234, + 1,0,0,0,231,232,5,42,0,0,232,234,3,12,6,2,233,172,1,0,0,0,233,177, + 1,0,0,0,233,205,1,0,0,0,233,206,1,0,0,0,233,207,1,0,0,0,233,211, + 1,0,0,0,233,224,1,0,0,0,233,231,1,0,0,0,234,246,1,0,0,0,235,236, + 10,4,0,0,236,237,7,0,0,0,237,245,3,12,6,5,238,239,10,1,0,0,239,240, + 5,54,0,0,240,241,3,12,6,0,241,242,5,55,0,0,242,243,3,12,6,2,243, + 245,1,0,0,0,244,235,1,0,0,0,244,238,1,0,0,0,245,248,1,0,0,0,246, + 244,1,0,0,0,246,247,1,0,0,0,247,13,1,0,0,0,248,246,1,0,0,0,30,34, + 38,46,54,62,72,80,88,96,104,112,119,129,136,144,152,157,163,168, + 170,183,191,195,202,209,218,221,233,244,246 + ] + +class SubstraitTypeParser ( Parser ): + + grammarFileName = "SubstraitType.g4" + + atn = ATNDeserializer().deserialize(serializedATN()) + + decisionsToDFA = [ DFA(ds, i) for i, ds in enumerate(atn.decisionToState) ] + + sharedContextCache = PredictionContextCache() + + literalNames = [ "", "", "", "", + "", "", "", "", + "", "", "", "", + "", "", "", "", + "", "", "", "", + "", "", "", "", + "", "", "", "", + "", "", "", "", + "", "", "", "':='", "'='", + "'!='", "'>='", "'<='", "'>'", "'<'", "'!'", "'+'", + "'-'", "'*'", "'/'", "'%'", "'['", "']'", "'('", "')'", + "';'", "','", "'?'", "':'", "'''" ] + + symbolicNames = [ "", "If", "Then", "Else", "Boolean", "I8", + "I16", "I32", "I64", "FP32", "FP64", "String", "Binary", + "Timestamp", "TimestampTZ", "Date", "Time", "IntervalYear", + "IntervalDay", "IntervalCompound", "UUID", "Decimal", + "PrecisionTimestamp", "PrecisionTimestampTZ", "FixedChar", + "VarChar", "FixedBinary", "Struct", "NStruct", "List", + "Map", "ANY", "UserDefined", "And", "Or", "Assign", + "Eq", "NotEquals", "Gte", "Lte", "Gt", "Lt", "Bang", + "Plus", "Minus", "Asterisk", "ForwardSlash", "Percent", + "OBracket", "CBracket", "OParen", "CParen", "SColon", + "Comma", "QMark", "Colon", "SingleQuote", "Number", + "Identifier", "LineComment", "BlockComment", "Whitespace", + "Newline" ] + + RULE_start = 0 + RULE_scalarType = 1 + RULE_parameterizedType = 2 + RULE_numericParameter = 3 + RULE_anyType = 4 + RULE_type = 5 + RULE_expr = 6 + + ruleNames = [ "start", "scalarType", "parameterizedType", "numericParameter", + "anyType", "type", "expr" ] + + EOF = Token.EOF + If=1 + Then=2 + Else=3 + Boolean=4 + I8=5 + I16=6 + I32=7 + I64=8 + FP32=9 + FP64=10 + String=11 + Binary=12 + Timestamp=13 + TimestampTZ=14 + Date=15 + Time=16 + IntervalYear=17 + IntervalDay=18 + IntervalCompound=19 + UUID=20 + Decimal=21 + PrecisionTimestamp=22 + PrecisionTimestampTZ=23 + FixedChar=24 + VarChar=25 + FixedBinary=26 + Struct=27 + NStruct=28 + List=29 + Map=30 + ANY=31 + UserDefined=32 + And=33 + Or=34 + Assign=35 + Eq=36 + NotEquals=37 + Gte=38 + Lte=39 + Gt=40 + Lt=41 + Bang=42 + Plus=43 + Minus=44 + Asterisk=45 + ForwardSlash=46 + Percent=47 + OBracket=48 + CBracket=49 + OParen=50 + CParen=51 + SColon=52 + Comma=53 + QMark=54 + Colon=55 + SingleQuote=56 + Number=57 + Identifier=58 + LineComment=59 + BlockComment=60 + Whitespace=61 + Newline=62 + + def __init__(self, input:TokenStream, output:TextIO = sys.stdout): + super().__init__(input, output) + self.checkVersion("4.13.1") + self._interp = ParserATNSimulator(self, self.atn, self.decisionsToDFA, self.sharedContextCache) + self._predicates = None + + + + + class StartContext(ParserRuleContext): + __slots__ = 'parser' + + def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): + super().__init__(parent, invokingState) + self.parser = parser + + def expr(self): + return self.getTypedRuleContext(SubstraitTypeParser.ExprContext,0) + + + def EOF(self): + return self.getToken(SubstraitTypeParser.EOF, 0) + + def getRuleIndex(self): + return SubstraitTypeParser.RULE_start + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterStart" ): + listener.enterStart(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitStart" ): + listener.exitStart(self) + + + + + def start(self): + + localctx = SubstraitTypeParser.StartContext(self, self._ctx, self.state) + self.enterRule(localctx, 0, self.RULE_start) + try: + self.enterOuterAlt(localctx, 1) + self.state = 14 + self.expr(0) + self.state = 15 + self.match(SubstraitTypeParser.EOF) + except RecognitionException as re: + localctx.exception = re + self._errHandler.reportError(self, re) + self._errHandler.recover(self, re) + finally: + self.exitRule() + return localctx + + + class ScalarTypeContext(ParserRuleContext): + __slots__ = 'parser' + + def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): + super().__init__(parent, invokingState) + self.parser = parser + + + def getRuleIndex(self): + return SubstraitTypeParser.RULE_scalarType + + + def copyFrom(self, ctx:ParserRuleContext): + super().copyFrom(ctx) + + + + class DateContext(ScalarTypeContext): + + def __init__(self, parser, ctx:ParserRuleContext): # actually a SubstraitTypeParser.ScalarTypeContext + super().__init__(parser) + self.copyFrom(ctx) + + def Date(self): + return self.getToken(SubstraitTypeParser.Date, 0) + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterDate" ): + listener.enterDate(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitDate" ): + listener.exitDate(self) + + + class StringContext(ScalarTypeContext): + + def __init__(self, parser, ctx:ParserRuleContext): # actually a SubstraitTypeParser.ScalarTypeContext + super().__init__(parser) + self.copyFrom(ctx) + + def String(self): + return self.getToken(SubstraitTypeParser.String, 0) + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterString" ): + listener.enterString(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitString" ): + listener.exitString(self) + + + class I64Context(ScalarTypeContext): + + def __init__(self, parser, ctx:ParserRuleContext): # actually a SubstraitTypeParser.ScalarTypeContext + super().__init__(parser) + self.copyFrom(ctx) + + def I64(self): + return self.getToken(SubstraitTypeParser.I64, 0) + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterI64" ): + listener.enterI64(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitI64" ): + listener.exitI64(self) + + + class UserDefinedContext(ScalarTypeContext): + + def __init__(self, parser, ctx:ParserRuleContext): # actually a SubstraitTypeParser.ScalarTypeContext + super().__init__(parser) + self.copyFrom(ctx) + + def UserDefined(self): + return self.getToken(SubstraitTypeParser.UserDefined, 0) + def Identifier(self): + return self.getToken(SubstraitTypeParser.Identifier, 0) + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterUserDefined" ): + listener.enterUserDefined(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitUserDefined" ): + listener.exitUserDefined(self) + + + class I32Context(ScalarTypeContext): + + def __init__(self, parser, ctx:ParserRuleContext): # actually a SubstraitTypeParser.ScalarTypeContext + super().__init__(parser) + self.copyFrom(ctx) + + def I32(self): + return self.getToken(SubstraitTypeParser.I32, 0) + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterI32" ): + listener.enterI32(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitI32" ): + listener.exitI32(self) + + + class IntervalYearContext(ScalarTypeContext): + + def __init__(self, parser, ctx:ParserRuleContext): # actually a SubstraitTypeParser.ScalarTypeContext + super().__init__(parser) + self.copyFrom(ctx) + + def IntervalYear(self): + return self.getToken(SubstraitTypeParser.IntervalYear, 0) + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterIntervalYear" ): + listener.enterIntervalYear(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitIntervalYear" ): + listener.exitIntervalYear(self) + + + class UuidContext(ScalarTypeContext): + + def __init__(self, parser, ctx:ParserRuleContext): # actually a SubstraitTypeParser.ScalarTypeContext + super().__init__(parser) + self.copyFrom(ctx) + + def UUID(self): + return self.getToken(SubstraitTypeParser.UUID, 0) + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterUuid" ): + listener.enterUuid(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitUuid" ): + listener.exitUuid(self) + + + class I8Context(ScalarTypeContext): + + def __init__(self, parser, ctx:ParserRuleContext): # actually a SubstraitTypeParser.ScalarTypeContext + super().__init__(parser) + self.copyFrom(ctx) + + def I8(self): + return self.getToken(SubstraitTypeParser.I8, 0) + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterI8" ): + listener.enterI8(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitI8" ): + listener.exitI8(self) + + + class I16Context(ScalarTypeContext): + + def __init__(self, parser, ctx:ParserRuleContext): # actually a SubstraitTypeParser.ScalarTypeContext + super().__init__(parser) + self.copyFrom(ctx) + + def I16(self): + return self.getToken(SubstraitTypeParser.I16, 0) + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterI16" ): + listener.enterI16(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitI16" ): + listener.exitI16(self) + + + class BinaryContext(ScalarTypeContext): + + def __init__(self, parser, ctx:ParserRuleContext): # actually a SubstraitTypeParser.ScalarTypeContext + super().__init__(parser) + self.copyFrom(ctx) + + def Binary(self): + return self.getToken(SubstraitTypeParser.Binary, 0) + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterBinary" ): + listener.enterBinary(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitBinary" ): + listener.exitBinary(self) + + + class Fp64Context(ScalarTypeContext): + + def __init__(self, parser, ctx:ParserRuleContext): # actually a SubstraitTypeParser.ScalarTypeContext + super().__init__(parser) + self.copyFrom(ctx) + + def FP64(self): + return self.getToken(SubstraitTypeParser.FP64, 0) + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterFp64" ): + listener.enterFp64(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitFp64" ): + listener.exitFp64(self) + + + class Fp32Context(ScalarTypeContext): + + def __init__(self, parser, ctx:ParserRuleContext): # actually a SubstraitTypeParser.ScalarTypeContext + super().__init__(parser) + self.copyFrom(ctx) + + def FP32(self): + return self.getToken(SubstraitTypeParser.FP32, 0) + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterFp32" ): + listener.enterFp32(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitFp32" ): + listener.exitFp32(self) + + + class TimeContext(ScalarTypeContext): + + def __init__(self, parser, ctx:ParserRuleContext): # actually a SubstraitTypeParser.ScalarTypeContext + super().__init__(parser) + self.copyFrom(ctx) + + def Time(self): + return self.getToken(SubstraitTypeParser.Time, 0) + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterTime" ): + listener.enterTime(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitTime" ): + listener.exitTime(self) + + + class BooleanContext(ScalarTypeContext): + + def __init__(self, parser, ctx:ParserRuleContext): # actually a SubstraitTypeParser.ScalarTypeContext + super().__init__(parser) + self.copyFrom(ctx) + + def Boolean(self): + return self.getToken(SubstraitTypeParser.Boolean, 0) + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterBoolean" ): + listener.enterBoolean(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitBoolean" ): + listener.exitBoolean(self) + + + class TimestampContext(ScalarTypeContext): + + def __init__(self, parser, ctx:ParserRuleContext): # actually a SubstraitTypeParser.ScalarTypeContext + super().__init__(parser) + self.copyFrom(ctx) + + def Timestamp(self): + return self.getToken(SubstraitTypeParser.Timestamp, 0) + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterTimestamp" ): + listener.enterTimestamp(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitTimestamp" ): + listener.exitTimestamp(self) + + + class TimestampTzContext(ScalarTypeContext): + + def __init__(self, parser, ctx:ParserRuleContext): # actually a SubstraitTypeParser.ScalarTypeContext + super().__init__(parser) + self.copyFrom(ctx) + + def TimestampTZ(self): + return self.getToken(SubstraitTypeParser.TimestampTZ, 0) + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterTimestampTz" ): + listener.enterTimestampTz(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitTimestampTz" ): + listener.exitTimestampTz(self) + + + + def scalarType(self): + + localctx = SubstraitTypeParser.ScalarTypeContext(self, self._ctx, self.state) + self.enterRule(localctx, 2, self.RULE_scalarType) + try: + self.state = 34 + self._errHandler.sync(self) + token = self._input.LA(1) + if token in [4]: + localctx = SubstraitTypeParser.BooleanContext(self, localctx) + self.enterOuterAlt(localctx, 1) + self.state = 17 + self.match(SubstraitTypeParser.Boolean) + pass + elif token in [5]: + localctx = SubstraitTypeParser.I8Context(self, localctx) + self.enterOuterAlt(localctx, 2) + self.state = 18 + self.match(SubstraitTypeParser.I8) + pass + elif token in [6]: + localctx = SubstraitTypeParser.I16Context(self, localctx) + self.enterOuterAlt(localctx, 3) + self.state = 19 + self.match(SubstraitTypeParser.I16) + pass + elif token in [7]: + localctx = SubstraitTypeParser.I32Context(self, localctx) + self.enterOuterAlt(localctx, 4) + self.state = 20 + self.match(SubstraitTypeParser.I32) + pass + elif token in [8]: + localctx = SubstraitTypeParser.I64Context(self, localctx) + self.enterOuterAlt(localctx, 5) + self.state = 21 + self.match(SubstraitTypeParser.I64) + pass + elif token in [9]: + localctx = SubstraitTypeParser.Fp32Context(self, localctx) + self.enterOuterAlt(localctx, 6) + self.state = 22 + self.match(SubstraitTypeParser.FP32) + pass + elif token in [10]: + localctx = SubstraitTypeParser.Fp64Context(self, localctx) + self.enterOuterAlt(localctx, 7) + self.state = 23 + self.match(SubstraitTypeParser.FP64) + pass + elif token in [11]: + localctx = SubstraitTypeParser.StringContext(self, localctx) + self.enterOuterAlt(localctx, 8) + self.state = 24 + self.match(SubstraitTypeParser.String) + pass + elif token in [12]: + localctx = SubstraitTypeParser.BinaryContext(self, localctx) + self.enterOuterAlt(localctx, 9) + self.state = 25 + self.match(SubstraitTypeParser.Binary) + pass + elif token in [13]: + localctx = SubstraitTypeParser.TimestampContext(self, localctx) + self.enterOuterAlt(localctx, 10) + self.state = 26 + self.match(SubstraitTypeParser.Timestamp) + pass + elif token in [14]: + localctx = SubstraitTypeParser.TimestampTzContext(self, localctx) + self.enterOuterAlt(localctx, 11) + self.state = 27 + self.match(SubstraitTypeParser.TimestampTZ) + pass + elif token in [15]: + localctx = SubstraitTypeParser.DateContext(self, localctx) + self.enterOuterAlt(localctx, 12) + self.state = 28 + self.match(SubstraitTypeParser.Date) + pass + elif token in [16]: + localctx = SubstraitTypeParser.TimeContext(self, localctx) + self.enterOuterAlt(localctx, 13) + self.state = 29 + self.match(SubstraitTypeParser.Time) + pass + elif token in [17]: + localctx = SubstraitTypeParser.IntervalYearContext(self, localctx) + self.enterOuterAlt(localctx, 14) + self.state = 30 + self.match(SubstraitTypeParser.IntervalYear) + pass + elif token in [20]: + localctx = SubstraitTypeParser.UuidContext(self, localctx) + self.enterOuterAlt(localctx, 15) + self.state = 31 + self.match(SubstraitTypeParser.UUID) + pass + elif token in [32]: + localctx = SubstraitTypeParser.UserDefinedContext(self, localctx) + self.enterOuterAlt(localctx, 16) + self.state = 32 + self.match(SubstraitTypeParser.UserDefined) + self.state = 33 + self.match(SubstraitTypeParser.Identifier) + pass + else: + raise NoViableAltException(self) + + except RecognitionException as re: + localctx.exception = re + self._errHandler.reportError(self, re) + self._errHandler.recover(self, re) + finally: + self.exitRule() + return localctx + + + class ParameterizedTypeContext(ParserRuleContext): + __slots__ = 'parser' + + def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): + super().__init__(parent, invokingState) + self.parser = parser + + + def getRuleIndex(self): + return SubstraitTypeParser.RULE_parameterizedType + + + def copyFrom(self, ctx:ParserRuleContext): + super().copyFrom(ctx) + + + + class StructContext(ParameterizedTypeContext): + + def __init__(self, parser, ctx:ParserRuleContext): # actually a SubstraitTypeParser.ParameterizedTypeContext + super().__init__(parser) + self.isnull = None # Token + self.copyFrom(ctx) + + def Struct(self): + return self.getToken(SubstraitTypeParser.Struct, 0) + def Lt(self): + return self.getToken(SubstraitTypeParser.Lt, 0) + def expr(self, i:int=None): + if i is None: + return self.getTypedRuleContexts(SubstraitTypeParser.ExprContext) + else: + return self.getTypedRuleContext(SubstraitTypeParser.ExprContext,i) + + def Gt(self): + return self.getToken(SubstraitTypeParser.Gt, 0) + def Comma(self, i:int=None): + if i is None: + return self.getTokens(SubstraitTypeParser.Comma) + else: + return self.getToken(SubstraitTypeParser.Comma, i) + def QMark(self): + return self.getToken(SubstraitTypeParser.QMark, 0) + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterStruct" ): + listener.enterStruct(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitStruct" ): + listener.exitStruct(self) + + + class PrecisionTimestampTZContext(ParameterizedTypeContext): + + def __init__(self, parser, ctx:ParserRuleContext): # actually a SubstraitTypeParser.ParameterizedTypeContext + super().__init__(parser) + self.isnull = None # Token + self.precision = None # NumericParameterContext + self.copyFrom(ctx) + + def PrecisionTimestampTZ(self): + return self.getToken(SubstraitTypeParser.PrecisionTimestampTZ, 0) + def Lt(self): + return self.getToken(SubstraitTypeParser.Lt, 0) + def Gt(self): + return self.getToken(SubstraitTypeParser.Gt, 0) + def numericParameter(self): + return self.getTypedRuleContext(SubstraitTypeParser.NumericParameterContext,0) + + def QMark(self): + return self.getToken(SubstraitTypeParser.QMark, 0) + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterPrecisionTimestampTZ" ): + listener.enterPrecisionTimestampTZ(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitPrecisionTimestampTZ" ): + listener.exitPrecisionTimestampTZ(self) + + + class NStructContext(ParameterizedTypeContext): + + def __init__(self, parser, ctx:ParserRuleContext): # actually a SubstraitTypeParser.ParameterizedTypeContext + super().__init__(parser) + self.isnull = None # Token + self.copyFrom(ctx) + + def NStruct(self): + return self.getToken(SubstraitTypeParser.NStruct, 0) + def Lt(self): + return self.getToken(SubstraitTypeParser.Lt, 0) + def Identifier(self, i:int=None): + if i is None: + return self.getTokens(SubstraitTypeParser.Identifier) + else: + return self.getToken(SubstraitTypeParser.Identifier, i) + def expr(self, i:int=None): + if i is None: + return self.getTypedRuleContexts(SubstraitTypeParser.ExprContext) + else: + return self.getTypedRuleContext(SubstraitTypeParser.ExprContext,i) + + def Gt(self): + return self.getToken(SubstraitTypeParser.Gt, 0) + def Comma(self, i:int=None): + if i is None: + return self.getTokens(SubstraitTypeParser.Comma) + else: + return self.getToken(SubstraitTypeParser.Comma, i) + def QMark(self): + return self.getToken(SubstraitTypeParser.QMark, 0) + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterNStruct" ): + listener.enterNStruct(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitNStruct" ): + listener.exitNStruct(self) + + + class VarCharContext(ParameterizedTypeContext): + + def __init__(self, parser, ctx:ParserRuleContext): # actually a SubstraitTypeParser.ParameterizedTypeContext + super().__init__(parser) + self.isnull = None # Token + self.len_ = None # NumericParameterContext + self.copyFrom(ctx) + + def VarChar(self): + return self.getToken(SubstraitTypeParser.VarChar, 0) + def Lt(self): + return self.getToken(SubstraitTypeParser.Lt, 0) + def Gt(self): + return self.getToken(SubstraitTypeParser.Gt, 0) + def numericParameter(self): + return self.getTypedRuleContext(SubstraitTypeParser.NumericParameterContext,0) + + def QMark(self): + return self.getToken(SubstraitTypeParser.QMark, 0) + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterVarChar" ): + listener.enterVarChar(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitVarChar" ): + listener.exitVarChar(self) + + + class FixedBinaryContext(ParameterizedTypeContext): + + def __init__(self, parser, ctx:ParserRuleContext): # actually a SubstraitTypeParser.ParameterizedTypeContext + super().__init__(parser) + self.isnull = None # Token + self.len_ = None # NumericParameterContext + self.copyFrom(ctx) + + def FixedBinary(self): + return self.getToken(SubstraitTypeParser.FixedBinary, 0) + def Lt(self): + return self.getToken(SubstraitTypeParser.Lt, 0) + def Gt(self): + return self.getToken(SubstraitTypeParser.Gt, 0) + def numericParameter(self): + return self.getTypedRuleContext(SubstraitTypeParser.NumericParameterContext,0) + + def QMark(self): + return self.getToken(SubstraitTypeParser.QMark, 0) + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterFixedBinary" ): + listener.enterFixedBinary(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitFixedBinary" ): + listener.exitFixedBinary(self) + + + class IntervalCompoundContext(ParameterizedTypeContext): + + def __init__(self, parser, ctx:ParserRuleContext): # actually a SubstraitTypeParser.ParameterizedTypeContext + super().__init__(parser) + self.isnull = None # Token + self.precision = None # NumericParameterContext + self.copyFrom(ctx) + + def IntervalCompound(self): + return self.getToken(SubstraitTypeParser.IntervalCompound, 0) + def Lt(self): + return self.getToken(SubstraitTypeParser.Lt, 0) + def Gt(self): + return self.getToken(SubstraitTypeParser.Gt, 0) + def numericParameter(self): + return self.getTypedRuleContext(SubstraitTypeParser.NumericParameterContext,0) + + def QMark(self): + return self.getToken(SubstraitTypeParser.QMark, 0) + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterIntervalCompound" ): + listener.enterIntervalCompound(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitIntervalCompound" ): + listener.exitIntervalCompound(self) + + + class IntervalDayContext(ParameterizedTypeContext): + + def __init__(self, parser, ctx:ParserRuleContext): # actually a SubstraitTypeParser.ParameterizedTypeContext + super().__init__(parser) + self.isnull = None # Token + self.precision = None # NumericParameterContext + self.copyFrom(ctx) + + def IntervalDay(self): + return self.getToken(SubstraitTypeParser.IntervalDay, 0) + def Lt(self): + return self.getToken(SubstraitTypeParser.Lt, 0) + def Gt(self): + return self.getToken(SubstraitTypeParser.Gt, 0) + def numericParameter(self): + return self.getTypedRuleContext(SubstraitTypeParser.NumericParameterContext,0) + + def QMark(self): + return self.getToken(SubstraitTypeParser.QMark, 0) + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterIntervalDay" ): + listener.enterIntervalDay(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitIntervalDay" ): + listener.exitIntervalDay(self) + + + class PrecisionTimestampContext(ParameterizedTypeContext): + + def __init__(self, parser, ctx:ParserRuleContext): # actually a SubstraitTypeParser.ParameterizedTypeContext + super().__init__(parser) + self.isnull = None # Token + self.precision = None # NumericParameterContext + self.copyFrom(ctx) + + def PrecisionTimestamp(self): + return self.getToken(SubstraitTypeParser.PrecisionTimestamp, 0) + def Lt(self): + return self.getToken(SubstraitTypeParser.Lt, 0) + def Gt(self): + return self.getToken(SubstraitTypeParser.Gt, 0) + def numericParameter(self): + return self.getTypedRuleContext(SubstraitTypeParser.NumericParameterContext,0) + + def QMark(self): + return self.getToken(SubstraitTypeParser.QMark, 0) + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterPrecisionTimestamp" ): + listener.enterPrecisionTimestamp(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitPrecisionTimestamp" ): + listener.exitPrecisionTimestamp(self) + + + class FixedCharContext(ParameterizedTypeContext): + + def __init__(self, parser, ctx:ParserRuleContext): # actually a SubstraitTypeParser.ParameterizedTypeContext + super().__init__(parser) + self.isnull = None # Token + self.len_ = None # NumericParameterContext + self.copyFrom(ctx) + + def FixedChar(self): + return self.getToken(SubstraitTypeParser.FixedChar, 0) + def Lt(self): + return self.getToken(SubstraitTypeParser.Lt, 0) + def Gt(self): + return self.getToken(SubstraitTypeParser.Gt, 0) + def numericParameter(self): + return self.getTypedRuleContext(SubstraitTypeParser.NumericParameterContext,0) + + def QMark(self): + return self.getToken(SubstraitTypeParser.QMark, 0) + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterFixedChar" ): + listener.enterFixedChar(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitFixedChar" ): + listener.exitFixedChar(self) + + + class DecimalContext(ParameterizedTypeContext): + + def __init__(self, parser, ctx:ParserRuleContext): # actually a SubstraitTypeParser.ParameterizedTypeContext + super().__init__(parser) + self.isnull = None # Token + self.precision = None # NumericParameterContext + self.scale = None # NumericParameterContext + self.copyFrom(ctx) + + def Decimal(self): + return self.getToken(SubstraitTypeParser.Decimal, 0) + def Lt(self): + return self.getToken(SubstraitTypeParser.Lt, 0) + def Comma(self): + return self.getToken(SubstraitTypeParser.Comma, 0) + def Gt(self): + return self.getToken(SubstraitTypeParser.Gt, 0) + def numericParameter(self, i:int=None): + if i is None: + return self.getTypedRuleContexts(SubstraitTypeParser.NumericParameterContext) + else: + return self.getTypedRuleContext(SubstraitTypeParser.NumericParameterContext,i) + + def QMark(self): + return self.getToken(SubstraitTypeParser.QMark, 0) + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterDecimal" ): + listener.enterDecimal(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitDecimal" ): + listener.exitDecimal(self) + + + class ListContext(ParameterizedTypeContext): + + def __init__(self, parser, ctx:ParserRuleContext): # actually a SubstraitTypeParser.ParameterizedTypeContext + super().__init__(parser) + self.isnull = None # Token + self.copyFrom(ctx) + + def List(self): + return self.getToken(SubstraitTypeParser.List, 0) + def Lt(self): + return self.getToken(SubstraitTypeParser.Lt, 0) + def expr(self): + return self.getTypedRuleContext(SubstraitTypeParser.ExprContext,0) + + def Gt(self): + return self.getToken(SubstraitTypeParser.Gt, 0) + def QMark(self): + return self.getToken(SubstraitTypeParser.QMark, 0) + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterList" ): + listener.enterList(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitList" ): + listener.exitList(self) + + + class MapContext(ParameterizedTypeContext): + + def __init__(self, parser, ctx:ParserRuleContext): # actually a SubstraitTypeParser.ParameterizedTypeContext + super().__init__(parser) + self.isnull = None # Token + self.key = None # ExprContext + self.value = None # ExprContext + self.copyFrom(ctx) + + def Map(self): + return self.getToken(SubstraitTypeParser.Map, 0) + def Lt(self): + return self.getToken(SubstraitTypeParser.Lt, 0) + def Comma(self): + return self.getToken(SubstraitTypeParser.Comma, 0) + def Gt(self): + return self.getToken(SubstraitTypeParser.Gt, 0) + def expr(self, i:int=None): + if i is None: + return self.getTypedRuleContexts(SubstraitTypeParser.ExprContext) + else: + return self.getTypedRuleContext(SubstraitTypeParser.ExprContext,i) + + def QMark(self): + return self.getToken(SubstraitTypeParser.QMark, 0) + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterMap" ): + listener.enterMap(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitMap" ): + listener.exitMap(self) + + + + def parameterizedType(self): + + localctx = SubstraitTypeParser.ParameterizedTypeContext(self, self._ctx, self.state) + self.enterRule(localctx, 4, self.RULE_parameterizedType) + self._la = 0 # Token type + try: + self.state = 152 + self._errHandler.sync(self) + token = self._input.LA(1) + if token in [24]: + localctx = SubstraitTypeParser.FixedCharContext(self, localctx) + self.enterOuterAlt(localctx, 1) + self.state = 36 + self.match(SubstraitTypeParser.FixedChar) + self.state = 38 + self._errHandler.sync(self) + _la = self._input.LA(1) + if _la==54: + self.state = 37 + localctx.isnull = self.match(SubstraitTypeParser.QMark) + + + self.state = 40 + self.match(SubstraitTypeParser.Lt) + self.state = 41 + localctx.len_ = self.numericParameter() + self.state = 42 + self.match(SubstraitTypeParser.Gt) + pass + elif token in [25]: + localctx = SubstraitTypeParser.VarCharContext(self, localctx) + self.enterOuterAlt(localctx, 2) + self.state = 44 + self.match(SubstraitTypeParser.VarChar) + self.state = 46 + self._errHandler.sync(self) + _la = self._input.LA(1) + if _la==54: + self.state = 45 + localctx.isnull = self.match(SubstraitTypeParser.QMark) + + + self.state = 48 + self.match(SubstraitTypeParser.Lt) + self.state = 49 + localctx.len_ = self.numericParameter() + self.state = 50 + self.match(SubstraitTypeParser.Gt) + pass + elif token in [26]: + localctx = SubstraitTypeParser.FixedBinaryContext(self, localctx) + self.enterOuterAlt(localctx, 3) + self.state = 52 + self.match(SubstraitTypeParser.FixedBinary) + self.state = 54 + self._errHandler.sync(self) + _la = self._input.LA(1) + if _la==54: + self.state = 53 + localctx.isnull = self.match(SubstraitTypeParser.QMark) + + + self.state = 56 + self.match(SubstraitTypeParser.Lt) + self.state = 57 + localctx.len_ = self.numericParameter() + self.state = 58 + self.match(SubstraitTypeParser.Gt) + pass + elif token in [21]: + localctx = SubstraitTypeParser.DecimalContext(self, localctx) + self.enterOuterAlt(localctx, 4) + self.state = 60 + self.match(SubstraitTypeParser.Decimal) + self.state = 62 + self._errHandler.sync(self) + _la = self._input.LA(1) + if _la==54: + self.state = 61 + localctx.isnull = self.match(SubstraitTypeParser.QMark) + + + self.state = 64 + self.match(SubstraitTypeParser.Lt) + self.state = 65 + localctx.precision = self.numericParameter() + self.state = 66 + self.match(SubstraitTypeParser.Comma) + self.state = 67 + localctx.scale = self.numericParameter() + self.state = 68 + self.match(SubstraitTypeParser.Gt) + pass + elif token in [18]: + localctx = SubstraitTypeParser.IntervalDayContext(self, localctx) + self.enterOuterAlt(localctx, 5) + self.state = 70 + self.match(SubstraitTypeParser.IntervalDay) + self.state = 72 + self._errHandler.sync(self) + _la = self._input.LA(1) + if _la==54: + self.state = 71 + localctx.isnull = self.match(SubstraitTypeParser.QMark) + + + self.state = 74 + self.match(SubstraitTypeParser.Lt) + self.state = 75 + localctx.precision = self.numericParameter() + self.state = 76 + self.match(SubstraitTypeParser.Gt) + pass + elif token in [19]: + localctx = SubstraitTypeParser.IntervalCompoundContext(self, localctx) + self.enterOuterAlt(localctx, 6) + self.state = 78 + self.match(SubstraitTypeParser.IntervalCompound) + self.state = 80 + self._errHandler.sync(self) + _la = self._input.LA(1) + if _la==54: + self.state = 79 + localctx.isnull = self.match(SubstraitTypeParser.QMark) + + + self.state = 82 + self.match(SubstraitTypeParser.Lt) + self.state = 83 + localctx.precision = self.numericParameter() + self.state = 84 + self.match(SubstraitTypeParser.Gt) + pass + elif token in [22]: + localctx = SubstraitTypeParser.PrecisionTimestampContext(self, localctx) + self.enterOuterAlt(localctx, 7) + self.state = 86 + self.match(SubstraitTypeParser.PrecisionTimestamp) + self.state = 88 + self._errHandler.sync(self) + _la = self._input.LA(1) + if _la==54: + self.state = 87 + localctx.isnull = self.match(SubstraitTypeParser.QMark) + + + self.state = 90 + self.match(SubstraitTypeParser.Lt) + self.state = 91 + localctx.precision = self.numericParameter() + self.state = 92 + self.match(SubstraitTypeParser.Gt) + pass + elif token in [23]: + localctx = SubstraitTypeParser.PrecisionTimestampTZContext(self, localctx) + self.enterOuterAlt(localctx, 8) + self.state = 94 + self.match(SubstraitTypeParser.PrecisionTimestampTZ) + self.state = 96 + self._errHandler.sync(self) + _la = self._input.LA(1) + if _la==54: + self.state = 95 + localctx.isnull = self.match(SubstraitTypeParser.QMark) + + + self.state = 98 + self.match(SubstraitTypeParser.Lt) + self.state = 99 + localctx.precision = self.numericParameter() + self.state = 100 + self.match(SubstraitTypeParser.Gt) + pass + elif token in [27]: + localctx = SubstraitTypeParser.StructContext(self, localctx) + self.enterOuterAlt(localctx, 9) + self.state = 102 + self.match(SubstraitTypeParser.Struct) + self.state = 104 + self._errHandler.sync(self) + _la = self._input.LA(1) + if _la==54: + self.state = 103 + localctx.isnull = self.match(SubstraitTypeParser.QMark) + + + self.state = 106 + self.match(SubstraitTypeParser.Lt) + self.state = 107 + self.expr(0) + self.state = 112 + self._errHandler.sync(self) + _la = self._input.LA(1) + while _la==53: + self.state = 108 + self.match(SubstraitTypeParser.Comma) + self.state = 109 + self.expr(0) + self.state = 114 + self._errHandler.sync(self) + _la = self._input.LA(1) + + self.state = 115 + self.match(SubstraitTypeParser.Gt) + pass + elif token in [28]: + localctx = SubstraitTypeParser.NStructContext(self, localctx) + self.enterOuterAlt(localctx, 10) + self.state = 117 + self.match(SubstraitTypeParser.NStruct) + self.state = 119 + self._errHandler.sync(self) + _la = self._input.LA(1) + if _la==54: + self.state = 118 + localctx.isnull = self.match(SubstraitTypeParser.QMark) + + + self.state = 121 + self.match(SubstraitTypeParser.Lt) + self.state = 122 + self.match(SubstraitTypeParser.Identifier) + self.state = 123 + self.expr(0) + self.state = 129 + self._errHandler.sync(self) + _la = self._input.LA(1) + while _la==53: + self.state = 124 + self.match(SubstraitTypeParser.Comma) + self.state = 125 + self.match(SubstraitTypeParser.Identifier) + self.state = 126 + self.expr(0) + self.state = 131 + self._errHandler.sync(self) + _la = self._input.LA(1) + + self.state = 132 + self.match(SubstraitTypeParser.Gt) + pass + elif token in [29]: + localctx = SubstraitTypeParser.ListContext(self, localctx) + self.enterOuterAlt(localctx, 11) + self.state = 134 + self.match(SubstraitTypeParser.List) + self.state = 136 + self._errHandler.sync(self) + _la = self._input.LA(1) + if _la==54: + self.state = 135 + localctx.isnull = self.match(SubstraitTypeParser.QMark) + + + self.state = 138 + self.match(SubstraitTypeParser.Lt) + self.state = 139 + self.expr(0) + self.state = 140 + self.match(SubstraitTypeParser.Gt) + pass + elif token in [30]: + localctx = SubstraitTypeParser.MapContext(self, localctx) + self.enterOuterAlt(localctx, 12) + self.state = 142 + self.match(SubstraitTypeParser.Map) + self.state = 144 + self._errHandler.sync(self) + _la = self._input.LA(1) + if _la==54: + self.state = 143 + localctx.isnull = self.match(SubstraitTypeParser.QMark) + + + self.state = 146 + self.match(SubstraitTypeParser.Lt) + self.state = 147 + localctx.key = self.expr(0) + self.state = 148 + self.match(SubstraitTypeParser.Comma) + self.state = 149 + localctx.value = self.expr(0) + self.state = 150 + self.match(SubstraitTypeParser.Gt) + pass + else: + raise NoViableAltException(self) + + except RecognitionException as re: + localctx.exception = re + self._errHandler.reportError(self, re) + self._errHandler.recover(self, re) + finally: + self.exitRule() + return localctx + + + class NumericParameterContext(ParserRuleContext): + __slots__ = 'parser' + + def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): + super().__init__(parent, invokingState) + self.parser = parser + + + def getRuleIndex(self): + return SubstraitTypeParser.RULE_numericParameter + + + def copyFrom(self, ctx:ParserRuleContext): + super().copyFrom(ctx) + + + + class NumericParameterNameContext(NumericParameterContext): + + def __init__(self, parser, ctx:ParserRuleContext): # actually a SubstraitTypeParser.NumericParameterContext + super().__init__(parser) + self.copyFrom(ctx) + + def Identifier(self): + return self.getToken(SubstraitTypeParser.Identifier, 0) + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterNumericParameterName" ): + listener.enterNumericParameterName(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitNumericParameterName" ): + listener.exitNumericParameterName(self) + + + class NumericLiteralContext(NumericParameterContext): + + def __init__(self, parser, ctx:ParserRuleContext): # actually a SubstraitTypeParser.NumericParameterContext + super().__init__(parser) + self.copyFrom(ctx) + + def Number(self): + return self.getToken(SubstraitTypeParser.Number, 0) + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterNumericLiteral" ): + listener.enterNumericLiteral(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitNumericLiteral" ): + listener.exitNumericLiteral(self) + + + class NumericExpressionContext(NumericParameterContext): + + def __init__(self, parser, ctx:ParserRuleContext): # actually a SubstraitTypeParser.NumericParameterContext + super().__init__(parser) + self.copyFrom(ctx) + + def expr(self): + return self.getTypedRuleContext(SubstraitTypeParser.ExprContext,0) + + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterNumericExpression" ): + listener.enterNumericExpression(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitNumericExpression" ): + listener.exitNumericExpression(self) + + + + def numericParameter(self): + + localctx = SubstraitTypeParser.NumericParameterContext(self, self._ctx, self.state) + self.enterRule(localctx, 6, self.RULE_numericParameter) + try: + self.state = 157 + self._errHandler.sync(self) + la_ = self._interp.adaptivePredict(self._input,16,self._ctx) + if la_ == 1: + localctx = SubstraitTypeParser.NumericLiteralContext(self, localctx) + self.enterOuterAlt(localctx, 1) + self.state = 154 + self.match(SubstraitTypeParser.Number) + pass + + elif la_ == 2: + localctx = SubstraitTypeParser.NumericParameterNameContext(self, localctx) + self.enterOuterAlt(localctx, 2) + self.state = 155 + self.match(SubstraitTypeParser.Identifier) + pass + + elif la_ == 3: + localctx = SubstraitTypeParser.NumericExpressionContext(self, localctx) + self.enterOuterAlt(localctx, 3) + self.state = 156 + self.expr(0) + pass + + + except RecognitionException as re: + localctx.exception = re + self._errHandler.reportError(self, re) + self._errHandler.recover(self, re) + finally: + self.exitRule() + return localctx + + + class AnyTypeContext(ParserRuleContext): + __slots__ = 'parser' + + def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): + super().__init__(parent, invokingState) + self.parser = parser + + def ANY(self): + return self.getToken(SubstraitTypeParser.ANY, 0) + + def getRuleIndex(self): + return SubstraitTypeParser.RULE_anyType + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterAnyType" ): + listener.enterAnyType(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitAnyType" ): + listener.exitAnyType(self) + + + + + def anyType(self): + + localctx = SubstraitTypeParser.AnyTypeContext(self, self._ctx, self.state) + self.enterRule(localctx, 8, self.RULE_anyType) + try: + self.enterOuterAlt(localctx, 1) + self.state = 159 + self.match(SubstraitTypeParser.ANY) + except RecognitionException as re: + localctx.exception = re + self._errHandler.reportError(self, re) + self._errHandler.recover(self, re) + finally: + self.exitRule() + return localctx + + + class TypeContext(ParserRuleContext): + __slots__ = 'parser' + + def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): + super().__init__(parent, invokingState) + self.parser = parser + self.isnull = None # Token + + def scalarType(self): + return self.getTypedRuleContext(SubstraitTypeParser.ScalarTypeContext,0) + + + def QMark(self): + return self.getToken(SubstraitTypeParser.QMark, 0) + + def parameterizedType(self): + return self.getTypedRuleContext(SubstraitTypeParser.ParameterizedTypeContext,0) + + + def anyType(self): + return self.getTypedRuleContext(SubstraitTypeParser.AnyTypeContext,0) + + + def getRuleIndex(self): + return SubstraitTypeParser.RULE_type + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterType" ): + listener.enterType(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitType" ): + listener.exitType(self) + + + + + def type_(self): + + localctx = SubstraitTypeParser.TypeContext(self, self._ctx, self.state) + self.enterRule(localctx, 10, self.RULE_type) + try: + self.state = 170 + self._errHandler.sync(self) + token = self._input.LA(1) + if token in [4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 20, 32]: + self.enterOuterAlt(localctx, 1) + self.state = 161 + self.scalarType() + self.state = 163 + self._errHandler.sync(self) + la_ = self._interp.adaptivePredict(self._input,17,self._ctx) + if la_ == 1: + self.state = 162 + localctx.isnull = self.match(SubstraitTypeParser.QMark) + + + pass + elif token in [18, 19, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30]: + self.enterOuterAlt(localctx, 2) + self.state = 165 + self.parameterizedType() + pass + elif token in [31]: + self.enterOuterAlt(localctx, 3) + self.state = 166 + self.anyType() + self.state = 168 + self._errHandler.sync(self) + la_ = self._interp.adaptivePredict(self._input,18,self._ctx) + if la_ == 1: + self.state = 167 + localctx.isnull = self.match(SubstraitTypeParser.QMark) + + + pass + else: + raise NoViableAltException(self) + + except RecognitionException as re: + localctx.exception = re + self._errHandler.reportError(self, re) + self._errHandler.recover(self, re) + finally: + self.exitRule() + return localctx + + + class ExprContext(ParserRuleContext): + __slots__ = 'parser' + + def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): + super().__init__(parent, invokingState) + self.parser = parser + + + def getRuleIndex(self): + return SubstraitTypeParser.RULE_expr + + + def copyFrom(self, ctx:ParserRuleContext): + super().copyFrom(ctx) + + + class IfExprContext(ExprContext): + + def __init__(self, parser, ctx:ParserRuleContext): # actually a SubstraitTypeParser.ExprContext + super().__init__(parser) + self.ifExpr = None # ExprContext + self.thenExpr = None # ExprContext + self.elseExpr = None # ExprContext + self.copyFrom(ctx) + + def If(self): + return self.getToken(SubstraitTypeParser.If, 0) + def Then(self): + return self.getToken(SubstraitTypeParser.Then, 0) + def Else(self): + return self.getToken(SubstraitTypeParser.Else, 0) + def expr(self, i:int=None): + if i is None: + return self.getTypedRuleContexts(SubstraitTypeParser.ExprContext) + else: + return self.getTypedRuleContext(SubstraitTypeParser.ExprContext,i) + + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterIfExpr" ): + listener.enterIfExpr(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitIfExpr" ): + listener.exitIfExpr(self) + + + class TypeLiteralContext(ExprContext): + + def __init__(self, parser, ctx:ParserRuleContext): # actually a SubstraitTypeParser.ExprContext + super().__init__(parser) + self.copyFrom(ctx) + + def type_(self): + return self.getTypedRuleContext(SubstraitTypeParser.TypeContext,0) + + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterTypeLiteral" ): + listener.enterTypeLiteral(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitTypeLiteral" ): + listener.exitTypeLiteral(self) + + + class MultilineDefinitionContext(ExprContext): + + def __init__(self, parser, ctx:ParserRuleContext): # actually a SubstraitTypeParser.ExprContext + super().__init__(parser) + self.finalType = None # TypeContext + self.copyFrom(ctx) + + def Identifier(self, i:int=None): + if i is None: + return self.getTokens(SubstraitTypeParser.Identifier) + else: + return self.getToken(SubstraitTypeParser.Identifier, i) + def Eq(self, i:int=None): + if i is None: + return self.getTokens(SubstraitTypeParser.Eq) + else: + return self.getToken(SubstraitTypeParser.Eq, i) + def expr(self, i:int=None): + if i is None: + return self.getTypedRuleContexts(SubstraitTypeParser.ExprContext) + else: + return self.getTypedRuleContext(SubstraitTypeParser.ExprContext,i) + + def type_(self): + return self.getTypedRuleContext(SubstraitTypeParser.TypeContext,0) + + def Newline(self, i:int=None): + if i is None: + return self.getTokens(SubstraitTypeParser.Newline) + else: + return self.getToken(SubstraitTypeParser.Newline, i) + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterMultilineDefinition" ): + listener.enterMultilineDefinition(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitMultilineDefinition" ): + listener.exitMultilineDefinition(self) + + + class TernaryContext(ExprContext): + + def __init__(self, parser, ctx:ParserRuleContext): # actually a SubstraitTypeParser.ExprContext + super().__init__(parser) + self.ifExpr = None # ExprContext + self.thenExpr = None # ExprContext + self.elseExpr = None # ExprContext + self.copyFrom(ctx) + + def QMark(self): + return self.getToken(SubstraitTypeParser.QMark, 0) + def Colon(self): + return self.getToken(SubstraitTypeParser.Colon, 0) + def expr(self, i:int=None): + if i is None: + return self.getTypedRuleContexts(SubstraitTypeParser.ExprContext) + else: + return self.getTypedRuleContext(SubstraitTypeParser.ExprContext,i) + + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterTernary" ): + listener.enterTernary(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitTernary" ): + listener.exitTernary(self) + + + class BinaryExprContext(ExprContext): + + def __init__(self, parser, ctx:ParserRuleContext): # actually a SubstraitTypeParser.ExprContext + super().__init__(parser) + self.left = None # ExprContext + self.op = None # Token + self.right = None # ExprContext + self.copyFrom(ctx) + + def expr(self, i:int=None): + if i is None: + return self.getTypedRuleContexts(SubstraitTypeParser.ExprContext) + else: + return self.getTypedRuleContext(SubstraitTypeParser.ExprContext,i) + + def And(self): + return self.getToken(SubstraitTypeParser.And, 0) + def Or(self): + return self.getToken(SubstraitTypeParser.Or, 0) + def Plus(self): + return self.getToken(SubstraitTypeParser.Plus, 0) + def Minus(self): + return self.getToken(SubstraitTypeParser.Minus, 0) + def Lt(self): + return self.getToken(SubstraitTypeParser.Lt, 0) + def Gt(self): + return self.getToken(SubstraitTypeParser.Gt, 0) + def Eq(self): + return self.getToken(SubstraitTypeParser.Eq, 0) + def NotEquals(self): + return self.getToken(SubstraitTypeParser.NotEquals, 0) + def Lte(self): + return self.getToken(SubstraitTypeParser.Lte, 0) + def Gte(self): + return self.getToken(SubstraitTypeParser.Gte, 0) + def Asterisk(self): + return self.getToken(SubstraitTypeParser.Asterisk, 0) + def ForwardSlash(self): + return self.getToken(SubstraitTypeParser.ForwardSlash, 0) + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterBinaryExpr" ): + listener.enterBinaryExpr(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitBinaryExpr" ): + listener.exitBinaryExpr(self) + + + class TypeParamContext(ExprContext): + + def __init__(self, parser, ctx:ParserRuleContext): # actually a SubstraitTypeParser.ExprContext + super().__init__(parser) + self.identifier = None # Token + self.isnull = None # Token + self.copyFrom(ctx) + + def Identifier(self): + return self.getToken(SubstraitTypeParser.Identifier, 0) + def QMark(self): + return self.getToken(SubstraitTypeParser.QMark, 0) + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterTypeParam" ): + listener.enterTypeParam(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitTypeParam" ): + listener.exitTypeParam(self) + + + class ParenExpressionContext(ExprContext): + + def __init__(self, parser, ctx:ParserRuleContext): # actually a SubstraitTypeParser.ExprContext + super().__init__(parser) + self.copyFrom(ctx) + + def OParen(self): + return self.getToken(SubstraitTypeParser.OParen, 0) + def expr(self): + return self.getTypedRuleContext(SubstraitTypeParser.ExprContext,0) + + def CParen(self): + return self.getToken(SubstraitTypeParser.CParen, 0) + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterParenExpression" ): + listener.enterParenExpression(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitParenExpression" ): + listener.exitParenExpression(self) + + + class FunctionCallContext(ExprContext): + + def __init__(self, parser, ctx:ParserRuleContext): # actually a SubstraitTypeParser.ExprContext + super().__init__(parser) + self.copyFrom(ctx) + + def Identifier(self): + return self.getToken(SubstraitTypeParser.Identifier, 0) + def OParen(self): + return self.getToken(SubstraitTypeParser.OParen, 0) + def CParen(self): + return self.getToken(SubstraitTypeParser.CParen, 0) + def expr(self, i:int=None): + if i is None: + return self.getTypedRuleContexts(SubstraitTypeParser.ExprContext) + else: + return self.getTypedRuleContext(SubstraitTypeParser.ExprContext,i) + + def Comma(self, i:int=None): + if i is None: + return self.getTokens(SubstraitTypeParser.Comma) + else: + return self.getToken(SubstraitTypeParser.Comma, i) + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterFunctionCall" ): + listener.enterFunctionCall(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitFunctionCall" ): + listener.exitFunctionCall(self) + + + class NotExprContext(ExprContext): + + def __init__(self, parser, ctx:ParserRuleContext): # actually a SubstraitTypeParser.ExprContext + super().__init__(parser) + self.copyFrom(ctx) + + def expr(self): + return self.getTypedRuleContext(SubstraitTypeParser.ExprContext,0) + + def Bang(self): + return self.getToken(SubstraitTypeParser.Bang, 0) + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterNotExpr" ): + listener.enterNotExpr(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitNotExpr" ): + listener.exitNotExpr(self) + + + class LiteralNumberContext(ExprContext): + + def __init__(self, parser, ctx:ParserRuleContext): # actually a SubstraitTypeParser.ExprContext + super().__init__(parser) + self.number = None # Token + self.copyFrom(ctx) + + def Number(self): + return self.getToken(SubstraitTypeParser.Number, 0) + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterLiteralNumber" ): + listener.enterLiteralNumber(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitLiteralNumber" ): + listener.exitLiteralNumber(self) + + + + def expr(self, _p:int=0): + _parentctx = self._ctx + _parentState = self.state + localctx = SubstraitTypeParser.ExprContext(self, self._ctx, _parentState) + _prevctx = localctx + _startState = 12 + self.enterRecursionRule(localctx, 12, self.RULE_expr, _p) + self._la = 0 # Token type + try: + self.enterOuterAlt(localctx, 1) + self.state = 233 + self._errHandler.sync(self) + la_ = self._interp.adaptivePredict(self._input,27,self._ctx) + if la_ == 1: + localctx = SubstraitTypeParser.ParenExpressionContext(self, localctx) + self._ctx = localctx + _prevctx = localctx + + self.state = 173 + self.match(SubstraitTypeParser.OParen) + self.state = 174 + self.expr(0) + self.state = 175 + self.match(SubstraitTypeParser.CParen) + pass + + elif la_ == 2: + localctx = SubstraitTypeParser.MultilineDefinitionContext(self, localctx) + self._ctx = localctx + _prevctx = localctx + self.state = 177 + self.match(SubstraitTypeParser.Identifier) + self.state = 178 + self.match(SubstraitTypeParser.Eq) + self.state = 179 + self.expr(0) + self.state = 181 + self._errHandler.sync(self) + _la = self._input.LA(1) + while True: + self.state = 180 + self.match(SubstraitTypeParser.Newline) + self.state = 183 + self._errHandler.sync(self) + _la = self._input.LA(1) + if not (_la==62): + break + + self.state = 195 + self._errHandler.sync(self) + _la = self._input.LA(1) + while _la==58: + self.state = 185 + self.match(SubstraitTypeParser.Identifier) + self.state = 186 + self.match(SubstraitTypeParser.Eq) + self.state = 187 + self.expr(0) + self.state = 189 + self._errHandler.sync(self) + _la = self._input.LA(1) + while True: + self.state = 188 + self.match(SubstraitTypeParser.Newline) + self.state = 191 + self._errHandler.sync(self) + _la = self._input.LA(1) + if not (_la==62): + break + + self.state = 197 + self._errHandler.sync(self) + _la = self._input.LA(1) + + self.state = 198 + localctx.finalType = self.type_() + self.state = 202 + self._errHandler.sync(self) + _alt = self._interp.adaptivePredict(self._input,23,self._ctx) + while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER: + if _alt==1: + self.state = 199 + self.match(SubstraitTypeParser.Newline) + self.state = 204 + self._errHandler.sync(self) + _alt = self._interp.adaptivePredict(self._input,23,self._ctx) + + pass + + elif la_ == 3: + localctx = SubstraitTypeParser.TypeLiteralContext(self, localctx) + self._ctx = localctx + _prevctx = localctx + self.state = 205 + self.type_() + pass + + elif la_ == 4: + localctx = SubstraitTypeParser.LiteralNumberContext(self, localctx) + self._ctx = localctx + _prevctx = localctx + self.state = 206 + localctx.number = self.match(SubstraitTypeParser.Number) + pass + + elif la_ == 5: + localctx = SubstraitTypeParser.TypeParamContext(self, localctx) + self._ctx = localctx + _prevctx = localctx + self.state = 207 + localctx.identifier = self.match(SubstraitTypeParser.Identifier) + self.state = 209 + self._errHandler.sync(self) + la_ = self._interp.adaptivePredict(self._input,24,self._ctx) + if la_ == 1: + self.state = 208 + localctx.isnull = self.match(SubstraitTypeParser.QMark) + + + pass + + elif la_ == 6: + localctx = SubstraitTypeParser.FunctionCallContext(self, localctx) + self._ctx = localctx + _prevctx = localctx + self.state = 211 + self.match(SubstraitTypeParser.Identifier) + self.state = 212 + self.match(SubstraitTypeParser.OParen) + self.state = 221 + self._errHandler.sync(self) + _la = self._input.LA(1) + if (((_la) & ~0x3f) == 0 and ((1 << _la) & 433475870770855922) != 0): + self.state = 213 + self.expr(0) + self.state = 218 + self._errHandler.sync(self) + _la = self._input.LA(1) + while _la==53: + self.state = 214 + self.match(SubstraitTypeParser.Comma) + self.state = 215 + self.expr(0) + self.state = 220 + self._errHandler.sync(self) + _la = self._input.LA(1) + + + + self.state = 223 + self.match(SubstraitTypeParser.CParen) + pass + + elif la_ == 7: + localctx = SubstraitTypeParser.IfExprContext(self, localctx) + self._ctx = localctx + _prevctx = localctx + self.state = 224 + self.match(SubstraitTypeParser.If) + self.state = 225 + localctx.ifExpr = self.expr(0) + self.state = 226 + self.match(SubstraitTypeParser.Then) + self.state = 227 + localctx.thenExpr = self.expr(0) + self.state = 228 + self.match(SubstraitTypeParser.Else) + self.state = 229 + localctx.elseExpr = self.expr(3) + pass + + elif la_ == 8: + localctx = SubstraitTypeParser.NotExprContext(self, localctx) + self._ctx = localctx + _prevctx = localctx + + self.state = 231 + self.match(SubstraitTypeParser.Bang) + self.state = 232 + self.expr(2) + pass + + + self._ctx.stop = self._input.LT(-1) + self.state = 246 + self._errHandler.sync(self) + _alt = self._interp.adaptivePredict(self._input,29,self._ctx) + while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER: + if _alt==1: + if self._parseListeners is not None: + self.triggerExitRuleEvent() + _prevctx = localctx + self.state = 244 + self._errHandler.sync(self) + la_ = self._interp.adaptivePredict(self._input,28,self._ctx) + if la_ == 1: + localctx = SubstraitTypeParser.BinaryExprContext(self, SubstraitTypeParser.ExprContext(self, _parentctx, _parentState)) + localctx.left = _prevctx + self.pushNewRecursionContext(localctx, _startState, self.RULE_expr) + self.state = 235 + if not self.precpred(self._ctx, 4): + from antlr4.error.Errors import FailedPredicateException + raise FailedPredicateException(self, "self.precpred(self._ctx, 4)") + self.state = 236 + localctx.op = self._input.LT(1) + _la = self._input.LA(1) + if not((((_la) & ~0x3f) == 0 and ((1 << _la) & 136296492171264) != 0)): + localctx.op = self._errHandler.recoverInline(self) + else: + self._errHandler.reportMatch(self) + self.consume() + self.state = 237 + localctx.right = self.expr(5) + pass + + elif la_ == 2: + localctx = SubstraitTypeParser.TernaryContext(self, SubstraitTypeParser.ExprContext(self, _parentctx, _parentState)) + localctx.ifExpr = _prevctx + self.pushNewRecursionContext(localctx, _startState, self.RULE_expr) + self.state = 238 + if not self.precpred(self._ctx, 1): + from antlr4.error.Errors import FailedPredicateException + raise FailedPredicateException(self, "self.precpred(self._ctx, 1)") + self.state = 239 + self.match(SubstraitTypeParser.QMark) + self.state = 240 + localctx.thenExpr = self.expr(0) + self.state = 241 + self.match(SubstraitTypeParser.Colon) + self.state = 242 + localctx.elseExpr = self.expr(2) + pass + + + self.state = 248 + self._errHandler.sync(self) + _alt = self._interp.adaptivePredict(self._input,29,self._ctx) + + except RecognitionException as re: + localctx.exception = re + self._errHandler.reportError(self, re) + self._errHandler.recover(self, re) + finally: + self.unrollRecursionContexts(_parentctx) + return localctx + + + + def sempred(self, localctx:RuleContext, ruleIndex:int, predIndex:int): + if self._predicates == None: + self._predicates = dict() + self._predicates[6] = self.expr_sempred + pred = self._predicates.get(ruleIndex, None) + if pred is None: + raise Exception("No predicate with index:" + str(ruleIndex)) + else: + return pred(localctx, predIndex) + + def expr_sempred(self, localctx:ExprContext, predIndex:int): + if predIndex == 0: + return self.precpred(self._ctx, 4) + + + if predIndex == 1: + return self.precpred(self._ctx, 1) + + + + + diff --git a/tests/test_derivation_expression.py b/tests/test_derivation_expression.py new file mode 100644 index 0000000..5df2e2d --- /dev/null +++ b/tests/test_derivation_expression.py @@ -0,0 +1,81 @@ +from substrait.gen.proto.type_pb2 import Type +from substrait.derivation_expression import evaluate + + +def test_simple_arithmetic(): + assert evaluate("1 + 1") == 2 + + +def test_simple_arithmetic_with_variables(): + assert evaluate("1 + var", {"var": 2}) == 3 + + +def test_simple_arithmetic_parenthesis(): + assert evaluate("(1 + var) * 3", {"var": 2}) == 9 + + +def test_min_max(): + assert evaluate("min(var, 7) + max(var, 7)", {"var": 5}) == 12 + + +def test_ternary(): + assert evaluate("var > 3 ? 1 : 0", {"var": 5}) == 1 + assert evaluate("var > 3 ? 1 : 0", {"var": 2}) == 0 + + +def test_multiline(): + assert ( + evaluate( + """temp = min(var, 7) + max(var, 7) +decimal""", + {"var": 5}, + ) + == Type(decimal=Type.Decimal(precision=13, scale=11)) + ) + + +def test_simple_data_types(): + assert evaluate("i8") == Type(i8=Type.I8()) + assert evaluate("i16") == Type(i16=Type.I16()) + assert evaluate("i32") == Type(i32=Type.I32()) + assert evaluate("i64") == Type(i64=Type.I64()) + assert evaluate("fp32") == Type(fp32=Type.FP32()) + assert evaluate("fp64") == Type(fp64=Type.FP64()) + assert evaluate("boolean") == Type(bool=Type.Boolean()) + + +def test_data_type(): + assert evaluate("decimal

", {"S": 10, "P": 20}) == Type( + decimal=Type.Decimal(precision=21, scale=11) + ) + + +def test_decimal_example(): + def func(P1, S1, P2, S2): + init_scale = max(S1, S2) + init_prec = init_scale + max(P1 - S1, P2 - S2) + 1 + min_scale = min(init_scale, 6) + delta = init_prec - 38 + prec = min(init_prec, 38) + scale_after_borrow = max(init_scale - delta, min_scale) + scale = scale_after_borrow if init_prec > 38 else init_scale + return Type(decimal=Type.Decimal(precision=prec, scale=scale)) + + args = {"P1": 10, "S1": 8, "P2": 14, "S2": 2} + + func_eval = func(**args) + + assert ( + evaluate( + """init_scale = max(S1,S2) +init_prec = init_scale + max(P1 - S1, P2 - S2) + 1 +min_scale = min(init_scale, 6) +delta = init_prec - 38 +prec = min(init_prec, 38) +scale_after_borrow = max(init_scale - delta, min_scale) +scale = init_prec > 38 ? scale_after_borrow : init_scale +DECIMAL""", + args, + ) + == func_eval + ) \ No newline at end of file From 2ecefe645ae93da422c4b36b97b1e02e536a10bd Mon Sep 17 00:00:00 2001 From: tokoko Date: Thu, 10 Oct 2024 22:00:41 +0000 Subject: [PATCH 2/2] make antlr optional dependency --- pyproject.toml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index cf395e9..df22a83 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -5,15 +5,16 @@ authors = [{name = "Substrait contributors", email = "substrait@googlegroups.com license = {text = "Apache-2.0"} readme = "README.md" requires-python = ">=3.8.1" -dependencies = ["protobuf >= 3.20", "antlr4-python3-runtime"] +dependencies = ["protobuf >= 3.20"] dynamic = ["version"] [tool.setuptools_scm] write_to = "src/substrait/_version.py" [project.optional-dependencies] +extensions = ["antlr4-python3-runtime"] gen_proto = ["protobuf == 3.20.1", "protoletariat >= 2.0.0"] -test = ["pytest >= 7.0.0"] +test = ["pytest >= 7.0.0", "antlr4-python3-runtime"] [tool.pytest.ini_options] pythonpath = "src"