当前位置: 首页>>代码示例>>Java>>正文


Java Util.toLinux方法代码示例

本文整理汇总了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);
      }
    }
  };
}
 
开发者ID:apache,项目名称:calcite,代码行数:17,代码来源:CalciteAssert.java

示例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);
      }
    }
  };
}
 
开发者ID:apache,项目名称:calcite,代码行数:17,代码来源:CalciteAssert.java

示例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;
    }
  };
}
 
开发者ID:qubole,项目名称:quark,代码行数:10,代码来源:SqlQueryParser.java

示例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());
}
 
开发者ID:apache,项目名称:calcite,代码行数:12,代码来源:OsAdapterTest.java

示例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);
}
 
开发者ID:apache,项目名称:calcite,代码行数:13,代码来源:SqlParserTest.java

示例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);
}
 
开发者ID:apache,项目名称:calcite,代码行数:11,代码来源:SqlParserTest.java

示例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"));
}
 
开发者ID:apache,项目名称:calcite,代码行数:40,代码来源:PlannerTest.java

示例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;
    }
  };
}
 
开发者ID:apache,项目名称:calcite,代码行数:14,代码来源:CalciteAssert.java

示例9: linux

import org.apache.calcite.util.Util; //导入方法依赖的package包/类
private String linux(String s) {
  if (LINUXIFY.get()[0]) {
    s = Util.toLinux(s);
  }
  return s;
}
 
开发者ID:apache,项目名称:calcite,代码行数:7,代码来源:SqlParserTest.java

示例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));
}
 
开发者ID:apache,项目名称:calcite,代码行数:6,代码来源:PlannerTest.java

示例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));
}
 
开发者ID:apache,项目名称:calcite,代码行数:5,代码来源:PigRelBuilderTest.java

示例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));
}
 
开发者ID:apache,项目名称:calcite,代码行数:5,代码来源:RelBuilderTest.java


注:本文中的org.apache.calcite.util.Util.toLinux方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。