我有一个清单表,其中包含帐户/版本组合的最新处理时间戳。我想过滤一个原始事件表,只给出基于帐户/版本组合的最新未处理时间戳。
-- ERROR: This type of correlated subquery pattern is not supported due to
-- internal error
FROM events e
WHERE
CASE WHEN (e.account_id, e.app_version, e.app_build)
IN (SELECT DISTINCT account_id, app_version, app_build FROM manifest)
THEN
tstamp > (SELECT last_processed_tstamp FROM manifest m
WHERE m.account_id = e.account_id
AND m.app_version = e.app_version
AND m.app_build = e.app_build)
ELSE
1=1
END
奇怪的是,如果我只检查CASE-WHEN中的一列,它可以正常工作
-- Somehow this works
FROM events e
WHERE
CASE WHEN e.account_id IN (SELECT DISTINCT account_id FROM manifest)
THEN
tstamp > (SELECT last_processed_tstamp FROM manifest m
WHERE m.account_id = e.account_id
AND m.app_version = e.app_version
AND m.app_build = e.app_build)
ELSE
1=1
END
不幸的是,虽然这是错误的逻辑,因为它没有通过正确的帐户/版本组合进行过滤。非常感谢任何帮助。感谢。
答案 0 :(得分:0)
您可以使用OR。
library(shiny)
library(ggplot2)
ui <- fluidPage(
# Generate a row with a sidebar
sidebarLayout(
# Define the sidebar with one input
sidebarPanel(
selectInput("word", "Word",
choices=c('Hits1','Hits2'),
selected='Hits1'
)),
# Create a spot for the lineplot
mainPanel(
plotOutput(outputId="lineplot")
)
))
# Define a server for the Shiny app
server <- function(input, output) {
# Fill in the spot we created for a plot
output$lineplot <- renderPlot({
# Render a lineplot
ggplot(datatest, aes_(x=as.name("Date"), y=as.name(input$word), group=1)) + geom_line()
})
}
shinyApp(ui, server)
我会打破子选择以确保你只运行一次。