本文整理了Java中org.apache.calcite.util.Util.toLinux()
方法的一些代码示例,展示了Util.toLinux()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Util.toLinux()
方法的具体详情如下:
包路径:org.apache.calcite.util.Util
类名称:Util
方法名:toLinux
暂无
代码示例来源:origin: qubole/quark
public Void apply(RelNode relNode) {
String s = Util.toLinux(RelOptUtil.toString(relNode));
LOG.info(s);
return null;
}
};
代码示例来源:origin: org.apache.calcite/calcite-core
private String linux(String s) {
if (LINUXIFY.get()[0]) {
s = Util.toLinux(s);
}
return s;
}
代码示例来源:origin: Qihoo360/Quicksql
private String linux(String s) {
if (LINUXIFY.get()[0]) {
s = Util.toLinux(s);
}
return s;
}
代码示例来源:origin: Qihoo360/Quicksql
private String toString(RelNode rel) {
return Util.toLinux(
RelOptUtil.dumpPlan("", rel, SqlExplainFormat.TEXT,
SqlExplainLevel.DIGEST_ATTRIBUTES));
}
代码示例来源:origin: org.apache.calcite/calcite-core
private String toString(RelNode rel) {
return Util.toLinux(
RelOptUtil.dumpPlan("", rel, SqlExplainFormat.TEXT,
SqlExplainLevel.DIGEST_ATTRIBUTES));
}
代码示例来源:origin: org.apache.calcite/calcite-core
/** Converts a relational expression to a sting with linux line-endings. */
private String str(RelNode r) {
return Util.toLinux(RelOptUtil.toString(r));
}
代码示例来源:origin: Qihoo360/Quicksql
/**
* Creates a Matcher that matches a {@link RelNode} its string representation,
* after converting Windows-style line endings ("\r\n")
* to Unix-style line endings ("\n"), is equal to the given {@code value}.
*/
@Factory
public static Matcher<RelNode> hasTree(final String value) {
return compose(Is.is(value), input -> {
// Convert RelNode to a string with Linux line-endings
return Util.toLinux(RelOptUtil.toString(input));
});
}
代码示例来源:origin: org.apache.calcite/calcite-core
/**
* Creates a Matcher that matches a {@link RelNode} its string representation,
* after converting Windows-style line endings ("\r\n")
* to Unix-style line endings ("\n"), is equal to the given {@code value}.
*/
@Factory
public static Matcher<RelNode> hasTree(final String value) {
return compose(Is.is(value), input -> {
// Convert RelNode to a string with Linux line-endings
return Util.toLinux(RelOptUtil.toString(input));
});
}
代码示例来源:origin: Qihoo360/Quicksql
public AssertQuery planContains(String expected) {
ensurePlan(null);
assertTrue(
"Plan [" + plan + "] contains [" + expected + "]",
Util.toLinux(plan)
.replaceAll("\\\\r\\\\n", "\\\\n")
.contains(expected));
return this;
}
代码示例来源:origin: Qihoo360/Quicksql
/**
* RelNode to SQL with special Dialect.
*
* @return sql
*/
public String sql() {
SqlDialect dialect = new HiveSqlDialect(SqlDialect.EMPTY_CONTEXT);
RelToSqlConverter converter = new RelToSqlConverter(dialect);
SqlNode sqlNode = converter.visitChild(0, parent).asStatement();
return Util.toLinux(sqlNode.toSqlString(dialect).getSql()).replaceAll("\n", " ");
}
代码示例来源:origin: Qihoo360/Quicksql
public static Consumer<ResultSet> checkResultContains(
final String expected, final int count) {
return s -> {
try {
final String actual = Util.toLinux(toString(s));
assertTrue(
actual + " should have " + count + " occurrence of " + expected,
StringUtils.countMatches(actual, expected) == count);
} catch (SQLException e) {
throw new RuntimeException(e);
}
};
}
代码示例来源:origin: org.apache.calcite/calcite-core
public AssertQuery planContains(String expected) {
ensurePlan(null);
assertTrue(
"Plan [" + plan + "] contains [" + expected + "]",
Util.toLinux(plan)
.replaceAll("\\\\r\\\\n", "\\\\n")
.contains(expected));
return this;
}
代码示例来源:origin: Qihoo360/Quicksql
public void checkExp(
String sql,
String expected) {
final SqlNode sqlNode = parseExpressionAndHandleEx(sql);
String actual = sqlNode.toSqlString(null, true).getSql();
if (LINUXIFY.get()[0]) {
actual = Util.toLinux(actual);
}
TestUtil.assertEqualsVerbose(expected, actual);
}
代码示例来源:origin: Qihoo360/Quicksql
public void check(
String sql,
String expected) {
final SqlNode sqlNode = parseStmtAndHandleEx(sql);
// no dialect, always parenthesize
String actual = sqlNode.toSqlString(null, true).getSql();
if (LINUXIFY.get()[0]) {
actual = Util.toLinux(actual);
}
TestUtil.assertEqualsVerbose(expected, actual);
}
代码示例来源:origin: org.apache.calcite/calcite-core
public void check(
String sql,
String expected) {
final SqlNode sqlNode = parseStmtAndHandleEx(sql);
// no dialect, always parenthesize
String actual = sqlNode.toSqlString(null, true).getSql();
if (LINUXIFY.get()[0]) {
actual = Util.toLinux(actual);
}
TestUtil.assertEqualsVerbose(expected, actual);
}
代码示例来源:origin: org.apache.calcite/calcite-core
public void checkExp(
String sql,
String expected) {
final SqlNode sqlNode = parseExpressionAndHandleEx(sql);
String actual = sqlNode.toSqlString(null, true).getSql();
if (LINUXIFY.get()[0]) {
actual = Util.toLinux(actual);
}
TestUtil.assertEqualsVerbose(expected, actual);
}
代码示例来源:origin: Qihoo360/Quicksql
public void checkRewrite(
SqlValidator validator,
String query,
String expectedRewrite) {
SqlNode rewrittenNode = parseAndValidate(validator, query);
String actualRewrite =
rewrittenNode.toSqlString(AnsiSqlDialect.DEFAULT, false).getSql();
TestUtil.assertEqualsVerbose(expectedRewrite, Util.toLinux(actualRewrite));
}
代码示例来源:origin: org.apache.calcite/calcite-core
public void checkRewrite(
SqlValidator validator,
String query,
String expectedRewrite) {
SqlNode rewrittenNode = parseAndValidate(validator, query);
String actualRewrite =
rewrittenNode.toSqlString(AnsiSqlDialect.DEFAULT, false).getSql();
TestUtil.assertEqualsVerbose(expectedRewrite, Util.toLinux(actualRewrite));
}
代码示例来源:origin: Qihoo360/Quicksql
private void checkParseAndConvert(String query,
String queryFromParseTree, String expectedRelExpr) throws Exception {
Planner planner = getPlanner(null);
SqlNode parse = planner.parse(query);
assertThat(Util.toLinux(parse.toString()), equalTo(queryFromParseTree));
SqlNode validate = planner.validate(parse);
RelNode rel = planner.rel(validate).project();
assertThat(toString(rel), equalTo(expectedRelExpr));
}
代码示例来源:origin: org.apache.calcite/calcite-core
private void checkParseAndConvert(String query,
String queryFromParseTree, String expectedRelExpr) throws Exception {
Planner planner = getPlanner(null);
SqlNode parse = planner.parse(query);
assertThat(Util.toLinux(parse.toString()), equalTo(queryFromParseTree));
SqlNode validate = planner.validate(parse);
RelNode rel = planner.rel(validate).project();
assertThat(toString(rel), equalTo(expectedRelExpr));
}
内容来源于网络,如有侵权,请联系作者删除!