Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

[[and {{ds}}]] not supported #57

Open
yingxuanwangxuan opened this issue Nov 16, 2022 · 1 comment
Open

[[and {{ds}}]] not supported #57

yingxuanwangxuan opened this issue Nov 16, 2022 · 1 comment

Comments

@yingxuanwangxuan
Copy link

{:sql
"-- Metabase:: userID: 153 queryType: native queryHash: 8a52ef18dd2c9c71fb33736dfb5dd43b9da3492fedf415eec5b90f8cd556f4df\nselect \n-- count(1) \n* \nfrom mysql_bi.luoge_bi_dim.ds_info_3 where 1=1 and from_iso8601_timestamp(?)",
:params ["2022-11-15T00:00:00+08:00"],
:type :invalid-query}}],
:error_type :invalid-query,
:json_query
{:type "native",
:native
{:query "select \n-- count(1) \n* \nfrom mysql_bi.luoge_bi_dim.ds_info_3 where 1=1 [[and {{ds}}]]",
:template-tags
{:ds
{:id "f7c63f44-4196-57c4-7026-a26bbc006ede",
:name "ds",
:display-name "Ds",
:type "date",
:default "2022-11-15",
:required true}}},
:database 89,
:parameters [],
:middleware {:js-int-to-string? true, :add-default-userland-constraints? true}},
:status :failed,
:class io.trino.jdbc.$internal.client.FailureInfo$FailureException,
:stacktrace
["io.trino.sql.analyzer.SemanticExceptions.semanticException(SemanticExceptions.java:48)"
"io.trino.sql.analyzer.SemanticExceptions.semanticException(SemanticExceptions.java:43)"
"io.trino.sql.analyzer.ExpressionAnalyzer$Visitor.coerceType(ExpressionAnalyzer.java:3187)"
"io.trino.sql.analyzer.ExpressionAnalyzer$Visitor.coerceType(ExpressionAnalyzer.java:3196)"
"io.trino.sql.analyzer.ExpressionAnalyzer$Visitor.visitLogicalExpression(ExpressionAnalyzer.java:787)"
"io.trino.sql.analyzer.ExpressionAnalyzer$Visitor.visitLogicalExpression(ExpressionAnalyzer.java:581)"
"io.trino.sql.tree.LogicalExpression.accept(LogicalExpression.java:80)"
"io.trino.sql.tree.StackableAstVisitor.process(StackableAstVisitor.java:27)"
"io.trino.sql.analyzer.ExpressionAnalyzer$Visitor.process(ExpressionAnalyzer.java:604)"
"io.trino.sql.analyzer.ExpressionAnalyzer.analyze(ExpressionAnalyzer.java:485)"
"io.trino.sql.analyzer.ExpressionAnalyzer.analyzeExpression(ExpressionAnalyzer.java:3497)"
"io.trino.sql.analyzer.StatementAnalyzer$Visitor.analyzeExpression(StatementAnalyzer.java:4110)"
"io.trino.sql.analyzer.StatementAnalyzer$Visitor.analyzeWhere(StatementAnalyzer.java:3941)"
"io.trino.sql.analyzer.StatementAnalyzer$Visitor.lambda$visitQuerySpecification$38(StatementAnalyzer.java:2459)"
"java.base/java.util.Optional.ifPresent(Optional.java:178)"
"io.trino.sql.analyzer.StatementAnalyzer$Visitor.visitQuerySpecification(StatementAnalyzer.java:2459)"
"io.trino.sql.analyzer.StatementAnalyzer$Visitor.visitQuerySpecification(StatementAnalyzer.java:456)"
"io.trino.sql.tree.QuerySpecification.accept(QuerySpecification.java:155)"
"io.trino.sql.tree.AstVisitor.process(AstVisitor.java:27)"
"io.trino.sql.analyzer.StatementAnalyzer$Visitor.process(StatementAnalyzer.java:473)"
"io.trino.sql.analyzer.StatementAnalyzer$Visitor.process(StatementAnalyzer.java:481)"
"io.trino.sql.analyzer.StatementAnalyzer$Visitor.visitQuery(StatementAnalyzer.java:1405)"
"io.trino.sql.analyzer.StatementAnalyzer$Visitor.visitQuery(StatementAnalyzer.java:456)"
"io.trino.sql.tree.Query.accept(Query.java:107)"
"io.trino.sql.tree.AstVisitor.process(AstVisitor.java:27)"
"io.trino.sql.analyzer.StatementAnalyzer$Visitor.process(StatementAnalyzer.java:473)"
"io.trino.sql.analyzer.StatementAnalyzer.analyze(StatementAnalyzer.java:435)"
"io.trino.sql.analyzer.Analyzer.analyze(Analyzer.java:79)"
"io.trino.sql.analyzer.Analyzer.analyze(Analyzer.java:71)"
"io.trino.execution.SqlQueryExecution.analyze(SqlQueryExecution.java:261)"
"io.trino.execution.SqlQueryExecution.(SqlQueryExecution.java:199)"
"io.trino.execution.SqlQueryExecution$SqlQueryExecutionFactory.createQueryExecution(SqlQueryExecution.java:825)"
"io.trino.dispatcher.LocalDispatchQueryFactory.lambda$createDispatchQuery$0(LocalDispatchQueryFactory.java:135)"
"io.trino.$gen.Trino_394____20221027_023829_2.call(Unknown Source)"
"com.google.common.util.concurrent.TrustedListenableFutureTask$TrustedFutureInterruptibleTask.runInterruptibly(TrustedListenableFutureTask.java:131)"
"com.google.common.util.concurrent.InterruptibleTask.run(InterruptibleTask.java:74)"
"com.google.common.util.concurrent.TrustedListenableFutureTask.run(TrustedListenableFutureTask.java:82)"
"java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)"
"java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)"
"java.base/java.lang.Thread.run(Thread.java:833)"
nil],
:context :ad-hoc,
:error
"Query failed (#20221116_114500_00891_fkerh): line 4:20: Logical expression term must evaluate to a boolean (actual: timestamp(3) with time zone)",
:row_count 0,
:running_time 0,
:data {:rows [], :cols []}}

@leniartek
Copy link

@yingxuanwangxuan can you provide some more context around this issue?
What are you trying to achieve?
What version of Starburst/Trino you are using?

@leniartek leniartek changed the title [[and {{ds}}]] not suppert [[and {{ds}}]] not supported Nov 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants