本文整理了Java中org.apache.calcite.runtime.Hook.addThread()
方法的一些代码示例,展示了Hook.addThread()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Hook.addThread()
方法的具体详情如下:
包路径:org.apache.calcite.runtime.Hook
类名称:Hook
方法名:addThread
暂无
代码示例来源:origin: Qihoo360/Quicksql
/** @deprecated Use {@link #addThread(Consumer)}. */
@SuppressWarnings("Guava")
@Deprecated // to be removed in 2.0
public <T, R> Closeable addThread(
final com.google.common.base.Function<T, R> handler) {
return addThread((Consumer<T>) handler::apply);
}
代码示例来源:origin: org.apache.calcite/calcite-core
/** @deprecated Use {@link #addThread(Consumer)}. */
@SuppressWarnings("Guava")
@Deprecated // to be removed in 2.0
public <T, R> Closeable addThread(
final com.google.common.base.Function<T, R> handler) {
return addThread((Consumer<T>) handler::apply);
}
代码示例来源:origin: Qihoo360/Quicksql
@Before public void before() {
this.closeable =
Hook.CONVERTED.addThread(SqlToRelConverterExtendedTest::foo);
}
代码示例来源:origin: org.apache.calcite/calcite-core
@Before public void before() {
this.closeable =
Hook.CONVERTED.addThread(SqlToRelConverterExtendedTest::foo);
}
代码示例来源:origin: Qihoo360/Quicksql
@SuppressWarnings("unchecked")
private void check(boolean unchanged) {
try (Closer closer = new Closer()) {
for (Map.Entry<Hook, Consumer> entry : hooks.entrySet()) {
closer.add(entry.getKey().addThread(entry.getValue()));
}
Tester t = tester;
for (Function<Tester, Tester> transform : transforms) {
t = transform.apply(t);
}
checkPlanning(t, preProgram, hepPlanner, sql, unchanged);
}
}
}
代码示例来源:origin: org.apache.calcite/calcite-core
@SuppressWarnings("unchecked")
private void check(boolean unchanged) {
try (Closer closer = new Closer()) {
for (Map.Entry<Hook, Consumer> entry : hooks.entrySet()) {
closer.add(entry.getKey().addThread(entry.getValue()));
}
Tester t = tester;
for (Function<Tester, Tester> transform : transforms) {
t = transform.apply(t);
}
checkPlanning(t, preProgram, hepPlanner, sql, unchanged);
}
}
}
代码示例来源:origin: org.apache.calcite/calcite-core
calendar.set(Calendar.MILLISECOND, 15);
final long timeInMillis = calendar.getTimeInMillis();
closeable = Hook.CURRENT_TIME.addThread(
(Consumer<Holder<Long>>) o -> o.set(timeInMillis));
代码示例来源:origin: Qihoo360/Quicksql
calendar.set(Calendar.MILLISECOND, 15);
final long timeInMillis = calendar.getTimeInMillis();
closeable = Hook.CURRENT_TIME.addThread(
(Consumer<Holder<Long>>) o -> o.set(timeInMillis));
代码示例来源:origin: Qihoo360/Quicksql
if (convertChecker != null) {
closer.add(
Hook.TRIMMED.addThread((Consumer<RelNode>) convertChecker::apply));
Hook.SUB.addThread(
(Consumer<RelNode>) substitutionChecker::apply));
代码示例来源:origin: org.apache.calcite/calcite-core
if (convertChecker != null) {
closer.add(
Hook.TRIMMED.addThread((Consumer<RelNode>) convertChecker::apply));
Hook.SUB.addThread(
(Consumer<RelNode>) substitutionChecker::apply));
代码示例来源:origin: Qihoo360/Quicksql
closer.add(hook.left.addThread(hook.right));
代码示例来源:origin: org.apache.calcite/calcite-core
closer.add(hook.left.addThread(hook.right));
代码示例来源:origin: Qihoo360/Quicksql
/** Tests that {@link Hook#PARSE_TREE} works. */
@Test public void testHook() {
final int[] callCount = {0};
try (Hook.Closeable ignored = Hook.PARSE_TREE.<Object[]>addThread(
args -> {
assertThat(args.length, equalTo(2));
assertThat(args[0], instanceOf(String.class));
assertThat(args[0],
equalTo("select \"deptno\", \"commission\", sum(\"salary\") s\n"
+ "from \"hr\".\"emps\"\n"
+ "group by \"deptno\", \"commission\""));
assertThat(args[1], instanceOf(SqlSelect.class));
++callCount[0];
})) {
// Simple query does not run the hook.
testSimple();
assertThat(callCount[0], equalTo(0));
// Non-trivial query runs hook once.
testGroupByNull();
assertThat(callCount[0], equalTo(1));
}
}
代码示例来源:origin: org.apache.calcite/calcite-core
/** Tests that {@link Hook#PARSE_TREE} works. */
@Test public void testHook() {
final int[] callCount = {0};
try (Hook.Closeable ignored = Hook.PARSE_TREE.<Object[]>addThread(
args -> {
assertThat(args.length, equalTo(2));
assertThat(args[0], instanceOf(String.class));
assertThat(args[0],
equalTo("select \"deptno\", \"commission\", sum(\"salary\") s\n"
+ "from \"hr\".\"emps\"\n"
+ "group by \"deptno\", \"commission\""));
assertThat(args[1], instanceOf(SqlSelect.class));
++callCount[0];
})) {
// Simple query does not run the hook.
testSimple();
assertThat(callCount[0], equalTo(0));
// Non-trivial query runs hook once.
testGroupByNull();
assertThat(callCount[0], equalTo(1));
}
}
代码示例来源:origin: org.apache.calcite/calcite-core
closer.add(hook.left.addThread(hook.right));
代码示例来源:origin: Qihoo360/Quicksql
final boolean b = value instanceof Boolean
&& (Boolean) value;
closer.add(Hook.ENABLE_BINDABLE.addThread(Hook.propertyJ(b)));
代码示例来源:origin: org.apache.calcite/calcite-core
final boolean b = value instanceof Boolean
&& (Boolean) value;
closer.add(Hook.ENABLE_BINDABLE.addThread(Hook.propertyJ(b)));
内容来源于网络,如有侵权,请联系作者删除!