本文整理汇总了Java中org.apache.calcite.util.Util.toLinux方法的典型用法代码示例。如果您正苦于以下问题:Java Util.toLinux方法的具体用法?Java Util.toLinux怎么用?Java Util.toLinux使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.calcite.util.Util
的用法示例。
在下文中一共展示了Util.toLinux方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: checkResultContains
import org.apache.calcite.util.Util; //导入方法依赖的package包/类
public static Function<ResultSet, Void> checkResultContains(
final String... expected) {
return new Function<ResultSet, Void>() {
public Void apply(ResultSet s) {
try {
final String actual = Util.toLinux(CalciteAssert.toString(s));
for (String st : expected) {
assertThat(actual, containsString(st));
}
return null;
} catch (SQLException e) {
throw new RuntimeException(e);
}
}
};
}
示例2: checkMaskedResultContains
import org.apache.calcite.util.Util; //导入方法依赖的package包/类
public static Function<ResultSet, Void> checkMaskedResultContains(
final String expected) {
return new Function<ResultSet, Void>() {
public Void apply(ResultSet s) {
try {
final String actual = Util.toLinux(CalciteAssert.toString(s));
final String maskedActual =
actual.replaceAll(", id = [0-9]+", "");
assertThat(maskedActual, containsString(expected));
return null;
} catch (SQLException e) {
throw new RuntimeException(e);
}
}
};
}
示例3: printer
import org.apache.calcite.util.Util; //导入方法依赖的package包/类
private Function<RelNode, Void> printer() {
return new Function<RelNode, Void>() {
public Void apply(RelNode relNode) {
String s = Util.toLinux(RelOptUtil.toString(relNode));
LOG.info(s);
return null;
}
};
}
示例4: foo
import org.apache.calcite.util.Util; //导入方法依赖的package包/类
private String foo(String... args) throws SQLException {
final ByteArrayInputStream inStream = new ByteArrayInputStream(new byte[0]);
final InputStreamReader in =
new InputStreamReader(inStream, StandardCharsets.UTF_8);
final StringWriter outSw = new StringWriter();
final PrintWriter out = new PrintWriter(outSw);
final StringWriter errSw = new StringWriter();
final PrintWriter err = new PrintWriter(errSw);
new SqlShell(in, out, err, args).run();
return Util.toLinux(outSw.toString());
}
示例5: check
import org.apache.calcite.util.Util; //导入方法依赖的package包/类
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);
}
示例6: checkExp
import org.apache.calcite.util.Util; //导入方法依赖的package包/类
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);
}
示例7: testOrderByNonSelectColumn
import org.apache.calcite.util.Util; //导入方法依赖的package包/类
/** Test case for
* <a href="https://issues.apache.org/jira/browse/CALCITE-569">[CALCITE-569]
* ArrayIndexOutOfBoundsException when deducing collation</a>. */
@Test public void testOrderByNonSelectColumn() throws Exception {
final SchemaPlus schema = Frameworks.createRootSchema(true)
.add("tpch", new ReflectiveSchema(new TpchSchema()));
String query = "select t.psPartkey from \n"
+ "(select ps.psPartkey from `tpch`.`partsupp` ps \n"
+ "order by ps.psPartkey, ps.psSupplyCost) t \n"
+ "order by t.psPartkey";
List<RelTraitDef> traitDefs = new ArrayList<>();
traitDefs.add(ConventionTraitDef.INSTANCE);
traitDefs.add(RelCollationTraitDef.INSTANCE);
final SqlParser.Config parserConfig =
SqlParser.configBuilder().setLex(Lex.MYSQL).build();
FrameworkConfig config = Frameworks.newConfigBuilder()
.parserConfig(parserConfig)
.defaultSchema(schema)
.traitDefs(traitDefs)
.programs(Programs.ofRules(Programs.RULE_SET))
.build();
String plan;
try (Planner p = Frameworks.getPlanner(config)) {
SqlNode n = p.parse(query);
n = p.validate(n);
RelNode r = p.rel(n).project();
plan = RelOptUtil.toString(r);
plan = Util.toLinux(plan);
}
assertThat(plan,
equalTo("LogicalSort(sort0=[$0], dir0=[ASC])\n"
+ " LogicalProject(psPartkey=[$0])\n"
+ " LogicalProject(psPartkey=[$0])\n"
+ " LogicalSort(sort0=[$0], sort1=[$1], dir0=[ASC], dir1=[ASC])\n"
+ " LogicalProject(psPartkey=[$0], psSupplyCost=[$1])\n"
+ " EnumerableTableScan(table=[[tpch, partsupp]])\n"));
}
示例8: checkRel
import org.apache.calcite.util.Util; //导入方法依赖的package包/类
static Function<RelNode, Void> checkRel(final String expected,
final AtomicInteger counter) {
return new Function<RelNode, Void>() {
public Void apply(RelNode relNode) {
if (counter != null) {
counter.incrementAndGet();
}
String s = Util.toLinux(RelOptUtil.toString(relNode));
assertThat(s, containsString(expected));
return null;
}
};
}
示例9: linux
import org.apache.calcite.util.Util; //导入方法依赖的package包/类
private String linux(String s) {
if (LINUXIFY.get()[0]) {
s = Util.toLinux(s);
}
return s;
}
示例10: toString
import org.apache.calcite.util.Util; //导入方法依赖的package包/类
private String toString(RelNode rel) {
return Util.toLinux(
RelOptUtil.dumpPlan("", rel, SqlExplainFormat.TEXT,
SqlExplainLevel.DIGEST_ATTRIBUTES));
}
示例11: str
import org.apache.calcite.util.Util; //导入方法依赖的package包/类
/** Converts a relational expression to a sting with linux line-endings. */
private String str(RelNode r) {
return Util.toLinux(RelOptUtil.toString(r));
}
示例12: str
import org.apache.calcite.util.Util; //导入方法依赖的package包/类
/** Converts a relational expression to a string with linux line-endings. */
private String str(RelNode r) {
return Util.toLinux(RelOptUtil.toString(r));
}