QueryUtil.identifier
Code IndexAdd Codota to your IDE (free)

Best code snippets using com.facebook.presto.sql.QueryUtil.identifier(Showing top 15 results out of 315)

origin: prestodb/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: prestodb/presto

@Test
public void testCreateTableNotExistsTrue()
{
  CreateTable statement = new CreateTable(QualifiedName.of("test_table"),
      ImmutableList.of(new ColumnDefinition(identifier("a"), "BIGINT", Optional.empty())),
      true,
      ImmutableList.of(),
      Optional.empty());
  getFutureValue(new CreateTableTask().internalExecute(statement, metadata, new AllowAllAccessControl(), testSession, emptyList()));
  assertEquals(metadata.getCreateTableCallCount(), 1);
}
origin: prestodb/presto

@Test
public void testRevoke()
{
  assertStatement("REVOKE INSERT, DELETE ON t FROM u",
      new Revoke(false, Optional.of(ImmutableList.of("INSERT", "DELETE")), false, QualifiedName.of("t"), identifier("u")));
  assertStatement("REVOKE GRANT OPTION FOR SELECT ON t FROM PUBLIC",
      new Revoke(true, Optional.of(ImmutableList.of("SELECT")), false, QualifiedName.of("t"), identifier("PUBLIC")));
  assertStatement("REVOKE ALL PRIVILEGES ON TABLE t FROM u",
      new Revoke(false, Optional.empty(), true, QualifiedName.of("t"), identifier("u")));
  assertStatement("REVOKE taco ON TABLE t FROM u",
      new Revoke(false, Optional.of(ImmutableList.of("taco")), true, QualifiedName.of("t"), identifier("u")));
}
origin: prestodb/presto

@Test
public void testShowSchemas()
{
  assertStatement("SHOW SCHEMAS", new ShowSchemas(Optional.empty(), Optional.empty()));
  assertStatement("SHOW SCHEMAS FROM foo", new ShowSchemas(Optional.of(identifier("foo")), Optional.empty()));
  assertStatement("SHOW SCHEMAS IN foo LIKE '%'", new ShowSchemas(Optional.of(identifier("foo")), Optional.of("%")));
}
origin: prestodb/presto

public static Relation aliased(Relation relation, String alias, List<String> columnAliases)
{
  return new AliasedRelation(
      relation,
      identifier(alias),
      columnAliases.stream()
          .map(QueryUtil::identifier)
          .collect(Collectors.toList()));
}
origin: prestodb/presto

@Test
public void testAddColumn()
{
  assertStatement("ALTER TABLE foo.t ADD COLUMN c bigint", new AddColumn(QualifiedName.of("foo", "t"), new ColumnDefinition(identifier("c"), "bigint", Optional.empty())));
}
origin: prestodb/presto

@Test
public void testExecuteWithUsing()
{
  assertStatement("EXECUTE myquery USING 1, 'abc', ARRAY ['hello']",
      new Execute(identifier("myquery"), ImmutableList.of(new LongLiteral("1"), new StringLiteral("abc"), new ArrayConstructor(ImmutableList.of(new StringLiteral("hello"))))));
}
origin: prestodb/presto

@Test
public void testDropColumn()
{
  assertStatement("ALTER TABLE foo.t DROP COLUMN c", new DropColumn(QualifiedName.of("foo", "t"), identifier("c")));
  assertStatement("ALTER TABLE \"t x\" DROP COLUMN \"c d\"", new DropColumn(QualifiedName.of("t x"), quotedIdentifier("c d")));
}
origin: prestodb/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: prestodb/presto

@Test
public void testRenameSchema()
{
  assertStatement("ALTER SCHEMA foo RENAME TO bar",
      new RenameSchema(QualifiedName.of("foo"), identifier("bar")));
  assertStatement("ALTER SCHEMA foo.bar RENAME TO baz",
      new RenameSchema(QualifiedName.of("foo", "bar"), identifier("baz")));
  assertStatement("ALTER SCHEMA \"awesome schema\".\"awesome table\" RENAME TO \"even more awesome table\"",
      new RenameSchema(QualifiedName.of("awesome schema", "awesome table"), quotedIdentifier("even more awesome table")));
}
origin: prestodb/presto

@Test
public void testDescribeInput()
{
  assertStatement("DESCRIBE INPUT myquery", new DescribeInput(identifier("myquery")));
}
origin: prestodb/presto

@Test
public void testExecute()
{
  assertStatement("EXECUTE myquery", new Execute(identifier("myquery"), emptyList()));
}
origin: prestodb/presto

@Test
public void testGrant()
{
  assertStatement("GRANT INSERT, DELETE ON t TO u",
      new Grant(Optional.of(ImmutableList.of("INSERT", "DELETE")), false, QualifiedName.of("t"), identifier("u"), false));
  assertStatement("GRANT SELECT ON t TO PUBLIC WITH GRANT OPTION",
      new Grant(Optional.of(ImmutableList.of("SELECT")), false, QualifiedName.of("t"), identifier("PUBLIC"), true));
  assertStatement("GRANT ALL PRIVILEGES ON t TO u",
      new Grant(Optional.empty(), false, QualifiedName.of("t"), identifier("u"), false));
  assertStatement("GRANT taco ON t TO PUBLIC WITH GRANT OPTION",
      new Grant(Optional.of(ImmutableList.of("taco")), false, QualifiedName.of("t"), identifier("PUBLIC"), true));
}
origin: prestodb/presto

@Test
public void testDescribeOutput()
{
  assertStatement("DESCRIBE OUTPUT myquery", new DescribeOutput(identifier("myquery")));
}
origin: prestodb/presto

@Test
public void testDeallocatePrepare()
{
  assertStatement("DEALLOCATE PREPARE myquery", new Deallocate(identifier("myquery")));
}
com.facebook.presto.sqlQueryUtilidentifier

Popular methods of QueryUtil

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

Popular classes and methods

  • requestLocationUpdates (LocationManager)
  • compareTo (BigDecimal)
    Compares this BigDecimal with val. Returns one of the three values 1, 0, or -1. The method behaves a
  • getContentResolver (Context)
  • ObjectMapper (com.fasterxml.jackson.databind)
    This mapper (or, data binder, or codec) provides functionality for converting between Java objects (
  • Pointer (com.sun.jna)
    An abstraction for a native pointer data type. A Pointer instance represents, on the Java side, a na
  • Menu (java.awt)
  • Iterator (java.util)
    An iterator over a collection. Iterator takes the place of Enumeration in the Java Collections Frame
  • Random (java.util)
    This class provides methods that return pseudo-random values.It is dangerous to seed Random with the
  • Get (org.apache.hadoop.hbase.client)
    Used to perform Get operations on a single row. To get everything for a row, instantiate a Get objec
  • Loader (org.hibernate.loader)
    Abstract superclass of object loading (and querying) strategies. This class implements useful common

For IntelliJ IDEA and
Android Studio

  • Codota IntelliJ IDEA pluginCodota Android Studio pluginCode IndexSign in
  • EnterpriseFAQAboutContact Us
  • Terms of usePrivacy policyCodeboxFind Usages
Add Codota to your IDE (free)