本文整理了Java中io.prestosql.sql.QueryUtil.identifier
方法的一些代码示例,展示了QueryUtil.identifier
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。QueryUtil.identifier
方法的具体详情如下:
包路径:io.prestosql.sql.QueryUtil
类名称:QueryUtil
方法名:identifier
暂无
代码示例来源:origin: io.prestosql/presto-parser
public static SelectItem aliasedName(String name, String alias)
{
return new SingleColumn(identifier(name), identifier(alias));
}
代码示例来源:origin: io.prestosql/presto-parser
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: prestosql/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: prestosql/presto
public static SelectItem unaliasedName(String name)
{
return new SingleColumn(identifier(name));
}
代码示例来源:origin: io.prestosql/presto-parser
public static SelectItem aliasedNullToEmpty(String column, String alias)
{
return new SingleColumn(new CoalesceExpression(identifier(column), new StringLiteral("")), identifier(alias));
}
代码示例来源:origin: prestosql/presto
@Test
public void testRenameColumn()
{
assertStatement("ALTER TABLE foo.t RENAME COLUMN a TO b", new RenameColumn(QualifiedName.of("foo", "t"), identifier("a"), identifier("b")));
}
代码示例来源:origin: prestosql/presto
@Test
public void testExecute()
{
assertStatement("EXECUTE myquery", new Execute(identifier("myquery"), emptyList()));
}
代码示例来源:origin: prestosql/presto
@Test
public void testShowSchemas()
{
assertStatement("SHOW SCHEMAS", new ShowSchemas(Optional.empty(), Optional.empty(), Optional.empty()));
assertStatement("SHOW SCHEMAS FROM foo", new ShowSchemas(Optional.of(identifier("foo")), Optional.empty(), Optional.empty()));
assertStatement("SHOW SCHEMAS IN foo LIKE '%'", new ShowSchemas(Optional.of(identifier("foo")), Optional.of("%"), Optional.empty()));
assertStatement("SHOW SCHEMAS IN foo LIKE '%$_%' ESCAPE '$'", new ShowSchemas(Optional.of(identifier("foo")), Optional.of("%$_%"), Optional.of("$")));
}
代码示例来源:origin: prestosql/presto
@Test
public void testDeallocatePrepare()
{
assertStatement("DEALLOCATE PREPARE myquery", new Deallocate(identifier("myquery")));
}
代码示例来源:origin: prestosql/presto
@Test
public void testDescribeOutput()
{
assertStatement("DESCRIBE OUTPUT myquery", new DescribeOutput(identifier("myquery")));
}
代码示例来源:origin: prestosql/presto
@Test
public void testDescribeInput()
{
assertStatement("DESCRIBE INPUT myquery", new DescribeInput(identifier("myquery")));
}
代码示例来源:origin: io.prestosql/presto-main
@Test
public void testCreateTableNotExistsTrue()
{
CreateTable statement = new CreateTable(QualifiedName.of("test_table"),
ImmutableList.of(new ColumnDefinition(identifier("a"), "BIGINT", emptyList(), Optional.empty())),
true,
ImmutableList.of(),
Optional.empty());
getFutureValue(new CreateTableTask().internalExecute(statement, metadata, new AllowAllAccessControl(), testSession, emptyList()));
assertEquals(metadata.getCreateTableCallCount(), 1);
}
代码示例来源:origin: prestosql/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", emptyList(), Optional.empty())));
}
代码示例来源:origin: prestosql/presto
@Test
public void testCreateTableNotExistsTrue()
{
CreateTable statement = new CreateTable(QualifiedName.of("test_table"),
ImmutableList.of(new ColumnDefinition(identifier("a"), "BIGINT", emptyList(), Optional.empty())),
true,
ImmutableList.of(),
Optional.empty());
getFutureValue(new CreateTableTask().internalExecute(statement, metadata, new AllowAllAccessControl(), testSession, emptyList()));
assertEquals(metadata.getCreateTableCallCount(), 1);
}
代码示例来源: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 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: prestosql/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: prestosql/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: 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")))));
}
内容来源于网络,如有侵权,请联系作者删除!