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

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

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

origin: io.prestosql/presto-parser

public static Query singleValueQuery(String columnName, boolean value)
{
  Relation values = values(row(value ? TRUE_LITERAL : FALSE_LITERAL));
  return simpleQuery(
      selectList(new AllColumns()),
      aliased(values, "t", ImmutableList.of(columnName)));
}
origin: prestosql/presto

public static Query singleValueQuery(String columnName, boolean value)
{
  Relation values = values(row(value ? TRUE_LITERAL : FALSE_LITERAL));
  return simpleQuery(
      selectList(new AllColumns()),
      aliased(values, "t", ImmutableList.of(columnName)));
}
origin: prestosql/presto

private static QuerySpecification createSelect123()
{
  return new QuerySpecification(
      selectList(new LongLiteral("123")),
      Optional.empty(),
      Optional.empty(),
      Optional.empty(),
      Optional.empty(),
      Optional.empty(),
      Optional.empty());
}
origin: io.prestosql/presto-parser

public static Query singleValueQuery(String columnName, String value)
{
  Relation values = values(row(new StringLiteral((value))));
  return simpleQuery(
      selectList(new AllColumns()),
      aliased(values, "t", ImmutableList.of(columnName)));
}
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: 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: 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 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 testExplainAnalyze()
{
  assertStatement("EXPLAIN ANALYZE SELECT * FROM t",
      new Explain(simpleQuery(selectList(new AllColumns()), table(QualifiedName.of("t"))), true, false, 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 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 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: 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 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: prestosql/presto

@Test
public void testImplicitJoin()
{
  assertStatement("SELECT * FROM a, b",
      simpleQuery(selectList(new AllColumns()),
          new Join(Join.Type.IMPLICIT,
              new Table(QualifiedName.of("a")),
              new Table(QualifiedName.of("b")),
              Optional.empty())));
}
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 testPrepareWithParameters()
{
  assertStatement("PREPARE myquery FROM SELECT ?, ? FROM foo",
      new Prepare(identifier("myquery"), simpleQuery(
          selectList(new Parameter(0), new Parameter(1)),
          table(QualifiedName.of("foo")))));
}
origin: prestosql/presto

@Test
public void testValues()
{
  Query valuesQuery = query(values(
      row(new StringLiteral("a"), new LongLiteral("1"), new DoubleLiteral("2.2")),
      row(new StringLiteral("b"), new LongLiteral("2"), new DoubleLiteral("3.3"))));
  assertStatement("VALUES ('a', 1, 2.2e0), ('b', 2, 3.3e0)", valuesQuery);
  assertStatement("SELECT * FROM (VALUES ('a', 1, 2.2e0), ('b', 2, 3.3e0))",
      simpleQuery(
          selectList(new AllColumns()),
          subquery(valuesQuery)));
}
io.prestosql.sqlQueryUtilselectList

Popular methods of QueryUtil

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

Popular in Java

  • Start an intent from android
  • setContentView (Activity)
  • orElseThrow (Optional)
    Return the contained value, if present, otherwise throw an exception to be created by the provided s
  • scheduleAtFixedRate (ScheduledExecutorService)
  • Queue (java.util)
    A collection designed for holding elements prior to processing. Besides basic java.util.Collection o
  • StringTokenizer (java.util)
    Breaks a string into tokens; new code should probably use String#split.> // Legacy code: StringTo
  • ThreadPoolExecutor (java.util.concurrent)
    An ExecutorService that executes each submitted task using one of possibly several pooled threads, n
  • JarFile (java.util.jar)
    JarFile is used to read jar entries and their associated data from jar files.
  • IOUtils (org.apache.commons.io)
    General IO stream manipulation utilities. This class provides static utility methods for input/outpu
  • LoggerFactory (org.slf4j)
    The LoggerFactory is a utility class producing Loggers for various logging APIs, most notably for lo
  • 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