Open alancai98 opened 1 year ago
Above reproduction case was run in LEGACY typing mode. Running it in PERMISSIVE typing mode doesn't result in an error. But running a similar query with GROUP BY in PERMISSIVE mode causes the CLI to exit:
Welcome to the PartiQL shell!
Typing mode: PERMISSIVE
Using version: 0.9.3-SNAPSHOT-7e1ffd45
PartiQL> SELECT t.b
| FROM <<{'a': 1, 'b': 2},{'a': 1, 'b': 3}, {'a': 2, 'b': 10}>> AS t
| GROUP BY t.a;
==='
org.partiql.lang.eval.EvaluationException: Variable not in GROUP BY or aggregation function: t
Evaluator Error: at line 1, column 8: Variable 't' must appear in the GROUP BY clause or be used in an aggregation function
at org.partiql.lang.eval.ExceptionsKt.err(Exceptions.kt:59)
at org.partiql.lang.eval.EvaluatingCompiler$compileId$$inlined$thunkEnv$partiql_lang$1$1.invoke(Thunk.kt:718)
at org.partiql.lang.eval.EvaluatingCompiler$compileId$$inlined$thunkEnv$partiql_lang$1$1.invoke(Thunk.kt:137)
at org.partiql.lang.eval.PermissiveThunkFactory.handleException(Thunk.kt:699)
at org.partiql.lang.eval.EvaluatingCompiler$compileId$$inlined$thunkEnv$partiql_lang$1.invoke(Thunk.kt:217)
at org.partiql.lang.eval.EvaluatingCompiler$compileId$$inlined$thunkEnv$partiql_lang$1.invoke(Thunk.kt:137)
at org.partiql.lang.eval.EvaluatingCompiler$compilePath$$inlined$thunkEnv$partiql_lang$1$1.invoke(Thunk.kt:712)
at org.partiql.lang.eval.EvaluatingCompiler$compilePath$$inlined$thunkEnv$partiql_lang$1$1.invoke(Thunk.kt:137)
at org.partiql.lang.eval.PermissiveThunkFactory.handleException(Thunk.kt:699)
at org.partiql.lang.eval.EvaluatingCompiler$compilePath$$inlined$thunkEnv$partiql_lang$1.invoke(Thunk.kt:217)
at org.partiql.lang.eval.EvaluatingCompiler$compilePath$$inlined$thunkEnv$partiql_lang$1.invoke(Thunk.kt:137)
at org.partiql.lang.eval.EvaluatingCompiler$compileSelect$1$5$$special$$inlined$thunkEnvValueList$partiql_lang$1$1.invoke(Thunk.kt:716)
at org.partiql.lang.eval.EvaluatingCompiler$compileSelect$1$5$$special$$inlined$thunkEnvValueList$partiql_lang$1$1.invoke(Thunk.kt:137)
at org.partiql.lang.eval.PermissiveThunkFactory.handleException(Thunk.kt:699)
at org.partiql.lang.eval.EvaluatingCompiler$compileSelect$1$5$$special$$inlined$thunkEnvValueList$partiql_lang$1.invoke(Thunk.kt:349)
at org.partiql.lang.eval.EvaluatingCompiler$compileSelect$1$5$$special$$inlined$thunkEnvValueList$partiql_lang$1.invoke(Thunk.kt:137)
at org.partiql.lang.eval.EvaluatingCompiler$createFilterHavingAndProjectClosure$2.invoke(EvaluatingCompiler.kt:2145)
at org.partiql.lang.eval.EvaluatingCompiler$createFilterHavingAndProjectClosure$2.invoke(EvaluatingCompiler.kt:123)
at org.partiql.lang.eval.EvaluatingCompiler$compileSelect$1$2$getQueryThunk$$inlined$thunkEnv$partiql_lang$3$1$lambda$2.invoke(EvaluatingCompiler.kt:1879)
at org.partiql.lang.eval.EvaluatingCompiler$compileSelect$1$2$getQueryThunk$$inlined$thunkEnv$partiql_lang$3$1$lambda$2.invoke(EvaluatingCompiler.kt:123)
at kotlin.sequences.TransformingSequence$iterator$1.next(Sequences.kt:210)
at kotlin.sequences.FilteringSequence$iterator$1.calcNext(Sequences.kt:170)
at kotlin.sequences.FilteringSequence$iterator$1.hasNext(Sequences.kt:194)
at org.partiql.lang.util.ConfigurableExprValueFormatter$PrettyFormatter.prettyPrintContainer(ExprValueFormatter.kt:90)
at org.partiql.lang.util.ConfigurableExprValueFormatter$PrettyFormatter.prettyPrintContainer$default(ExprValueFormatter.kt:85)
at org.partiql.lang.util.ConfigurableExprValueFormatter$PrettyFormatter.recursivePrettyPrint(ExprValueFormatter.kt:72)
at org.partiql.lang.util.ConfigurableExprValueFormatter.formatTo(ExprValueFormatter.kt:37)
at org.partiql.cli.shell.Shell.printExprValue(Shell.kt:277)
at org.partiql.cli.shell.Shell.printPartiQLResult(Shell.kt:258)
at org.partiql.cli.shell.Shell.executeAndPrint(Shell.kt:249)
at org.partiql.cli.shell.Shell.run(Shell.kt:232)
at org.partiql.cli.shell.Shell.start(Shell.kt:120)
at org.partiql.cli.pico.PartiQLCommand.runShell(PartiQLCommand.kt:104)
at org.partiql.cli.pico.PartiQLCommand.run(PartiQLCommand.kt:69)
at picocli.CommandLine.executeUserObject(CommandLine.java:2026)
at picocli.CommandLine.access$1500(CommandLine.java:148)
at picocli.CommandLine$RunLast.executeUserObjectOfLastSubcommandWithSameParent(CommandLine.java:2461)
at picocli.CommandLine$RunLast.handle(CommandLine.java:2453)
at picocli.CommandLine$RunLast.handle(CommandLine.java:2415)
at picocli.CommandLine$AbstractParseResultHandler.execute(CommandLine.java:2273)
at picocli.CommandLine$RunLast.execute(CommandLine.java:2417)
at picocli.CommandLine.execute(CommandLine.java:2170)
at org.partiql.cli.Main.main(Main.kt:34)
It is likely that these examples are other instances of the problem described in #1002.
I was playing around with the CLI and noticed that some "bad" queries cause the CLI to exit while some others do not.
Example erroring query that causes CLI to exit:
SELECT foo FROM <<{'a': 1, 'b': 2},{'a': 1, 'b': 3}, {'a': 2, 'b': 10}>> AS t;
Example erroring query that does not cause CLI to exit:
foo + 1
.To Reproduce
Steps to reproduce the behavior:
partiql-lang-kotlin
./partiql-cli/build/install/partiql-cli/bin/partiql
or./partiql-cli/partiql.sh
SELECT foo FROM <<{'a': 1, 'b': 2},{'a': 1, 'b': 3}, {'a': 2, 'b': 10}>> AS t;
CLI exits with the following error:
Expected Behavior
Additional Context