Tabnine Logo
QueryUtil.table
Code IndexAdd Tabnine to your IDE (free)

How to use
table
method
in
io.prestosql.sql.QueryUtil

Best Java code snippets using io.prestosql.sql.QueryUtil.table (Showing top 20 results out of 315)

origin: io.prestosql/presto-main

@Test
public void testPrepare()
{
  Query query = simpleQuery(selectList(new AllColumns()), table(QualifiedName.of("foo")));
  String sqlString = "PREPARE my_query FROM SELECT * FROM foo";
  Map<String, String> statements = executePrepare("my_query", query, sqlString, TEST_SESSION);
  assertEquals(statements, ImmutableMap.of("my_query", "SELECT *\nFROM\n  foo\n"));
}
origin: prestosql/presto

@Test
public void testPrepare()
{
  Query query = simpleQuery(selectList(new AllColumns()), table(QualifiedName.of("foo")));
  String sqlString = "PREPARE my_query FROM SELECT * FROM foo";
  Map<String, String> statements = executePrepare("my_query", query, sqlString, TEST_SESSION);
  assertEquals(statements, ImmutableMap.of("my_query", "SELECT *\nFROM\n  foo\n"));
}
origin: io.prestosql/presto-main

@Test
public void testSelectStatement()
{
  PreparedQuery preparedQuery = QUERY_PREPARER.prepareQuery(TEST_SESSION, "SELECT * FROM foo");
  assertEquals(preparedQuery.getStatement(),
      simpleQuery(selectList(new AllColumns()), table(QualifiedName.of("foo"))));
}
origin: prestosql/presto

@Test
public void testSelectStatement()
{
  PreparedQuery preparedQuery = QUERY_PREPARER.prepareQuery(TEST_SESSION, "SELECT * FROM foo");
  assertEquals(preparedQuery.getStatement(),
      simpleQuery(selectList(new AllColumns()), table(QualifiedName.of("foo"))));
}
origin: prestosql/presto

@Test
public void testDelete()
{
  assertStatement("DELETE FROM t", new Delete(table(QualifiedName.of("t")), Optional.empty()));
  assertStatement("DELETE FROM \"awesome table\"", new Delete(table(QualifiedName.of("awesome table")), Optional.empty()));
  assertStatement("DELETE FROM t WHERE a = b", new Delete(table(QualifiedName.of("t")), Optional.of(
      new ComparisonExpression(ComparisonExpression.Operator.EQUAL,
          new Identifier("a"),
          new Identifier("b")))));
}
origin: prestosql/presto

@Test
public void testPrepareNameExists()
{
  Session session = testSessionBuilder()
      .addPreparedStatement("my_query", "SELECT bar, baz from foo")
      .build();
  Query query = simpleQuery(selectList(new AllColumns()), table(QualifiedName.of("foo")));
  String sqlString = "PREPARE my_query FROM SELECT * FROM foo";
  Map<String, String> statements = executePrepare("my_query", query, sqlString, session);
  assertEquals(statements, ImmutableMap.of("my_query", "SELECT *\nFROM\n  foo\n"));
}
origin: prestosql/presto

@Test
public void testDoubleInQuery()
{
  assertStatement("SELECT 123.456E7 FROM DUAL",
      simpleQuery(
          selectList(new DoubleLiteral("123.456E7")),
          table(QualifiedName.of("DUAL"))));
}
origin: prestosql/presto

@Test
public void testExplainAnalyze()
{
  assertStatement("EXPLAIN ANALYZE SELECT * FROM t",
      new Explain(simpleQuery(selectList(new AllColumns()), table(QualifiedName.of("t"))), true, false, ImmutableList.of()));
}
origin: io.prestosql/presto-main

@Test
public void testPrepareNameExists()
{
  Session session = testSessionBuilder()
      .addPreparedStatement("my_query", "SELECT bar, baz from foo")
      .build();
  Query query = simpleQuery(selectList(new AllColumns()), table(QualifiedName.of("foo")));
  String sqlString = "PREPARE my_query FROM SELECT * FROM foo";
  Map<String, String> statements = executePrepare("my_query", query, sqlString, session);
  assertEquals(statements, ImmutableMap.of("my_query", "SELECT *\nFROM\n  foo\n"));
}
origin: prestosql/presto

@Test
public void testExplainVerbose()
{
  assertStatement("EXPLAIN VERBOSE SELECT * FROM t",
      new Explain(simpleQuery(selectList(new AllColumns()), table(QualifiedName.of("t"))), false, true, ImmutableList.of()));
}
origin: prestosql/presto

@Test
public void testExplainAnalyzeVerbose()
{
  assertStatement("EXPLAIN ANALYZE VERBOSE SELECT * FROM t",
      new Explain(simpleQuery(selectList(new AllColumns()), table(QualifiedName.of("t"))), true, true, ImmutableList.of()));
}
origin: prestosql/presto

@Test
public void testInsertInto()
{
  QualifiedName table = QualifiedName.of("a");
  Query query = simpleQuery(selectList(new AllColumns()), table(QualifiedName.of("t")));
  assertStatement("INSERT INTO a SELECT * FROM t",
      new Insert(table, Optional.empty(), query));
  assertStatement("INSERT INTO a (c1, c2) SELECT * FROM t",
      new Insert(table, Optional.of(ImmutableList.of(identifier("c1"), identifier("c2"))), query));
}
origin: prestosql/presto

@Test
public void testExecuteStatement()
{
  Session session = testSessionBuilder()
      .addPreparedStatement("my_query", "SELECT * FROM foo")
      .build();
  PreparedQuery preparedQuery = QUERY_PREPARER.prepareQuery(session, "EXECUTE my_query");
  assertEquals(preparedQuery.getStatement(),
      simpleQuery(selectList(new AllColumns()), table(QualifiedName.of("foo"))));
}
origin: prestosql/presto

@Test
public void testExplainAnalyzeVerboseTypeDistributed()
{
  assertStatement("EXPLAIN ANALYZE VERBOSE (type DISTRIBUTED) SELECT * FROM t",
      new Explain(simpleQuery(selectList(new AllColumns()), table(QualifiedName.of("t"))), true, true, ImmutableList.of(new ExplainType(ExplainType.Type.DISTRIBUTED))));
}
origin: prestosql/presto

@Test
public void testExplainVerboseTypeLogical()
{
  assertStatement("EXPLAIN VERBOSE (type LOGICAL) SELECT * FROM t",
      new Explain(simpleQuery(selectList(new AllColumns()), table(QualifiedName.of("t"))), false, true, ImmutableList.of(new ExplainType(ExplainType.Type.LOGICAL))));
}
origin: io.prestosql/presto-main

@Test
public void testExecuteStatement()
{
  Session session = testSessionBuilder()
      .addPreparedStatement("my_query", "SELECT * FROM foo")
      .build();
  PreparedQuery preparedQuery = QUERY_PREPARER.prepareQuery(session, "EXECUTE my_query");
  assertEquals(preparedQuery.getStatement(),
      simpleQuery(selectList(new AllColumns()), table(QualifiedName.of("foo"))));
}
origin: prestosql/presto

@Test
public void testExplainAnalyzeTypeDistributed()
{
  assertStatement("EXPLAIN ANALYZE (type DISTRIBUTED) SELECT * FROM t",
      new Explain(simpleQuery(selectList(new AllColumns()), table(QualifiedName.of("t"))), true, false, ImmutableList.of(new ExplainType(ExplainType.Type.DISTRIBUTED))));
}
origin: prestosql/presto

@Test
public void testCreateView()
{
  Query query = simpleQuery(selectList(new AllColumns()), table(QualifiedName.of("t")));
  assertStatement("CREATE VIEW a AS SELECT * FROM t", new CreateView(QualifiedName.of("a"), query, false, Optional.empty()));
  assertStatement("CREATE OR REPLACE VIEW a AS SELECT * FROM t", new CreateView(QualifiedName.of("a"), query, true, Optional.empty()));
  assertStatement("CREATE VIEW a SECURITY DEFINER AS SELECT * FROM t", new CreateView(QualifiedName.of("a"), query, false, Optional.of(CreateView.Security.DEFINER)));
  assertStatement("CREATE VIEW a SECURITY INVOKER AS SELECT * FROM t", new CreateView(QualifiedName.of("a"), query, false, Optional.of(CreateView.Security.INVOKER)));
  assertStatement("CREATE VIEW bar.foo AS SELECT * FROM t", new CreateView(QualifiedName.of("bar", "foo"), query, false, Optional.empty()));
  assertStatement("CREATE VIEW \"awesome view\" AS SELECT * FROM t", new CreateView(QualifiedName.of("awesome view"), query, false, Optional.empty()));
  assertStatement("CREATE VIEW \"awesome schema\".\"awesome view\" AS SELECT * FROM t", new CreateView(QualifiedName.of("awesome schema", "awesome view"), query, false, Optional.empty()));
}
origin: prestosql/presto

@Test
public void testPrepare()
{
  assertStatement("PREPARE myquery FROM select * from foo",
      new Prepare(identifier("myquery"), simpleQuery(
          selectList(new AllColumns()),
          table(QualifiedName.of("foo")))));
}
origin: prestosql/presto

@Test
public void testPrepareWithParameters()
{
  assertStatement("PREPARE myquery FROM SELECT ?, ? FROM foo",
      new Prepare(identifier("myquery"), simpleQuery(
          selectList(new Parameter(0), new Parameter(1)),
          table(QualifiedName.of("foo")))));
}
io.prestosql.sqlQueryUtiltable

Popular methods of QueryUtil

  • identifier
  • selectList
  • simpleQuery
  • row
  • values
  • aliased
  • query
  • aliasedName
  • aliasedNullToEmpty
  • ascending
  • equal
  • functionCall
  • equal,
  • functionCall,
  • logicalAnd,
  • ordering,
  • quotedIdentifier,
  • selectAll,
  • singleValueQuery,
  • subquery

Popular in Java

  • Reactive rest calls using spring rest template
  • scheduleAtFixedRate (ScheduledExecutorService)
  • orElseThrow (Optional)
    Return the contained value, if present, otherwise throw an exception to be created by the provided s
  • findViewById (Activity)
  • EOFException (java.io)
    Thrown when a program encounters the end of a file or stream during an input operation.
  • PrintStream (java.io)
    Fake signature of an existing Java class.
  • MalformedURLException (java.net)
    This exception is thrown when a program attempts to create an URL from an incorrect specification.
  • Permission (java.security)
    Legacy security code; do not use.
  • TreeMap (java.util)
    Walk the nodes of the tree left-to-right or right-to-left. Note that in descending iterations, next
  • BlockingQueue (java.util.concurrent)
    A java.util.Queue that additionally supports operations that wait for the queue to become non-empty
  • Top plugins for WebStorm
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now