path;
34 |
35 | public void accept(ModelHandler handler) {
36 | handler.visit(this);
37 | }
38 |
39 | @Override
40 | public String toString() {
41 | return "JsonView(name=" + name + ")";
42 | }
43 | }
44 |
45 | // End JsonView.java
46 |
--------------------------------------------------------------------------------
/core/src/main/java/net/hydromatic/optiq/package-info.java:
--------------------------------------------------------------------------------
1 | /*
2 | // Licensed to Julian Hyde under one or more contributor license
3 | // agreements. See the NOTICE file distributed with this work for
4 | // additional information regarding copyright ownership.
5 | //
6 | // Julian Hyde licenses this file to you under the Apache License,
7 | // Version 2.0 (the "License"); you may not use this file except in
8 | // compliance with the License. You may obtain a copy of the License at:
9 | //
10 | // http://www.apache.org/licenses/LICENSE-2.0
11 | //
12 | // Unless required by applicable law or agreed to in writing, software
13 | // distributed under the License is distributed on an "AS IS" BASIS,
14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | // See the License for the specific language governing permissions and
16 | // limitations under the License.
17 | */
18 |
19 | /**
20 | * Main package for Optiq, the dynamic data management platform.
21 | */
22 | package net.hydromatic.optiq;
23 |
24 | // End package-info.java
25 |
--------------------------------------------------------------------------------
/core/src/main/java/net/hydromatic/optiq/prepare/package-info.java:
--------------------------------------------------------------------------------
1 | /*
2 | // Licensed to Julian Hyde under one or more contributor license
3 | // agreements. See the NOTICE file distributed with this work for
4 | // additional information regarding copyright ownership.
5 | //
6 | // Julian Hyde licenses this file to you under the Apache License,
7 | // Version 2.0 (the "License"); you may not use this file except in
8 | // compliance with the License. You may obtain a copy of the License at:
9 | //
10 | // http://www.apache.org/licenses/LICENSE-2.0
11 | //
12 | // Unless required by applicable law or agreed to in writing, software
13 | // distributed under the License is distributed on an "AS IS" BASIS,
14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | // See the License for the specific language governing permissions and
16 | // limitations under the License.
17 | */
18 |
19 | /**
20 | * Preparation of queries (parsing, planning and implementation).
21 | */
22 | package net.hydromatic.optiq.prepare;
23 |
24 | // End package-info.java
25 |
--------------------------------------------------------------------------------
/core/src/main/java/net/hydromatic/optiq/rules/java/AggResultContext.java:
--------------------------------------------------------------------------------
1 | /*
2 | // Licensed to Julian Hyde under one or more contributor license
3 | // agreements. See the NOTICE file distributed with this work for
4 | // additional information regarding copyright ownership.
5 | //
6 | // Julian Hyde licenses this file to you under the Apache License,
7 | // Version 2.0 (the "License"); you may not use this file except in
8 | // compliance with the License. You may obtain a copy of the License at:
9 | //
10 | // http://www.apache.org/licenses/LICENSE-2.0
11 | //
12 | // Unless required by applicable law or agreed to in writing, software
13 | // distributed under the License is distributed on an "AS IS" BASIS,
14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | // See the License for the specific language governing permissions and
16 | // limitations under the License.
17 | */
18 | package net.hydromatic.optiq.rules.java;
19 |
20 | /**
21 | * Information for a call to {@link AggImplementor#implementResult(AggContext, AggResultContext)}
22 | * Typically, the aggregation implementation will convert {@link #accumulator()}
23 | * to the resulting value of the aggregation.
24 | * The implementation MUST NOT destroy the contents of {@link #accumulator()}.
25 | */
26 | public interface AggResultContext extends NestedBlockBuilder, AggResetContext {
27 | }
28 |
29 | // End AggResultContext.java
30 |
--------------------------------------------------------------------------------
/core/src/main/java/net/hydromatic/optiq/rules/java/CallImplementor.java:
--------------------------------------------------------------------------------
1 | /*
2 | // Licensed to Julian Hyde under one or more contributor license
3 | // agreements. See the NOTICE file distributed with this work for
4 | // additional information regarding copyright ownership.
5 | //
6 | // Julian Hyde licenses this file to you under the Apache License,
7 | // Version 2.0 (the "License"); you may not use this file except in
8 | // compliance with the License. You may obtain a copy of the License at:
9 | //
10 | // http://www.apache.org/licenses/LICENSE-2.0
11 | //
12 | // Unless required by applicable law or agreed to in writing, software
13 | // distributed under the License is distributed on an "AS IS" BASIS,
14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | // See the License for the specific language governing permissions and
16 | // limitations under the License.
17 | */
18 | package net.hydromatic.optiq.rules.java;
19 |
20 | import net.hydromatic.linq4j.expressions.Expression;
21 |
22 | import org.eigenbase.rex.RexCall;
23 |
24 | /**
25 | * Implements a call via given translator.
26 | *
27 | * @see net.hydromatic.optiq.ScalarFunction
28 | * @see net.hydromatic.optiq.TableFunction
29 | * @see net.hydromatic.optiq.rules.java.RexImpTable
30 | */
31 | public interface CallImplementor {
32 | /** Implements a call. */
33 | Expression implement(
34 | RexToLixTranslator translator,
35 | RexCall call,
36 | RexImpTable.NullAs nullAs);
37 | }
38 |
--------------------------------------------------------------------------------
/core/src/main/java/net/hydromatic/optiq/rules/java/WinAggContext.java:
--------------------------------------------------------------------------------
1 | /*
2 | // Licensed to Julian Hyde under one or more contributor license
3 | // agreements. See the NOTICE file distributed with this work for
4 | // additional information regarding copyright ownership.
5 | //
6 | // Julian Hyde licenses this file to you under the Apache License,
7 | // Version 2.0 (the "License"); you may not use this file except in
8 | // compliance with the License. You may obtain a copy of the License at:
9 | //
10 | // http://www.apache.org/licenses/LICENSE-2.0
11 | //
12 | // Unless required by applicable law or agreed to in writing, software
13 | // distributed under the License is distributed on an "AS IS" BASIS,
14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | // See the License for the specific language governing permissions and
16 | // limitations under the License.
17 | */
18 | package net.hydromatic.optiq.rules.java;
19 |
20 | /**
21 | * Marker interface to allow {@link net.hydromatic.optiq.rules.java.AggImplementor} to tell if it is used in
22 | * regular or windowed context.
23 | */
24 | public interface WinAggContext extends AggContext {
25 | }
26 |
27 | // End WinAggContext.java
28 |
--------------------------------------------------------------------------------
/core/src/main/java/net/hydromatic/optiq/rules/java/WinAggResetContext.java:
--------------------------------------------------------------------------------
1 | /*
2 | // Licensed to Julian Hyde under one or more contributor license
3 | // agreements. See the NOTICE file distributed with this work for
4 | // additional information regarding copyright ownership.
5 | //
6 | // Julian Hyde licenses this file to you under the Apache License,
7 | // Version 2.0 (the "License"); you may not use this file except in
8 | // compliance with the License. You may obtain a copy of the License at:
9 | //
10 | // http://www.apache.org/licenses/LICENSE-2.0
11 | //
12 | // Unless required by applicable law or agreed to in writing, software
13 | // distributed under the License is distributed on an "AS IS" BASIS,
14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | // See the License for the specific language governing permissions and
16 | // limitations under the License.
17 | */
18 | package net.hydromatic.optiq.rules.java;
19 |
20 | /**
21 | * Information for a call to {@link AggImplementor#implementReset(AggContext, AggResetContext)}.
22 | * {@link AggResetContext} provides access to the accumulator variables
23 | * that should be reset.
24 | * Note: the very first reset of windowed aggregates is performed with null
25 | * knowledge of indices and row count in the partition.
26 | * In other words, the implementation should treat indices and partition row
27 | * count as a hint to pre-size the collections.
28 | */
29 | public interface WinAggResetContext
30 | extends AggResetContext, WinAggFrameContext {
31 | }
32 |
33 | // End WinAggResetContext.java
34 |
--------------------------------------------------------------------------------
/core/src/main/java/net/hydromatic/optiq/rules/java/impl/AggAddContextImpl.java:
--------------------------------------------------------------------------------
1 | /*
2 | // Licensed to Julian Hyde under one or more contributor license
3 | // agreements. See the NOTICE file distributed with this work for
4 | // additional information regarding copyright ownership.
5 | //
6 | // Julian Hyde licenses this file to you under the Apache License,
7 | // Version 2.0 (the "License"); you may not use this file except in
8 | // compliance with the License. You may obtain a copy of the License at:
9 | //
10 | // http://www.apache.org/licenses/LICENSE-2.0
11 | //
12 | // Unless required by applicable law or agreed to in writing, software
13 | // distributed under the License is distributed on an "AS IS" BASIS,
14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | // See the License for the specific language governing permissions and
16 | // limitations under the License.
17 | */
18 | package net.hydromatic.optiq.rules.java.impl;
19 |
20 | import net.hydromatic.linq4j.expressions.BlockBuilder;
21 | import net.hydromatic.linq4j.expressions.Expression;
22 |
23 | import net.hydromatic.optiq.rules.java.AggAddContext;
24 |
25 | import java.util.List;
26 |
27 | /**
28 | * Implementation of {@link net.hydromatic.optiq.rules.java.AggAddContext}.
29 | */
30 | public abstract class AggAddContextImpl extends AggResultContextImpl
31 | implements AggAddContext {
32 | public AggAddContextImpl(BlockBuilder block, List accumulator) {
33 | super(block, accumulator);
34 | }
35 |
36 | public final List arguments() {
37 | return rowTranslator().translateList(rexArguments());
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/core/src/main/java/net/hydromatic/optiq/rules/java/impl/package-info.java:
--------------------------------------------------------------------------------
1 | /*
2 | // Licensed to Julian Hyde under one or more contributor license
3 | // agreements. See the NOTICE file distributed with this work for
4 | // additional information regarding copyright ownership.
5 | //
6 | // Julian Hyde licenses this file to you under the Apache License,
7 | // Version 2.0 (the "License"); you may not use this file except in
8 | // compliance with the License. You may obtain a copy of the License at:
9 | //
10 | // http://www.apache.org/licenses/LICENSE-2.0
11 | //
12 | // Unless required by applicable law or agreed to in writing, software
13 | // distributed under the License is distributed on an "AS IS" BASIS,
14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | // See the License for the specific language governing permissions and
16 | // limitations under the License.
17 | */
18 |
19 | /**
20 | * Optiq-specific classes for implementation of regular and window aggregates.
21 | */
22 | package net.hydromatic.optiq.rules.java.impl;
23 |
24 | // End package-info.java
25 |
--------------------------------------------------------------------------------
/core/src/main/java/net/hydromatic/optiq/rules/java/package-info.java:
--------------------------------------------------------------------------------
1 | /*
2 | // Licensed to Julian Hyde under one or more contributor license
3 | // agreements. See the NOTICE file distributed with this work for
4 | // additional information regarding copyright ownership.
5 | //
6 | // Julian Hyde licenses this file to you under the Apache License,
7 | // Version 2.0 (the "License"); you may not use this file except in
8 | // compliance with the License. You may obtain a copy of the License at:
9 | //
10 | // http://www.apache.org/licenses/LICENSE-2.0
11 | //
12 | // Unless required by applicable law or agreed to in writing, software
13 | // distributed under the License is distributed on an "AS IS" BASIS,
14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | // See the License for the specific language governing permissions and
16 | // limitations under the License.
17 | */
18 |
19 | /**
20 | * Query optimizer rules for Java calling convention.
21 | */
22 | package net.hydromatic.optiq.rules.java;
23 |
24 | // End package-info.java
25 |
--------------------------------------------------------------------------------
/core/src/main/java/net/hydromatic/optiq/rules/package-info.java:
--------------------------------------------------------------------------------
1 | /*
2 | // Licensed to Julian Hyde under one or more contributor license
3 | // agreements. See the NOTICE file distributed with this work for
4 | // additional information regarding copyright ownership.
5 | //
6 | // Julian Hyde licenses this file to you under the Apache License,
7 | // Version 2.0 (the "License"); you may not use this file except in
8 | // compliance with the License. You may obtain a copy of the License at:
9 | //
10 | // http://www.apache.org/licenses/LICENSE-2.0
11 | //
12 | // Unless required by applicable law or agreed to in writing, software
13 | // distributed under the License is distributed on an "AS IS" BASIS,
14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | // See the License for the specific language governing permissions and
16 | // limitations under the License.
17 | */
18 |
19 | /**
20 | * Query optimizer rules.
21 | */
22 | package net.hydromatic.optiq.rules;
23 |
24 | // End package-info.java
25 |
--------------------------------------------------------------------------------
/core/src/main/java/net/hydromatic/optiq/runtime/Bindable.java:
--------------------------------------------------------------------------------
1 | /*
2 | // Licensed to Julian Hyde under one or more contributor license
3 | // agreements. See the NOTICE file distributed with this work for
4 | // additional information regarding copyright ownership.
5 | //
6 | // Julian Hyde licenses this file to you under the Apache License,
7 | // Version 2.0 (the "License"); you may not use this file except in
8 | // compliance with the License. You may obtain a copy of the License at:
9 | //
10 | // http://www.apache.org/licenses/LICENSE-2.0
11 | //
12 | // Unless required by applicable law or agreed to in writing, software
13 | // distributed under the License is distributed on an "AS IS" BASIS,
14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | // See the License for the specific language governing permissions and
16 | // limitations under the License.
17 | */
18 | package net.hydromatic.optiq.runtime;
19 |
20 | import net.hydromatic.linq4j.Enumerable;
21 |
22 | import net.hydromatic.optiq.DataContext;
23 |
24 | /**
25 | * Statement that can be bound to a {@link DataContext} and then executed.
26 | *
27 | * @param Element type of the resulting enumerable
28 | */
29 | public interface Bindable {
30 | /**
31 | * Executes this statement and returns an enumerable which will yield rows.
32 | * The {@code environment} parameter provides the values in the root of the
33 | * environment (usually schemas).
34 | *
35 | * @param dataContext Environment that provides tables
36 | * @return Enumerable over rows
37 | */
38 | Enumerable bind(DataContext dataContext);
39 | }
40 |
41 | // End Bindable.java
42 |
--------------------------------------------------------------------------------
/core/src/main/java/net/hydromatic/optiq/runtime/Typed.java:
--------------------------------------------------------------------------------
1 | /*
2 | // Licensed to Julian Hyde under one or more contributor license
3 | // agreements. See the NOTICE file distributed with this work for
4 | // additional information regarding copyright ownership.
5 | //
6 | // Julian Hyde licenses this file to you under the Apache License,
7 | // Version 2.0 (the "License"); you may not use this file except in
8 | // compliance with the License. You may obtain a copy of the License at:
9 | //
10 | // http://www.apache.org/licenses/LICENSE-2.0
11 | //
12 | // Unless required by applicable law or agreed to in writing, software
13 | // distributed under the License is distributed on an "AS IS" BASIS,
14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | // See the License for the specific language governing permissions and
16 | // limitations under the License.
17 | */
18 | package net.hydromatic.optiq.runtime;
19 |
20 | import java.lang.reflect.Type;
21 |
22 | /**
23 | * Adds type information to a {@link net.hydromatic.linq4j.Enumerable}.
24 | */
25 | public interface Typed {
26 | /**
27 | * Gets the type of the element(s) that are returned in this collection.
28 | */
29 | Type getElementType();
30 | }
31 |
32 | // End Typed.java
33 |
--------------------------------------------------------------------------------
/core/src/main/java/net/hydromatic/optiq/runtime/Unit.java:
--------------------------------------------------------------------------------
1 | /*
2 | // Licensed to Julian Hyde under one or more contributor license
3 | // agreements. See the NOTICE file distributed with this work for
4 | // additional information regarding copyright ownership.
5 | //
6 | // Julian Hyde licenses this file to you under the Apache License,
7 | // Version 2.0 (the "License"); you may not use this file except in
8 | // compliance with the License. You may obtain a copy of the License at:
9 | //
10 | // http://www.apache.org/licenses/LICENSE-2.0
11 | //
12 | // Unless required by applicable law or agreed to in writing, software
13 | // distributed under the License is distributed on an "AS IS" BASIS,
14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | // See the License for the specific language governing permissions and
16 | // limitations under the License.
17 | */
18 | package net.hydromatic.optiq.runtime;
19 |
20 | /**
21 | * Synthetic record with zero fields.
22 | *
23 | * Since all instances are identical, {@code Unit} is a singleton.
24 | */
25 | public class Unit implements Comparable {
26 | public static final Unit INSTANCE = new Unit();
27 |
28 | private Unit() {
29 | }
30 |
31 | public int compareTo(Unit that) {
32 | return 0;
33 | }
34 |
35 | public String toString() {
36 | return "{}";
37 | }
38 | }
39 |
40 | // End Unit.java
41 |
--------------------------------------------------------------------------------
/core/src/main/java/net/hydromatic/optiq/runtime/package-info.java:
--------------------------------------------------------------------------------
1 | /*
2 | // Licensed to Julian Hyde under one or more contributor license
3 | // agreements. See the NOTICE file distributed with this work for
4 | // additional information regarding copyright ownership.
5 | //
6 | // Julian Hyde licenses this file to you under the Apache License,
7 | // Version 2.0 (the "License"); you may not use this file except in
8 | // compliance with the License. You may obtain a copy of the License at:
9 | //
10 | // http://www.apache.org/licenses/LICENSE-2.0
11 | //
12 | // Unless required by applicable law or agreed to in writing, software
13 | // distributed under the License is distributed on an "AS IS" BASIS,
14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | // See the License for the specific language governing permissions and
16 | // limitations under the License.
17 | */
18 |
19 | /**
20 | * Utilities required at runtime.
21 | */
22 | package net.hydromatic.optiq.runtime;
23 |
24 | // End package-info.java
25 |
--------------------------------------------------------------------------------
/core/src/main/java/net/hydromatic/optiq/server/OptiqServer.java:
--------------------------------------------------------------------------------
1 | /*
2 | // Licensed to Julian Hyde under one or more contributor license
3 | // agreements. See the NOTICE file distributed with this work for
4 | // additional information regarding copyright ownership.
5 | //
6 | // Julian Hyde licenses this file to you under the Apache License,
7 | // Version 2.0 (the "License"); you may not use this file except in
8 | // compliance with the License. You may obtain a copy of the License at:
9 | //
10 | // http://www.apache.org/licenses/LICENSE-2.0
11 | //
12 | // Unless required by applicable law or agreed to in writing, software
13 | // distributed under the License is distributed on an "AS IS" BASIS,
14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | // See the License for the specific language governing permissions and
16 | // limitations under the License.
17 | */
18 | package net.hydromatic.optiq.server;
19 |
20 | /**
21 | * Server.
22 | *
23 | * Represents shared state among connections, and will have monitoring and
24 | * management facilities.
25 | */
26 | public interface OptiqServer {
27 | void removeStatement(OptiqServerStatement optiqServerStatement);
28 |
29 | void addStatement(OptiqServerStatement optiqServerStatement);
30 | }
31 |
32 | // End OptiqServer.java
33 |
--------------------------------------------------------------------------------
/core/src/main/java/net/hydromatic/optiq/server/OptiqServerStatement.java:
--------------------------------------------------------------------------------
1 | /*
2 | // Licensed to Julian Hyde under one or more contributor license
3 | // agreements. See the NOTICE file distributed with this work for
4 | // additional information regarding copyright ownership.
5 | //
6 | // Julian Hyde licenses this file to you under the Apache License,
7 | // Version 2.0 (the "License"); you may not use this file except in
8 | // compliance with the License. You may obtain a copy of the License at:
9 | //
10 | // http://www.apache.org/licenses/LICENSE-2.0
11 | //
12 | // Unless required by applicable law or agreed to in writing, software
13 | // distributed under the License is distributed on an "AS IS" BASIS,
14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | // See the License for the specific language governing permissions and
16 | // limitations under the License.
17 | */
18 | package net.hydromatic.optiq.server;
19 |
20 | import net.hydromatic.optiq.jdbc.OptiqConnection;
21 | import net.hydromatic.optiq.jdbc.OptiqPrepare;
22 |
23 | /**
24 | * Statement within an Optiq server.
25 | */
26 | public interface OptiqServerStatement {
27 | /** Creates a context for preparing a statement for execution. */
28 | OptiqPrepare.Context createPrepareContext();
29 |
30 | /** Returns the connection. */
31 | OptiqConnection getConnection();
32 | }
33 |
34 | // End OptiqServerStatement.java
35 |
--------------------------------------------------------------------------------
/core/src/main/java/net/hydromatic/optiq/server/package-info.java:
--------------------------------------------------------------------------------
1 | /*
2 | // Licensed to Julian Hyde under one or more contributor license
3 | // agreements. See the NOTICE file distributed with this work for
4 | // additional information regarding copyright ownership.
5 | //
6 | // Julian Hyde licenses this file to you under the Apache License,
7 | // Version 2.0 (the "License"); you may not use this file except in
8 | // compliance with the License. You may obtain a copy of the License at:
9 | //
10 | // http://www.apache.org/licenses/LICENSE-2.0
11 | //
12 | // Unless required by applicable law or agreed to in writing, software
13 | // distributed under the License is distributed on an "AS IS" BASIS,
14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | // See the License for the specific language governing permissions and
16 | // limitations under the License.
17 | */
18 |
19 | /**
20 | * Provides a server for hosting Optiq connections.
21 | */
22 | package net.hydromatic.optiq.server;
23 |
24 | // End package-info.java
25 |
--------------------------------------------------------------------------------
/core/src/main/java/net/hydromatic/optiq/tools/Program.java:
--------------------------------------------------------------------------------
1 | /*
2 | // Licensed to Julian Hyde under one or more contributor license
3 | // agreements. See the NOTICE file distributed with this work for
4 | // additional information regarding copyright ownership.
5 | //
6 | // Julian Hyde licenses this file to you under the Apache License,
7 | // Version 2.0 (the "License"); you may not use this file except in
8 | // compliance with the License. You may obtain a copy of the License at:
9 | //
10 | // http://www.apache.org/licenses/LICENSE-2.0
11 | //
12 | // Unless required by applicable law or agreed to in writing, software
13 | // distributed under the License is distributed on an "AS IS" BASIS,
14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | // See the License for the specific language governing permissions and
16 | // limitations under the License.
17 | */
18 | package net.hydromatic.optiq.tools;
19 |
20 | import org.eigenbase.rel.RelNode;
21 | import org.eigenbase.relopt.RelOptPlanner;
22 | import org.eigenbase.relopt.RelTraitSet;
23 |
24 | /**
25 | * Program that transforms a relational expression into another relational
26 | * expression.
27 | *
28 | *
A planner is a sequence of programs, each of which is sometimes called
29 | * a "phase".
30 | * The most typical program is an invocation of the volcano planner with a
31 | * particular {@link net.hydromatic.optiq.tools.RuleSet}.
32 | */
33 | public interface Program {
34 | RelNode run(RelOptPlanner planner, RelNode rel,
35 | RelTraitSet requiredOutputTraits);
36 | }
37 |
38 | // End Program.java
39 |
--------------------------------------------------------------------------------
/core/src/main/java/net/hydromatic/optiq/tools/RelConversionException.java:
--------------------------------------------------------------------------------
1 | /*
2 | // Licensed to Julian Hyde under one or more contributor license
3 | // agreements. See the NOTICE file distributed with this work for
4 | // additional information regarding copyright ownership.
5 | //
6 | // Julian Hyde licenses this file to you under the Apache License,
7 | // Version 2.0 (the "License"); you may not use this file except in
8 | // compliance with the License. You may obtain a copy of the License at:
9 | //
10 | // http://www.apache.org/licenses/LICENSE-2.0
11 | //
12 | // Unless required by applicable law or agreed to in writing, software
13 | // distributed under the License is distributed on an "AS IS" BASIS,
14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | // See the License for the specific language governing permissions and
16 | // limitations under the License.
17 | */
18 | package net.hydromatic.optiq.tools;
19 |
20 | /**
21 | * An Exception thrown when attempting conversion to a set of
22 | * {@link org.eigenbase.rel.RelNode}s.
23 | */
24 | public class RelConversionException extends Exception {
25 | /** Creates a RelConversionException with the specified detail message and
26 | * cause. */
27 | public RelConversionException(String message, Throwable cause) {
28 | super(message, cause);
29 | }
30 |
31 | /** Creates a RelConversionException with the specified detail message. */
32 | public RelConversionException(String message) {
33 | super(message);
34 | }
35 |
36 | /** Creates a RelConversionException with the specified cause. */
37 | public RelConversionException(Throwable cause) {
38 | super(cause);
39 | }
40 | }
41 |
42 | // End RelConversionException.java
43 |
--------------------------------------------------------------------------------
/core/src/main/java/net/hydromatic/optiq/tools/RuleSet.java:
--------------------------------------------------------------------------------
1 | /*
2 | // Licensed to Julian Hyde under one or more contributor license
3 | // agreements. See the NOTICE file distributed with this work for
4 | // additional information regarding copyright ownership.
5 | //
6 | // Julian Hyde licenses this file to you under the Apache License,
7 | // Version 2.0 (the "License"); you may not use this file except in
8 | // compliance with the License. You may obtain a copy of the License at:
9 | //
10 | // http://www.apache.org/licenses/LICENSE-2.0
11 | //
12 | // Unless required by applicable law or agreed to in writing, software
13 | // distributed under the License is distributed on an "AS IS" BASIS,
14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | // See the License for the specific language governing permissions and
16 | // limitations under the License.
17 | */
18 | package net.hydromatic.optiq.tools;
19 |
20 | import org.eigenbase.relopt.RelOptRule;
21 |
22 | /**
23 | * A set rules associated with a particular
24 | * type of invocation of the {@link Planner}.
25 | */
26 | public interface RuleSet extends Iterable {
27 | }
28 |
29 | // End RuleSet.java
30 |
--------------------------------------------------------------------------------
/core/src/main/java/net/hydromatic/optiq/tools/ValidationException.java:
--------------------------------------------------------------------------------
1 | /*
2 | // Licensed to Julian Hyde under one or more contributor license
3 | // agreements. See the NOTICE file distributed with this work for
4 | // additional information regarding copyright ownership.
5 | //
6 | // Julian Hyde licenses this file to you under the Apache License,
7 | // Version 2.0 (the "License"); you may not use this file except in
8 | // compliance with the License. You may obtain a copy of the License at:
9 | //
10 | // http://www.apache.org/licenses/LICENSE-2.0
11 | //
12 | // Unless required by applicable law or agreed to in writing, software
13 | // distributed under the License is distributed on an "AS IS" BASIS,
14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | // See the License for the specific language governing permissions and
16 | // limitations under the License.
17 | */
18 | package net.hydromatic.optiq.tools;
19 |
20 | /**
21 | * An Exception thrown when attempting to validate a SQL parse tree.
22 | */
23 | public class ValidationException extends Exception {
24 | /** Creates a ValidationException with the specified detail message and
25 | * cause. */
26 | public ValidationException(String message, Throwable cause) {
27 | super(message, cause);
28 | }
29 |
30 | /** Creates a ValidationException with the specified detail message. */
31 | public ValidationException(String message) {
32 | super(message);
33 | }
34 |
35 | /** Creates a ValidationException with the specified cause. */
36 | public ValidationException(Throwable cause) {
37 | super(cause);
38 | }
39 | }
40 |
41 | // End ValidationException.java
42 |
--------------------------------------------------------------------------------
/core/src/main/java/net/hydromatic/optiq/tools/package-info.java:
--------------------------------------------------------------------------------
1 | /*
2 | // Licensed to Julian Hyde under one or more contributor license
3 | // agreements. See the NOTICE file distributed with this work for
4 | // additional information regarding copyright ownership.
5 | //
6 | // Julian Hyde licenses this file to you under the Apache License,
7 | // Version 2.0 (the "License"); you may not use this file except in
8 | // compliance with the License. You may obtain a copy of the License at:
9 | //
10 | // http://www.apache.org/licenses/LICENSE-2.0
11 | //
12 | // Unless required by applicable law or agreed to in writing, software
13 | // distributed under the License is distributed on an "AS IS" BASIS,
14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | // See the License for the specific language governing permissions and
16 | // limitations under the License.
17 | */
18 |
19 | /**
20 | * Provides utility classes.
21 | */
22 | package net.hydromatic.optiq.tools;
23 |
24 | // End package-info.java
25 |
--------------------------------------------------------------------------------
/core/src/main/java/net/hydromatic/optiq/util/graph/CycleDetector.java:
--------------------------------------------------------------------------------
1 | /*
2 | // Licensed to Julian Hyde under one or more contributor license
3 | // agreements. See the NOTICE file distributed with this work for
4 | // additional information regarding copyright ownership.
5 | //
6 | // Julian Hyde licenses this file to you under the Apache License,
7 | // Version 2.0 (the "License"); you may not use this file except in
8 | // compliance with the License. You may obtain a copy of the License at:
9 | //
10 | // http://www.apache.org/licenses/LICENSE-2.0
11 | //
12 | // Unless required by applicable law or agreed to in writing, software
13 | // distributed under the License is distributed on an "AS IS" BASIS,
14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | // See the License for the specific language governing permissions and
16 | // limitations under the License.
17 | */
18 | package net.hydromatic.optiq.util.graph;
19 |
20 | import java.util.Set;
21 |
22 | /**
23 | * Detects cycles in directed graphs.
24 | *
25 | * @param Vertex type
26 | * @param Edge type
27 | */
28 | public class CycleDetector {
29 | private final DirectedGraph graph;
30 |
31 | public CycleDetector(DirectedGraph graph) {
32 | this.graph = graph;
33 | }
34 |
35 | public Set findCycles() {
36 | return new TopologicalOrderIterator(graph).findCycles();
37 | }
38 | }
39 |
40 | // End CycleDetector.java
41 |
42 |
--------------------------------------------------------------------------------
/core/src/main/java/net/hydromatic/optiq/util/graph/package-info.java:
--------------------------------------------------------------------------------
1 | /*
2 | // Licensed to Julian Hyde under one or more contributor license
3 | // agreements. See the NOTICE file distributed with this work for
4 | // additional information regarding copyright ownership.
5 | //
6 | // Julian Hyde licenses this file to you under the Apache License,
7 | // Version 2.0 (the "License"); you may not use this file except in
8 | // compliance with the License. You may obtain a copy of the License at:
9 | //
10 | // http://www.apache.org/licenses/LICENSE-2.0
11 | //
12 | // Unless required by applicable law or agreed to in writing, software
13 | // distributed under the License is distributed on an "AS IS" BASIS,
14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | // See the License for the specific language governing permissions and
16 | // limitations under the License.
17 | */
18 |
19 | /**
20 | * Graph-theoretic algorithms and data structures.
21 | */
22 | package net.hydromatic.optiq.util.graph;
23 |
24 | // End package-info.java
25 |
--------------------------------------------------------------------------------
/core/src/main/java/net/hydromatic/optiq/util/package-info.java:
--------------------------------------------------------------------------------
1 | /*
2 | // Licensed to Julian Hyde under one or more contributor license
3 | // agreements. See the NOTICE file distributed with this work for
4 | // additional information regarding copyright ownership.
5 | //
6 | // Julian Hyde licenses this file to you under the Apache License,
7 | // Version 2.0 (the "License"); you may not use this file except in
8 | // compliance with the License. You may obtain a copy of the License at:
9 | //
10 | // http://www.apache.org/licenses/LICENSE-2.0
11 | //
12 | // Unless required by applicable law or agreed to in writing, software
13 | // distributed under the License is distributed on an "AS IS" BASIS,
14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | // See the License for the specific language governing permissions and
16 | // limitations under the License.
17 | */
18 |
19 | /**
20 | * Provides utility classes.
21 | */
22 | package net.hydromatic.optiq.util;
23 |
24 | // End package-info.java
25 |
--------------------------------------------------------------------------------
/core/src/main/java/org/eigenbase/javac/JavaCompiler.java:
--------------------------------------------------------------------------------
1 | /*
2 | // Licensed to Julian Hyde under one or more contributor license
3 | // agreements. See the NOTICE file distributed with this work for
4 | // additional information regarding copyright ownership.
5 | //
6 | // Julian Hyde licenses this file to you under the Apache License,
7 | // Version 2.0 (the "License"); you may not use this file except in
8 | // compliance with the License. You may obtain a copy of the License at:
9 | //
10 | // http://www.apache.org/licenses/LICENSE-2.0
11 | //
12 | // Unless required by applicable law or agreed to in writing, software
13 | // distributed under the License is distributed on an "AS IS" BASIS,
14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | // See the License for the specific language governing permissions and
16 | // limitations under the License.
17 | */
18 | package org.eigenbase.javac;
19 |
20 | /**
21 | * The interface JavaCompiler
represents an interface to invoke a
22 | * regular Java compiler. Classes implementing this interface should accept the
23 | * same arguments as Sun's javac.
24 | */
25 | public interface JavaCompiler {
26 | //~ Methods ----------------------------------------------------------------
27 |
28 | void compile();
29 |
30 | JavaCompilerArgs getArgs();
31 |
32 | ClassLoader getClassLoader();
33 |
34 | int getTotalByteCodeSize();
35 | }
36 |
37 | // End JavaCompiler.java
38 |
--------------------------------------------------------------------------------
/core/src/main/java/org/eigenbase/javac/SynchronizedJaninoCompiler.java:
--------------------------------------------------------------------------------
1 | /*
2 | // Licensed to Julian Hyde under one or more contributor license
3 | // agreements. See the NOTICE file distributed with this work for
4 | // additional information regarding copyright ownership.
5 | //
6 | // Julian Hyde licenses this file to you under the Apache License,
7 | // Version 2.0 (the "License"); you may not use this file except in
8 | // compliance with the License. You may obtain a copy of the License at:
9 | //
10 | // http://www.apache.org/licenses/LICENSE-2.0
11 | //
12 | // Unless required by applicable law or agreed to in writing, software
13 | // distributed under the License is distributed on an "AS IS" BASIS,
14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | // See the License for the specific language governing permissions and
16 | // limitations under the License.
17 | */
18 | package org.eigenbase.javac;
19 |
20 | /**
21 | * SynchronizedJaninoCompiler exists as a fallback in case Janino has
22 | * more multi-threading bugs. We hope never to have to use it, but
23 | * if necessary:
24 | * alter system set "javaCompilerClassName" =
25 | * 'org.eigenbase.javac.SynchronizedJaninoCompiler';
26 | */
27 | public class SynchronizedJaninoCompiler extends JaninoCompiler {
28 | // override JaninoCompiler
29 | public void compile() {
30 | synchronized (SynchronizedJaninoCompiler.class) {
31 | super.compile();
32 | }
33 | }
34 | }
35 |
36 | // End SynchronizedJaninoCompiler.java
37 |
--------------------------------------------------------------------------------
/core/src/main/java/org/eigenbase/javac/package-info.java:
--------------------------------------------------------------------------------
1 | /*
2 | // Licensed to Julian Hyde under one or more contributor license
3 | // agreements. See the NOTICE file distributed with this work for
4 | // additional information regarding copyright ownership.
5 | //
6 | // Julian Hyde licenses this file to you under the Apache License,
7 | // Version 2.0 (the "License"); you may not use this file except in
8 | // compliance with the License. You may obtain a copy of the License at:
9 | //
10 | // http://www.apache.org/licenses/LICENSE-2.0
11 | //
12 | // Unless required by applicable law or agreed to in writing, software
13 | // distributed under the License is distributed on an "AS IS" BASIS,
14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | // See the License for the specific language governing permissions and
16 | // limitations under the License.
17 | */
18 |
19 | /**
20 | * Provides compilers for Java code.
21 | */
22 | package org.eigenbase.javac;
23 |
24 | // End package-info.java
25 |
--------------------------------------------------------------------------------
/core/src/main/java/org/eigenbase/jdbc4/package-info.java:
--------------------------------------------------------------------------------
1 | /*
2 | // Licensed to Julian Hyde under one or more contributor license
3 | // agreements. See the NOTICE file distributed with this work for
4 | // additional information regarding copyright ownership.
5 | //
6 | // Julian Hyde licenses this file to you under the Apache License,
7 | // Version 2.0 (the "License"); you may not use this file except in
8 | // compliance with the License. You may obtain a copy of the License at:
9 | //
10 | // http://www.apache.org/licenses/LICENSE-2.0
11 | //
12 | // Unless required by applicable law or agreed to in writing, software
13 | // distributed under the License is distributed on an "AS IS" BASIS,
14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | // See the License for the specific language governing permissions and
16 | // limitations under the License.
17 | */
18 |
19 | /**
20 | * Provides source compatibility gunk when building a JDBC 4.0 driver
21 | * implementation against JDK 1.5. For more information, see
22 | * Eigenpedia .
23 | */
24 | package org.eigenbase.jdbc4;
25 |
26 | // End package-info.java
27 |
--------------------------------------------------------------------------------
/core/src/main/java/org/eigenbase/rel/RelCollation.java:
--------------------------------------------------------------------------------
1 | /*
2 | // Licensed to Julian Hyde under one or more contributor license
3 | // agreements. See the NOTICE file distributed with this work for
4 | // additional information regarding copyright ownership.
5 | //
6 | // Julian Hyde licenses this file to you under the Apache License,
7 | // Version 2.0 (the "License"); you may not use this file except in
8 | // compliance with the License. You may obtain a copy of the License at:
9 | //
10 | // http://www.apache.org/licenses/LICENSE-2.0
11 | //
12 | // Unless required by applicable law or agreed to in writing, software
13 | // distributed under the License is distributed on an "AS IS" BASIS,
14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | // See the License for the specific language governing permissions and
16 | // limitations under the License.
17 | */
18 | package org.eigenbase.rel;
19 |
20 | import java.util.*;
21 |
22 | import org.eigenbase.relopt.RelTrait;
23 |
24 | /**
25 | * Description of the physical ordering of a relational expression.
26 | *
27 | * An ordering consists of a list of one or more column ordinals and the
28 | * direction of the ordering.
29 | */
30 | public interface RelCollation extends RelTrait {
31 | //~ Methods ----------------------------------------------------------------
32 |
33 | /**
34 | * Returns the ordinals and directions of the columns in this ordering.
35 | */
36 | List getFieldCollations();
37 | }
38 |
39 | // End RelCollation.java
40 |
--------------------------------------------------------------------------------
/core/src/main/java/org/eigenbase/rel/RelShuttle.java:
--------------------------------------------------------------------------------
1 | /*
2 | // Licensed to Julian Hyde under one or more contributor license
3 | // agreements. See the NOTICE file distributed with this work for
4 | // additional information regarding copyright ownership.
5 | //
6 | // Julian Hyde licenses this file to you under the Apache License,
7 | // Version 2.0 (the "License"); you may not use this file except in
8 | // compliance with the License. You may obtain a copy of the License at:
9 | //
10 | // http://www.apache.org/licenses/LICENSE-2.0
11 | //
12 | // Unless required by applicable law or agreed to in writing, software
13 | // distributed under the License is distributed on an "AS IS" BASIS,
14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | // See the License for the specific language governing permissions and
16 | // limitations under the License.
17 | */
18 | package org.eigenbase.rel;
19 |
20 | /**
21 | * Visitor that has methods for the common logical relational expressions.
22 | */
23 | public interface RelShuttle {
24 | RelNode visit(TableAccessRelBase scan);
25 |
26 | RelNode visit(TableFunctionRelBase scan);
27 |
28 | RelNode visit(ValuesRel values);
29 |
30 | RelNode visit(FilterRel filter);
31 |
32 | RelNode visit(ProjectRel project);
33 |
34 | RelNode visit(JoinRel join);
35 |
36 | RelNode visit(UnionRel union);
37 |
38 | RelNode visit(IntersectRel intersect);
39 |
40 | RelNode visit(MinusRel minus);
41 |
42 | RelNode visit(AggregateRel aggregate);
43 |
44 | RelNode visit(SortRel sort);
45 |
46 | RelNode visit(RelNode other);
47 | }
48 |
49 | // End RelShuttle.java
50 |
--------------------------------------------------------------------------------
/core/src/main/java/org/eigenbase/rel/convert/package-info.java:
--------------------------------------------------------------------------------
1 | /*
2 | // Licensed to Julian Hyde under one or more contributor license
3 | // agreements. See the NOTICE file distributed with this work for
4 | // additional information regarding copyright ownership.
5 | //
6 | // Julian Hyde licenses this file to you under the Apache License,
7 | // Version 2.0 (the "License"); you may not use this file except in
8 | // compliance with the License. You may obtain a copy of the License at:
9 | //
10 | // http://www.apache.org/licenses/LICENSE-2.0
11 | //
12 | // Unless required by applicable law or agreed to in writing, software
13 | // distributed under the License is distributed on an "AS IS" BASIS,
14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | // See the License for the specific language governing permissions and
16 | // limitations under the License.
17 | */
18 |
19 | /**
20 | * Defines relational expressions and rules for converting between calling
21 | * conventions.
22 | */
23 | package org.eigenbase.rel.convert;
24 |
25 | // End package-info.java
26 |
--------------------------------------------------------------------------------
/core/src/main/java/org/eigenbase/rel/jdbc/package-info.java:
--------------------------------------------------------------------------------
1 | /*
2 | // Licensed to Julian Hyde under one or more contributor license
3 | // agreements. See the NOTICE file distributed with this work for
4 | // additional information regarding copyright ownership.
5 | //
6 | // Julian Hyde licenses this file to you under the Apache License,
7 | // Version 2.0 (the "License"); you may not use this file except in
8 | // compliance with the License. You may obtain a copy of the License at:
9 | //
10 | // http://www.apache.org/licenses/LICENSE-2.0
11 | //
12 | // Unless required by applicable law or agreed to in writing, software
13 | // distributed under the License is distributed on an "AS IS" BASIS,
14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | // See the License for the specific language governing permissions and
16 | // limitations under the License.
17 | */
18 |
19 | /**
20 | * Contains query transformation rules relating to generating SQL for
21 | * foreign JDBC databases.
22 | */
23 | package org.eigenbase.rel.jdbc;
24 |
25 | // End package-info.java
26 |
--------------------------------------------------------------------------------
/core/src/main/java/org/eigenbase/rel/metadata/MetadataFactory.java:
--------------------------------------------------------------------------------
1 | /*
2 | // Licensed to Julian Hyde under one or more contributor license
3 | // agreements. See the NOTICE file distributed with this work for
4 | // additional information regarding copyright ownership.
5 | //
6 | // Julian Hyde licenses this file to you under the Apache License,
7 | // Version 2.0 (the "License"); you may not use this file except in
8 | // compliance with the License. You may obtain a copy of the License at:
9 | //
10 | // http://www.apache.org/licenses/LICENSE-2.0
11 | //
12 | // Unless required by applicable law or agreed to in writing, software
13 | // distributed under the License is distributed on an "AS IS" BASIS,
14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | // See the License for the specific language governing permissions and
16 | // limitations under the License.
17 | */
18 | package org.eigenbase.rel.metadata;
19 |
20 | import org.eigenbase.rel.RelNode;
21 |
22 | /**
23 | * Source of metadata about relational expressions.
24 | *
25 | * The metadata is typically various kinds of statistics used to estimate
26 | * costs.
27 | *
28 | * Each kind of metadata has an interface that extends {@link Metadata} and
29 | * has a method. Some examples: {@link BuiltInMetadata.Selectivity},
30 | * {@link BuiltInMetadata.ColumnUniqueness}.
31 | */
32 | public interface MetadataFactory {
33 | /** Returns a metadata interface to get a particular kind of metadata
34 | * from a particular relational expression. Returns null if that kind of
35 | * metadata is not available. */
36 | T query(RelNode rel, Class clazz);
37 | }
38 |
39 | // End MetadataFactory.java
40 |
--------------------------------------------------------------------------------
/core/src/main/java/org/eigenbase/rel/metadata/package-info.java:
--------------------------------------------------------------------------------
1 | /*
2 | // Licensed to Julian Hyde under one or more contributor license
3 | // agreements. See the NOTICE file distributed with this work for
4 | // additional information regarding copyright ownership.
5 | //
6 | // Julian Hyde licenses this file to you under the Apache License,
7 | // Version 2.0 (the "License"); you may not use this file except in
8 | // compliance with the License. You may obtain a copy of the License at:
9 | //
10 | // http://www.apache.org/licenses/LICENSE-2.0
11 | //
12 | // Unless required by applicable law or agreed to in writing, software
13 | // distributed under the License is distributed on an "AS IS" BASIS,
14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | // See the License for the specific language governing permissions and
16 | // limitations under the License.
17 | */
18 |
19 | /**
20 | * Defines metadata interfaces and utilities for relational
21 | * expressions.
22 | */
23 | package org.eigenbase.rel.metadata;
24 |
25 | // End package-info.java
26 |
--------------------------------------------------------------------------------
/core/src/main/java/org/eigenbase/rel/package-info.java:
--------------------------------------------------------------------------------
1 | /*
2 | // Licensed to Julian Hyde under one or more contributor license
3 | // agreements. See the NOTICE file distributed with this work for
4 | // additional information regarding copyright ownership.
5 | //
6 | // Julian Hyde licenses this file to you under the Apache License,
7 | // Version 2.0 (the "License"); you may not use this file except in
8 | // compliance with the License. You may obtain a copy of the License at:
9 | //
10 | // http://www.apache.org/licenses/LICENSE-2.0
11 | //
12 | // Unless required by applicable law or agreed to in writing, software
13 | // distributed under the License is distributed on an "AS IS" BASIS,
14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | // See the License for the specific language governing permissions and
16 | // limitations under the License.
17 | */
18 |
19 | /**
20 | * Defines relational expressions.
21 | *
22 | * Related packages and classes
23 | *
37 | */
38 | package org.eigenbase.rel;
39 |
40 | // End package-info.java
41 |
--------------------------------------------------------------------------------
/core/src/main/java/org/eigenbase/rel/rules/package-info.java:
--------------------------------------------------------------------------------
1 | /*
2 | // Licensed to Julian Hyde under one or more contributor license
3 | // agreements. See the NOTICE file distributed with this work for
4 | // additional information regarding copyright ownership.
5 | //
6 | // Julian Hyde licenses this file to you under the Apache License,
7 | // Version 2.0 (the "License"); you may not use this file except in
8 | // compliance with the License. You may obtain a copy of the License at:
9 | //
10 | // http://www.apache.org/licenses/LICENSE-2.0
11 | //
12 | // Unless required by applicable law or agreed to in writing, software
13 | // distributed under the License is distributed on an "AS IS" BASIS,
14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | // See the License for the specific language governing permissions and
16 | // limitations under the License.
17 | */
18 |
19 | /**
20 | * Defines relational expressions.
21 | *
22 | * Related packages and classes
23 | *
34 | */
35 | package org.eigenbase.rel.rules;
36 |
37 | // End package-info.java
38 |
--------------------------------------------------------------------------------
/core/src/main/java/org/eigenbase/relopt/CommonRelSubExprRule.java:
--------------------------------------------------------------------------------
1 | /*
2 | // Licensed to Julian Hyde under one or more contributor license
3 | // agreements. See the NOTICE file distributed with this work for
4 | // additional information regarding copyright ownership.
5 | //
6 | // Julian Hyde licenses this file to you under the Apache License,
7 | // Version 2.0 (the "License"); you may not use this file except in
8 | // compliance with the License. You may obtain a copy of the License at:
9 | //
10 | // http://www.apache.org/licenses/LICENSE-2.0
11 | //
12 | // Unless required by applicable law or agreed to in writing, software
13 | // distributed under the License is distributed on an "AS IS" BASIS,
14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | // See the License for the specific language governing permissions and
16 | // limitations under the License.
17 | */
18 | package org.eigenbase.relopt;
19 |
20 |
21 | /**
22 | * A CommonRelSubExprRule
is an abstract base class for rules
23 | * that are fired only on relational expressions that appear more than once
24 | * in a query tree.
25 | */
26 | public abstract class CommonRelSubExprRule extends RelOptRule {
27 | //~ Constructors -----------------------------------------------------------
28 |
29 | /**
30 | * Creates a CommonRelSubExprRule
.
31 | *
32 | * @param operand root operand, must not be null
33 | */
34 | public CommonRelSubExprRule(RelOptRuleOperand operand) {
35 | super(operand);
36 | }
37 | }
38 |
39 | // End CommonRelSubExprRule.java
40 |
--------------------------------------------------------------------------------
/core/src/main/java/org/eigenbase/relopt/RelOptConnection.java:
--------------------------------------------------------------------------------
1 | /*
2 | // Licensed to Julian Hyde under one or more contributor license
3 | // agreements. See the NOTICE file distributed with this work for
4 | // additional information regarding copyright ownership.
5 | //
6 | // Julian Hyde licenses this file to you under the Apache License,
7 | // Version 2.0 (the "License"); you may not use this file except in
8 | // compliance with the License. You may obtain a copy of the License at:
9 | //
10 | // http://www.apache.org/licenses/LICENSE-2.0
11 | //
12 | // Unless required by applicable law or agreed to in writing, software
13 | // distributed under the License is distributed on an "AS IS" BASIS,
14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | // See the License for the specific language governing permissions and
16 | // limitations under the License.
17 | */
18 | package org.eigenbase.relopt;
19 |
20 | /**
21 | * The planner's view of a connection to a database.
22 | *
23 | * A connection contains a {@link RelOptSchema}, via which the query planner
24 | * can access {@link RelOptTable} objects.
25 | */
26 | public interface RelOptConnection {
27 | /**
28 | * Returns the schema underlying this connection.
29 | */
30 | RelOptSchema getRelOptSchema();
31 | }
32 |
33 | // End RelOptConnection.java
34 |
--------------------------------------------------------------------------------
/core/src/main/java/org/eigenbase/relopt/RelOptCostFactory.java:
--------------------------------------------------------------------------------
1 | /*
2 | // Licensed to Julian Hyde under one or more contributor license
3 | // agreements. See the NOTICE file distributed with this work for
4 | // additional information regarding copyright ownership.
5 | //
6 | // Julian Hyde licenses this file to you under the Apache License,
7 | // Version 2.0 (the "License"); you may not use this file except in
8 | // compliance with the License. You may obtain a copy of the License at:
9 | //
10 | // http://www.apache.org/licenses/LICENSE-2.0
11 | //
12 | // Unless required by applicable law or agreed to in writing, software
13 | // distributed under the License is distributed on an "AS IS" BASIS,
14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | // See the License for the specific language governing permissions and
16 | // limitations under the License.
17 | */
18 | package org.eigenbase.relopt;
19 |
20 | /**
21 | * Cost model for query planning.
22 | */
23 | public interface RelOptCostFactory {
24 | /**
25 | * Creates a cost object.
26 | */
27 | RelOptCost makeCost(double rowCount, double cpu, double io);
28 |
29 | /**
30 | * Creates a cost object representing an enormous non-infinite cost.
31 | */
32 | RelOptCost makeHugeCost();
33 |
34 | /**
35 | * Creates a cost object representing infinite cost.
36 | */
37 | RelOptCost makeInfiniteCost();
38 |
39 | /**
40 | * Creates a cost object representing a small positive cost.
41 | */
42 | RelOptCost makeTinyCost();
43 |
44 | /**
45 | * Creates a cost object representing zero cost.
46 | */
47 | RelOptCost makeZeroCost();
48 | }
49 |
50 | // End RelOptCostFactory.java
51 |
--------------------------------------------------------------------------------
/core/src/main/java/org/eigenbase/relopt/hep/HepMatchOrder.java:
--------------------------------------------------------------------------------
1 | /*
2 | // Licensed to Julian Hyde under one or more contributor license
3 | // agreements. See the NOTICE file distributed with this work for
4 | // additional information regarding copyright ownership.
5 | //
6 | // Julian Hyde licenses this file to you under the Apache License,
7 | // Version 2.0 (the "License"); you may not use this file except in
8 | // compliance with the License. You may obtain a copy of the License at:
9 | //
10 | // http://www.apache.org/licenses/LICENSE-2.0
11 | //
12 | // Unless required by applicable law or agreed to in writing, software
13 | // distributed under the License is distributed on an "AS IS" BASIS,
14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | // See the License for the specific language governing permissions and
16 | // limitations under the License.
17 | */
18 | package org.eigenbase.relopt.hep;
19 |
20 | /**
21 | * HepMatchOrder specifies the order of graph traversal when looking for rule
22 | * matches.
23 | */
24 | public enum HepMatchOrder {
25 | /**
26 | * Match in arbitrary order. This is the default because it is the most
27 | * efficient, and most rules don't care about order.
28 | */
29 | ARBITRARY,
30 |
31 | /**
32 | * Match from leaves up. A match attempt at a descendant precedes all match
33 | * attempts at its ancestors.
34 | */
35 | BOTTOM_UP,
36 |
37 | /**
38 | * Match from root down. A match attempt at an ancestor always precedes all
39 | * match attempts at its descendants.
40 | */
41 | TOP_DOWN
42 | }
43 |
44 | // End HepMatchOrder.java
45 |
--------------------------------------------------------------------------------
/core/src/main/java/org/eigenbase/relopt/hep/package-info.java:
--------------------------------------------------------------------------------
1 | /*
2 | // Licensed to Julian Hyde under one or more contributor license
3 | // agreements. See the NOTICE file distributed with this work for
4 | // additional information regarding copyright ownership.
5 | //
6 | // Julian Hyde licenses this file to you under the Apache License,
7 | // Version 2.0 (the "License"); you may not use this file except in
8 | // compliance with the License. You may obtain a copy of the License at:
9 | //
10 | // http://www.apache.org/licenses/LICENSE-2.0
11 | //
12 | // Unless required by applicable law or agreed to in writing, software
13 | // distributed under the License is distributed on an "AS IS" BASIS,
14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | // See the License for the specific language governing permissions and
16 | // limitations under the License.
17 | */
18 |
19 | /**
20 | * Provides a heuristic planner implementation for the interfaces in
21 | * {@link org.eigenbase.relopt}.
22 | */
23 | package org.eigenbase.relopt.hep;
24 |
25 | // End package-info.java
26 |
--------------------------------------------------------------------------------
/core/src/main/java/org/eigenbase/relopt/package-info.java:
--------------------------------------------------------------------------------
1 | /*
2 | // Licensed to Julian Hyde under one or more contributor license
3 | // agreements. See the NOTICE file distributed with this work for
4 | // additional information regarding copyright ownership.
5 | //
6 | // Julian Hyde licenses this file to you under the Apache License,
7 | // Version 2.0 (the "License"); you may not use this file except in
8 | // compliance with the License. You may obtain a copy of the License at:
9 | //
10 | // http://www.apache.org/licenses/LICENSE-2.0
11 | //
12 | // Unless required by applicable law or agreed to in writing, software
13 | // distributed under the License is distributed on an "AS IS" BASIS,
14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | // See the License for the specific language governing permissions and
16 | // limitations under the License.
17 | */
18 |
19 | /**
20 | * Defines interfaces for constructing rule-based optimizers of
21 | * relational expressions.
22 | */
23 | package org.eigenbase.relopt;
24 |
25 | // End package-info.java
26 |
--------------------------------------------------------------------------------
/core/src/main/java/org/eigenbase/relopt/volcano/VolcanoPlannerPhase.java:
--------------------------------------------------------------------------------
1 | /*
2 | // Licensed to Julian Hyde under one or more contributor license
3 | // agreements. See the NOTICE file distributed with this work for
4 | // additional information regarding copyright ownership.
5 | //
6 | // Julian Hyde licenses this file to you under the Apache License,
7 | // Version 2.0 (the "License"); you may not use this file except in
8 | // compliance with the License. You may obtain a copy of the License at:
9 | //
10 | // http://www.apache.org/licenses/LICENSE-2.0
11 | //
12 | // Unless required by applicable law or agreed to in writing, software
13 | // distributed under the License is distributed on an "AS IS" BASIS,
14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | // See the License for the specific language governing permissions and
16 | // limitations under the License.
17 | */
18 | package org.eigenbase.relopt.volcano;
19 |
20 | /**
21 | * VolcanoPlannerPhase represents the phases of operation that the {@link
22 | * VolcanoPlanner} passes through during optimization of a tree of {@link
23 | * org.eigenbase.rel.RelNode} objects.
24 | */
25 | public enum VolcanoPlannerPhase {
26 | PRE_PROCESS_MDR, PRE_PROCESS, OPTIMIZE, CLEANUP,
27 | }
28 |
29 | // End VolcanoPlannerPhase.java
30 |
--------------------------------------------------------------------------------
/core/src/main/java/org/eigenbase/reltype/RelDataTypeComparability.java:
--------------------------------------------------------------------------------
1 | /*
2 | // Licensed to Julian Hyde under one or more contributor license
3 | // agreements. See the NOTICE file distributed with this work for
4 | // additional information regarding copyright ownership.
5 | //
6 | // Julian Hyde licenses this file to you under the Apache License,
7 | // Version 2.0 (the "License"); you may not use this file except in
8 | // compliance with the License. You may obtain a copy of the License at:
9 | //
10 | // http://www.apache.org/licenses/LICENSE-2.0
11 | //
12 | // Unless required by applicable law or agreed to in writing, software
13 | // distributed under the License is distributed on an "AS IS" BASIS,
14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | // See the License for the specific language governing permissions and
16 | // limitations under the License.
17 | */
18 | package org.eigenbase.reltype;
19 |
20 | import org.eigenbase.util.*;
21 |
22 | /**
23 | * RelDataTypeComparability is an enumeration of the categories of comparison
24 | * operators which types may support.
25 | *
26 | * NOTE jvs 17-Mar-2005: the order of values of this enumeration is
27 | * significant (from least inclusive to most inclusive) and should not be
28 | * changed.
29 | */
30 | public enum RelDataTypeComparability {
31 | NONE("No comparisons allowed"),
32 | UNORDERED("Only equals/not-equals allowed"),
33 | ALL("All comparisons allowed");
34 |
35 | RelDataTypeComparability(String description) {
36 | Util.discard(description);
37 | }
38 | }
39 |
40 | // End RelDataTypeComparability.java
41 |
--------------------------------------------------------------------------------
/core/src/main/java/org/eigenbase/reltype/RelDataTypeFamily.java:
--------------------------------------------------------------------------------
1 | /*
2 | // Licensed to Julian Hyde under one or more contributor license
3 | // agreements. See the NOTICE file distributed with this work for
4 | // additional information regarding copyright ownership.
5 | //
6 | // Julian Hyde licenses this file to you under the Apache License,
7 | // Version 2.0 (the "License"); you may not use this file except in
8 | // compliance with the License. You may obtain a copy of the License at:
9 | //
10 | // http://www.apache.org/licenses/LICENSE-2.0
11 | //
12 | // Unless required by applicable law or agreed to in writing, software
13 | // distributed under the License is distributed on an "AS IS" BASIS,
14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | // See the License for the specific language governing permissions and
16 | // limitations under the License.
17 | */
18 | package org.eigenbase.reltype;
19 |
20 | /**
21 | * RelDataTypeFamily represents a family of related types. The specific criteria
22 | * for membership in a type family are type-system dependent.
23 | */
24 | public interface RelDataTypeFamily {
25 | }
26 |
27 | // End RelDataTypeFamily.java
28 |
--------------------------------------------------------------------------------
/core/src/main/java/org/eigenbase/reltype/RelProtoDataType.java:
--------------------------------------------------------------------------------
1 | /*
2 | // Licensed to Julian Hyde under one or more contributor license
3 | // agreements. See the NOTICE file distributed with this work for
4 | // additional information regarding copyright ownership.
5 | //
6 | // Julian Hyde licenses this file to you under the Apache License,
7 | // Version 2.0 (the "License"); you may not use this file except in
8 | // compliance with the License. You may obtain a copy of the License at:
9 | //
10 | // http://www.apache.org/licenses/LICENSE-2.0
11 | //
12 | // Unless required by applicable law or agreed to in writing, software
13 | // distributed under the License is distributed on an "AS IS" BASIS,
14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | // See the License for the specific language governing permissions and
16 | // limitations under the License.
17 | */
18 | package org.eigenbase.reltype;
19 |
20 | import net.hydromatic.linq4j.function.Function1;
21 |
22 | /**
23 | * Can be converted into a {@link RelDataType} given a
24 | * {@link org.eigenbase.reltype.RelDataTypeFactory}.
25 | *
26 | * @see org.eigenbase.reltype.RelDataTypeImpl#proto
27 | */
28 | public interface RelProtoDataType
29 | extends Function1 {
30 | }
31 |
32 | // End RelProtoDataType.java
33 |
--------------------------------------------------------------------------------
/core/src/main/java/org/eigenbase/reltype/package-info.java:
--------------------------------------------------------------------------------
1 | /*
2 | // Licensed to Julian Hyde under one or more contributor license
3 | // agreements. See the NOTICE file distributed with this work for
4 | // additional information regarding copyright ownership.
5 | //
6 | // Julian Hyde licenses this file to you under the Apache License,
7 | // Version 2.0 (the "License"); you may not use this file except in
8 | // compliance with the License. You may obtain a copy of the License at:
9 | //
10 | // http://www.apache.org/licenses/LICENSE-2.0
11 | //
12 | // Unless required by applicable law or agreed to in writing, software
13 | // distributed under the License is distributed on an "AS IS" BASIS,
14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | // See the License for the specific language governing permissions and
16 | // limitations under the License.
17 | */
18 |
19 | /**
20 | * Defines a type system for relational expressions.
21 | */
22 | package org.eigenbase.reltype;
23 |
24 | // End package-info.java
25 |
--------------------------------------------------------------------------------
/core/src/main/java/org/eigenbase/resource/Feature.java:
--------------------------------------------------------------------------------
1 | /*
2 | // Licensed to Julian Hyde under one or more contributor license
3 | // agreements. See the NOTICE file distributed with this work for
4 | // additional information regarding copyright ownership.
5 | //
6 | // Julian Hyde licenses this file to you under the Apache License,
7 | // Version 2.0 (the "License"); you may not use this file except in
8 | // compliance with the License. You may obtain a copy of the License at:
9 | //
10 | // http://www.apache.org/licenses/LICENSE-2.0
11 | //
12 | // Unless required by applicable law or agreed to in writing, software
13 | // distributed under the License is distributed on an "AS IS" BASIS,
14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | // See the License for the specific language governing permissions and
16 | // limitations under the License.
17 | */
18 | package org.eigenbase.resource;
19 |
20 | import java.lang.reflect.Method;
21 | import java.util.Locale;
22 |
23 | import org.eigenbase.util.EigenbaseContextException;
24 |
25 | /** SQL language feature. Expressed as the exception that would be thrown if it
26 | * were used while disabled. */
27 | public class Feature
28 | extends Resources.ExInstWithCause {
29 | public Feature(String base, Locale locale, Method method, Object... args) {
30 | super(base, locale, method, args);
31 | }
32 | }
33 |
34 | // End Feature.java
35 |
--------------------------------------------------------------------------------
/core/src/main/java/org/eigenbase/resource/package-info.java:
--------------------------------------------------------------------------------
1 | /*
2 | // Licensed to Julian Hyde under one or more contributor license
3 | // agreements. See the NOTICE file distributed with this work for
4 | // additional information regarding copyright ownership.
5 | //
6 | // Julian Hyde licenses this file to you under the Apache License,
7 | // Version 2.0 (the "License"); you may not use this file except in
8 | // compliance with the License. You may obtain a copy of the License at:
9 | //
10 | // http://www.apache.org/licenses/LICENSE-2.0
11 | //
12 | // Unless required by applicable law or agreed to in writing, software
13 | // distributed under the License is distributed on an "AS IS" BASIS,
14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | // See the License for the specific language governing permissions and
16 | // limitations under the License.
17 | */
18 |
19 | /**
20 | * Defines resources used for Eigenbase internationalization.
21 | */
22 | package org.eigenbase.resource;
23 |
24 | // End package-info.java
25 |
--------------------------------------------------------------------------------
/core/src/main/java/org/eigenbase/rex/RexAction.java:
--------------------------------------------------------------------------------
1 | /*
2 | // Licensed to Julian Hyde under one or more contributor license
3 | // agreements. See the NOTICE file distributed with this work for
4 | // additional information regarding copyright ownership.
5 | //
6 | // Julian Hyde licenses this file to you under the Apache License,
7 | // Version 2.0 (the "License"); you may not use this file except in
8 | // compliance with the License. You may obtain a copy of the License at:
9 | //
10 | // http://www.apache.org/licenses/LICENSE-2.0
11 | //
12 | // Unless required by applicable law or agreed to in writing, software
13 | // distributed under the License is distributed on an "AS IS" BASIS,
14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | // See the License for the specific language governing permissions and
16 | // limitations under the License.
17 | */
18 | package org.eigenbase.rex;
19 |
20 | /**
21 | * A RexAction
is called when a {@link RexPattern} finds a match.
22 | * It yields a {@link RexNode} by substituting the matching tokens.
23 | */
24 | public interface RexAction {
25 | //~ Methods ----------------------------------------------------------------
26 |
27 | void onMatch(RexNode[] tokens);
28 | }
29 |
30 | // End RexAction.java
31 |
--------------------------------------------------------------------------------
/core/src/main/java/org/eigenbase/rex/RexPattern.java:
--------------------------------------------------------------------------------
1 | /*
2 | // Licensed to Julian Hyde under one or more contributor license
3 | // agreements. See the NOTICE file distributed with this work for
4 | // additional information regarding copyright ownership.
5 | //
6 | // Julian Hyde licenses this file to you under the Apache License,
7 | // Version 2.0 (the "License"); you may not use this file except in
8 | // compliance with the License. You may obtain a copy of the License at:
9 | //
10 | // http://www.apache.org/licenses/LICENSE-2.0
11 | //
12 | // Unless required by applicable law or agreed to in writing, software
13 | // distributed under the License is distributed on an "AS IS" BASIS,
14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | // See the License for the specific language governing permissions and
16 | // limitations under the License.
17 | */
18 | package org.eigenbase.rex;
19 |
20 | /**
21 | * A RexPattern
represents an expression with holes in it. The
22 | * {@link #match} method tests whether a given expression matches the pattern.
23 | */
24 | public interface RexPattern {
25 | //~ Methods ----------------------------------------------------------------
26 |
27 | /**
28 | * Calls action
for every combination of tokens for which this
29 | * pattern matches.
30 | */
31 | void match(
32 | RexNode ptree,
33 | RexAction action);
34 | }
35 |
36 | // End RexPattern.java
37 |
--------------------------------------------------------------------------------
/core/src/main/java/org/eigenbase/rex/RexSqlConvertlet.java:
--------------------------------------------------------------------------------
1 | /*
2 | // Licensed to Julian Hyde under one or more contributor license
3 | // agreements. See the NOTICE file distributed with this work for
4 | // additional information regarding copyright ownership.
5 | //
6 | // Julian Hyde licenses this file to you under the Apache License,
7 | // Version 2.0 (the "License"); you may not use this file except in
8 | // compliance with the License. You may obtain a copy of the License at:
9 | //
10 | // http://www.apache.org/licenses/LICENSE-2.0
11 | //
12 | // Unless required by applicable law or agreed to in writing, software
13 | // distributed under the License is distributed on an "AS IS" BASIS,
14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | // See the License for the specific language governing permissions and
16 | // limitations under the License.
17 | */
18 | package org.eigenbase.rex;
19 |
20 | import org.eigenbase.sql.*;
21 |
22 | /**
23 | * Converts a {@link RexNode} expression into a {@link SqlNode} expression.
24 | */
25 | public interface RexSqlConvertlet {
26 | //~ Methods ----------------------------------------------------------------
27 |
28 | /**
29 | * Converts a {@link RexCall} to a {@link SqlNode} expression.
30 | *
31 | * @param converter to use in translating
32 | * @param call RexCall to translate
33 | * @return SqlNode, or null if translation was unavailable
34 | */
35 | SqlNode convertCall(
36 | RexToSqlNodeConverter converter,
37 | RexCall call);
38 | }
39 |
40 | // End RexSqlConvertlet.java
41 |
--------------------------------------------------------------------------------
/core/src/main/java/org/eigenbase/rex/RexSqlConvertletTable.java:
--------------------------------------------------------------------------------
1 | /*
2 | // Licensed to Julian Hyde under one or more contributor license
3 | // agreements. See the NOTICE file distributed with this work for
4 | // additional information regarding copyright ownership.
5 | //
6 | // Julian Hyde licenses this file to you under the Apache License,
7 | // Version 2.0 (the "License"); you may not use this file except in
8 | // compliance with the License. You may obtain a copy of the License at:
9 | //
10 | // http://www.apache.org/licenses/LICENSE-2.0
11 | //
12 | // Unless required by applicable law or agreed to in writing, software
13 | // distributed under the License is distributed on an "AS IS" BASIS,
14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | // See the License for the specific language governing permissions and
16 | // limitations under the License.
17 | */
18 | package org.eigenbase.rex;
19 |
20 | /**
21 | * Collection of {@link RexSqlConvertlet}s.
22 | */
23 | public interface RexSqlConvertletTable {
24 | //~ Methods ----------------------------------------------------------------
25 |
26 | /**
27 | * Returns the convertlet applicable to a given expression.
28 | */
29 | RexSqlConvertlet get(RexCall call);
30 | }
31 |
32 | // End RexSqlConvertletTable.java
33 |
--------------------------------------------------------------------------------
/core/src/main/java/org/eigenbase/runtime/package-info.java:
--------------------------------------------------------------------------------
1 | /*
2 | // Licensed to Julian Hyde under one or more contributor license
3 | // agreements. See the NOTICE file distributed with this work for
4 | // additional information regarding copyright ownership.
5 | //
6 | // Julian Hyde licenses this file to you under the Apache License,
7 | // Version 2.0 (the "License"); you may not use this file except in
8 | // compliance with the License. You may obtain a copy of the License at:
9 | //
10 | // http://www.apache.org/licenses/LICENSE-2.0
11 | //
12 | // Unless required by applicable law or agreed to in writing, software
13 | // distributed under the License is distributed on an "AS IS" BASIS,
14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | // See the License for the specific language governing permissions and
16 | // limitations under the License.
17 | */
18 |
19 | /**
20 | * Defines classes used by generated Eigenbase classes at runtime.
21 | */
22 | package org.eigenbase.runtime;
23 |
24 | // End package-info.java
25 |
--------------------------------------------------------------------------------
/core/src/main/java/org/eigenbase/sarg/SargBoundType.java:
--------------------------------------------------------------------------------
1 | /*
2 | // Licensed to Julian Hyde under one or more contributor license
3 | // agreements. See the NOTICE file distributed with this work for
4 | // additional information regarding copyright ownership.
5 | //
6 | // Julian Hyde licenses this file to you under the Apache License,
7 | // Version 2.0 (the "License"); you may not use this file except in
8 | // compliance with the License. You may obtain a copy of the License at:
9 | //
10 | // http://www.apache.org/licenses/LICENSE-2.0
11 | //
12 | // Unless required by applicable law or agreed to in writing, software
13 | // distributed under the License is distributed on an "AS IS" BASIS,
14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | // See the License for the specific language governing permissions and
16 | // limitations under the License.
17 | */
18 | package org.eigenbase.sarg;
19 |
20 | /**
21 | * SargBoundType defines the possible endpoint boundaries (upper or lower).
22 | */
23 | public enum SargBoundType {
24 | LOWER,
25 |
26 | UPPER
27 | }
28 |
29 | // End SargBoundType.java
30 |
--------------------------------------------------------------------------------
/core/src/main/java/org/eigenbase/sarg/SargSetOperator.java:
--------------------------------------------------------------------------------
1 | /*
2 | // Licensed to Julian Hyde under one or more contributor license
3 | // agreements. See the NOTICE file distributed with this work for
4 | // additional information regarding copyright ownership.
5 | //
6 | // Julian Hyde licenses this file to you under the Apache License,
7 | // Version 2.0 (the "License"); you may not use this file except in
8 | // compliance with the License. You may obtain a copy of the License at:
9 | //
10 | // http://www.apache.org/licenses/LICENSE-2.0
11 | //
12 | // Unless required by applicable law or agreed to in writing, software
13 | // distributed under the License is distributed on an "AS IS" BASIS,
14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | // See the License for the specific language governing permissions and
16 | // limitations under the License.
17 | */
18 | package org.eigenbase.sarg;
19 |
20 | /**
21 | * SargSetOperator defines the supported set operators which can be used to
22 | * combine instances of {@link SargExpr}.
23 | */
24 | public enum SargSetOperator {
25 | /**
26 | * Set intersection over any number of children (no children → universal
27 | * set).
28 | */
29 | INTERSECTION,
30 |
31 | /**
32 | * Set union over any number of children (no children → empty set).
33 | */
34 | UNION,
35 |
36 | /**
37 | * Set complement over exactly one child.
38 | */
39 | COMPLEMENT
40 | }
41 |
42 | // End SargSetOperator.java
43 |
--------------------------------------------------------------------------------
/core/src/main/java/org/eigenbase/sarg/SargStrictness.java:
--------------------------------------------------------------------------------
1 | /*
2 | // Licensed to Julian Hyde under one or more contributor license
3 | // agreements. See the NOTICE file distributed with this work for
4 | // additional information regarding copyright ownership.
5 | //
6 | // Julian Hyde licenses this file to you under the Apache License,
7 | // Version 2.0 (the "License"); you may not use this file except in
8 | // compliance with the License. You may obtain a copy of the License at:
9 | //
10 | // http://www.apache.org/licenses/LICENSE-2.0
11 | //
12 | // Unless required by applicable law or agreed to in writing, software
13 | // distributed under the License is distributed on an "AS IS" BASIS,
14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | // See the License for the specific language governing permissions and
16 | // limitations under the License.
17 | */
18 | package org.eigenbase.sarg;
19 |
20 | /**
21 | * Defines the boundary strictness of an endpoint: either open (either strictly
22 | * less than or greater than) or closed (exactly equal).
23 | */
24 | public enum SargStrictness {
25 | OPEN,
26 |
27 | CLOSED
28 | }
29 |
30 | // End SargStrictness.java
31 |
--------------------------------------------------------------------------------
/core/src/main/java/org/eigenbase/sarg/package-info.java:
--------------------------------------------------------------------------------
1 | /*
2 | // Licensed to Julian Hyde under one or more contributor license
3 | // agreements. See the NOTICE file distributed with this work for
4 | // additional information regarding copyright ownership.
5 | //
6 | // Julian Hyde licenses this file to you under the Apache License,
7 | // Version 2.0 (the "License"); you may not use this file except in
8 | // compliance with the License. You may obtain a copy of the License at:
9 | //
10 | // http://www.apache.org/licenses/LICENSE-2.0
11 | //
12 | // Unless required by applicable law or agreed to in writing, software
13 | // distributed under the License is distributed on an "AS IS" BASIS,
14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | // See the License for the specific language governing permissions and
16 | // limitations under the License.
17 | */
18 |
19 | /**
20 | * Provides a class library for representing arguments to index searches,
21 | * also known as sargs . Unit tests for this package are in
22 | * {@code org.eigenbase.test.SargTest}.
23 | */
24 | package org.eigenbase.sarg;
25 |
26 | // End package-info.java
27 |
--------------------------------------------------------------------------------
/core/src/main/java/org/eigenbase/sql/SqlAccessEnum.java:
--------------------------------------------------------------------------------
1 | /*
2 | // Licensed to Julian Hyde under one or more contributor license
3 | // agreements. See the NOTICE file distributed with this work for
4 | // additional information regarding copyright ownership.
5 | //
6 | // Julian Hyde licenses this file to you under the Apache License,
7 | // Version 2.0 (the "License"); you may not use this file except in
8 | // compliance with the License. You may obtain a copy of the License at:
9 | //
10 | // http://www.apache.org/licenses/LICENSE-2.0
11 | //
12 | // Unless required by applicable law or agreed to in writing, software
13 | // distributed under the License is distributed on an "AS IS" BASIS,
14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | // See the License for the specific language governing permissions and
16 | // limitations under the License.
17 | */
18 | package org.eigenbase.sql;
19 |
20 | /**
21 | * Enumeration representing different access types
22 | */
23 | public enum SqlAccessEnum {
24 | SELECT, UPDATE, INSERT, DELETE;
25 | }
26 |
27 | // End SqlAccessEnum.java
28 |
--------------------------------------------------------------------------------
/core/src/main/java/org/eigenbase/sql/SqlInsertKeyword.java:
--------------------------------------------------------------------------------
1 | /*
2 | // Licensed to Julian Hyde under one or more contributor license
3 | // agreements. See the NOTICE file distributed with this work for
4 | // additional information regarding copyright ownership.
5 | //
6 | // Julian Hyde licenses this file to you under the Apache License,
7 | // Version 2.0 (the "License"); you may not use this file except in
8 | // compliance with the License. You may obtain a copy of the License at:
9 | //
10 | // http://www.apache.org/licenses/LICENSE-2.0
11 | //
12 | // Unless required by applicable law or agreed to in writing, software
13 | // distributed under the License is distributed on an "AS IS" BASIS,
14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | // See the License for the specific language governing permissions and
16 | // limitations under the License.
17 | */
18 | package org.eigenbase.sql;
19 |
20 | /**
21 | * Defines the keywords which can occur immediately after the "INSERT" keyword.
22 | * Standard SQL has no such keywords. This enumeration exists only to allow
23 | * extension projects to define them.
24 | */
25 | public enum SqlInsertKeyword implements SqlLiteral.SqlSymbol {
26 | }
27 |
28 | // End SqlInsertKeyword.java
29 |
--------------------------------------------------------------------------------
/core/src/main/java/org/eigenbase/sql/SqlOperandCountRange.java:
--------------------------------------------------------------------------------
1 | /*
2 | // Licensed to Julian Hyde under one or more contributor license
3 | // agreements. See the NOTICE file distributed with this work for
4 | // additional information regarding copyright ownership.
5 | //
6 | // Julian Hyde licenses this file to you under the Apache License,
7 | // Version 2.0 (the "License"); you may not use this file except in
8 | // compliance with the License. You may obtain a copy of the License at:
9 | //
10 | // http://www.apache.org/licenses/LICENSE-2.0
11 | //
12 | // Unless required by applicable law or agreed to in writing, software
13 | // distributed under the License is distributed on an "AS IS" BASIS,
14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | // See the License for the specific language governing permissions and
16 | // limitations under the License.
17 | */
18 | package org.eigenbase.sql;
19 |
20 |
21 | /**
22 | * A class that describes how many operands an operator can take.
23 | */
24 | public interface SqlOperandCountRange {
25 | /**
26 | * Returns whether {@code count} is a valid number of operands.
27 | */
28 | boolean isValidCount(int count);
29 |
30 | /**
31 | * Returns an lower bound. -1 if there is no lower bound.
32 | */
33 | int getMin();
34 |
35 | /**
36 | * Returns an upper bound. -1 if there is no upper bound.
37 | */
38 | int getMax();
39 |
40 | }
41 |
42 | // End SqlOperandCountRange.java
43 |
--------------------------------------------------------------------------------
/core/src/main/java/org/eigenbase/sql/SqlSelectKeyword.java:
--------------------------------------------------------------------------------
1 | /*
2 | // Licensed to Julian Hyde under one or more contributor license
3 | // agreements. See the NOTICE file distributed with this work for
4 | // additional information regarding copyright ownership.
5 | //
6 | // Julian Hyde licenses this file to you under the Apache License,
7 | // Version 2.0 (the "License"); you may not use this file except in
8 | // compliance with the License. You may obtain a copy of the License at:
9 | //
10 | // http://www.apache.org/licenses/LICENSE-2.0
11 | //
12 | // Unless required by applicable law or agreed to in writing, software
13 | // distributed under the License is distributed on an "AS IS" BASIS,
14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | // See the License for the specific language governing permissions and
16 | // limitations under the License.
17 | */
18 | package org.eigenbase.sql;
19 |
20 | import org.eigenbase.sql.parser.SqlParserPos;
21 |
22 | /**
23 | * Defines the keywords which can occur immediately after the "SELECT" keyword.
24 | */
25 | public enum SqlSelectKeyword implements SqlLiteral.SqlSymbol {
26 | DISTINCT,
27 | ALL;
28 |
29 | /**
30 | * Creates a parse-tree node representing an occurrence of this keyword
31 | * at a particular position in the parsed text.
32 | */
33 | public SqlLiteral symbol(SqlParserPos pos) {
34 | return SqlLiteral.createSymbol(this, pos);
35 | }
36 | }
37 |
38 | // End SqlSelectKeyword.java
39 |
--------------------------------------------------------------------------------
/core/src/main/java/org/eigenbase/sql/SqlValuesOperator.java:
--------------------------------------------------------------------------------
1 | /*
2 | // Licensed to Julian Hyde under one or more contributor license
3 | // agreements. See the NOTICE file distributed with this work for
4 | // additional information regarding copyright ownership.
5 | //
6 | // Julian Hyde licenses this file to you under the Apache License,
7 | // Version 2.0 (the "License"); you may not use this file except in
8 | // compliance with the License. You may obtain a copy of the License at:
9 | //
10 | // http://www.apache.org/licenses/LICENSE-2.0
11 | //
12 | // Unless required by applicable law or agreed to in writing, software
13 | // distributed under the License is distributed on an "AS IS" BASIS,
14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | // See the License for the specific language governing permissions and
16 | // limitations under the License.
17 | */
18 | package org.eigenbase.sql;
19 |
20 | /**
21 | * The VALUES
operator.
22 | */
23 | public class SqlValuesOperator extends SqlSpecialOperator {
24 | //~ Constructors -----------------------------------------------------------
25 |
26 | public SqlValuesOperator() {
27 | super("VALUES", SqlKind.VALUES);
28 | }
29 |
30 | //~ Methods ----------------------------------------------------------------
31 |
32 | public void unparse(
33 | SqlWriter writer,
34 | SqlCall call,
35 | int leftPrec,
36 | int rightPrec) {
37 | final SqlWriter.Frame frame = writer.startList("VALUES", "");
38 | for (SqlNode operand : call.getOperandList()) {
39 | writer.sep(",");
40 | operand.unparse(writer, 0, 0);
41 | }
42 | writer.endList(frame);
43 | }
44 | }
45 |
46 | // End SqlValuesOperator.java
47 |
--------------------------------------------------------------------------------
/core/src/main/java/org/eigenbase/sql/advise/package-info.java:
--------------------------------------------------------------------------------
1 | /*
2 | // Licensed to Julian Hyde under one or more contributor license
3 | // agreements. See the NOTICE file distributed with this work for
4 | // additional information regarding copyright ownership.
5 | //
6 | // Julian Hyde licenses this file to you under the Apache License,
7 | // Version 2.0 (the "License"); you may not use this file except in
8 | // compliance with the License. You may obtain a copy of the License at:
9 | //
10 | // http://www.apache.org/licenses/LICENSE-2.0
11 | //
12 | // Unless required by applicable law or agreed to in writing, software
13 | // distributed under the License is distributed on an "AS IS" BASIS,
14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | // See the License for the specific language governing permissions and
16 | // limitations under the License.
17 | */
18 |
19 | /**
20 | * Provides hints and corrections for editing SQL statements.
21 | *
22 | * The SQL statement might be partially-formed SQL statement or
23 | * invalid. It is edited in a SQL editor user-interface.
24 | *
25 | * The advisor uses the validation and parser framework set up in
26 | * org.eigenbase.sql.validate
package.
27 | */
28 | package org.eigenbase.sql.advise;
29 |
30 | // End package-info.java
31 |
--------------------------------------------------------------------------------
/core/src/main/java/org/eigenbase/sql/fun/SqlArrayQueryConstructor.java:
--------------------------------------------------------------------------------
1 | /*
2 | // Licensed to Julian Hyde under one or more contributor license
3 | // agreements. See the NOTICE file distributed with this work for
4 | // additional information regarding copyright ownership.
5 | //
6 | // Julian Hyde licenses this file to you under the Apache License,
7 | // Version 2.0 (the "License"); you may not use this file except in
8 | // compliance with the License. You may obtain a copy of the License at:
9 | //
10 | // http://www.apache.org/licenses/LICENSE-2.0
11 | //
12 | // Unless required by applicable law or agreed to in writing, software
13 | // distributed under the License is distributed on an "AS IS" BASIS,
14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | // See the License for the specific language governing permissions and
16 | // limitations under the License.
17 | */
18 | package org.eigenbase.sql.fun;
19 |
20 | import org.eigenbase.sql.*;
21 | import org.eigenbase.sql.validate.*;
22 |
23 | /**
24 | * Definition of the SQL:2003 standard ARRAY query constructor,
25 | * ARRAY (<query>)
.
26 | */
27 | public class SqlArrayQueryConstructor extends SqlMultisetQueryConstructor {
28 | //~ Constructors -----------------------------------------------------------
29 |
30 | public SqlArrayQueryConstructor() {
31 | super("ARRAY", SqlKind.MAP_QUERY_CONSTRUCTOR);
32 | }
33 | }
34 |
35 | // End SqlArrayQueryConstructor.java
36 |
--------------------------------------------------------------------------------
/core/src/main/java/org/eigenbase/sql/fun/SqlMapQueryConstructor.java:
--------------------------------------------------------------------------------
1 | /*
2 | // Licensed to Julian Hyde under one or more contributor license
3 | // agreements. See the NOTICE file distributed with this work for
4 | // additional information regarding copyright ownership.
5 | //
6 | // Julian Hyde licenses this file to you under the Apache License,
7 | // Version 2.0 (the "License"); you may not use this file except in
8 | // compliance with the License. You may obtain a copy of the License at:
9 | //
10 | // http://www.apache.org/licenses/LICENSE-2.0
11 | //
12 | // Unless required by applicable law or agreed to in writing, software
13 | // distributed under the License is distributed on an "AS IS" BASIS,
14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | // See the License for the specific language governing permissions and
16 | // limitations under the License.
17 | */
18 | package org.eigenbase.sql.fun;
19 |
20 | import org.eigenbase.sql.SqlKind;
21 |
22 | /**
23 | * Definition of the MAP query constructor,
24 | * MAP (<query>)
.
25 | *
26 | *
Like the MAP type, not standard SQL.
27 | */
28 | public class SqlMapQueryConstructor extends SqlMultisetQueryConstructor {
29 | //~ Constructors -----------------------------------------------------------
30 |
31 | public SqlMapQueryConstructor() {
32 | super("MAP", SqlKind.MAP_QUERY_CONSTRUCTOR);
33 | }
34 | }
35 |
36 | // End SqlMapQueryConstructor.java
37 |
--------------------------------------------------------------------------------
/core/src/main/java/org/eigenbase/sql/fun/package-info.java:
--------------------------------------------------------------------------------
1 | /*
2 | // Licensed to Julian Hyde under one or more contributor license
3 | // agreements. See the NOTICE file distributed with this work for
4 | // additional information regarding copyright ownership.
5 | //
6 | // Julian Hyde licenses this file to you under the Apache License,
7 | // Version 2.0 (the "License"); you may not use this file except in
8 | // compliance with the License. You may obtain a copy of the License at:
9 | //
10 | // http://www.apache.org/licenses/LICENSE-2.0
11 | //
12 | // Unless required by applicable law or agreed to in writing, software
13 | // distributed under the License is distributed on an "AS IS" BASIS,
14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | // See the License for the specific language governing permissions and
16 | // limitations under the License.
17 | */
18 |
19 | /**
20 | * Defines the set of standard SQL row-level functions and
21 | * operators.
22 | *
23 | * The standard set of row-level functions and operators are declared in
24 | * class {@link org.eigenbase.sql.fun.SqlStdOperatorTable}. Anonymous inner
25 | * classes within that table are allowed only for specifying an operator's test
26 | * function; if other custom code is needed for an operator, it should be
27 | * implemented in a top-level class within this package instead. Operators
28 | * which are not row-level (e.g. select and join) should be defined in package
29 | * {@link org.eigenbase.sql} instead.
30 | */
31 | package org.eigenbase.sql.fun;
32 |
33 | // End package-info.java
34 |
--------------------------------------------------------------------------------
/core/src/main/java/org/eigenbase/sql/parser/SqlParserImplFactory.java:
--------------------------------------------------------------------------------
1 | /*
2 | // Licensed to Julian Hyde under one or more contributor license
3 | // agreements. See the NOTICE file distributed with this work for
4 | // additional information regarding copyright ownership.
5 | //
6 | // Julian Hyde licenses this file to you under the Apache License,
7 | // Version 2.0 (the "License"); you may not use this file except in
8 | // compliance with the License. You may obtain a copy of the License at:
9 | //
10 | // http://www.apache.org/licenses/LICENSE-2.0
11 | //
12 | // Unless required by applicable law or agreed to in writing, software
13 | // distributed under the License is distributed on an "AS IS" BASIS,
14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | // See the License for the specific language governing permissions and
16 | // limitations under the License.
17 | */
18 | package org.eigenbase.sql.parser;
19 |
20 | import java.io.Reader;
21 |
22 | /**
23 | * Factory for {@link org.eigenbase.sql.parser.SqlAbstractParserImpl} objects.
24 | *
25 | * A parser factory allows you to include a custom parser in
26 | * {@link net.hydromatic.optiq.tools.Planner} created through
27 | * {@link net.hydromatic.optiq.tools.Frameworks}.
28 | */
29 | public interface SqlParserImplFactory {
30 |
31 | /**
32 | * Get the underlying parser implementation.
33 | *
34 | * @return {@link SqlAbstractParserImpl} object.
35 | */
36 | SqlAbstractParserImpl getParser(Reader stream);
37 | }
38 |
--------------------------------------------------------------------------------
/core/src/main/java/org/eigenbase/sql/parser/impl/package-info.java:
--------------------------------------------------------------------------------
1 | /*
2 | // Licensed to Julian Hyde under one or more contributor license
3 | // agreements. See the NOTICE file distributed with this work for
4 | // additional information regarding copyright ownership.
5 | //
6 | // Julian Hyde licenses this file to you under the Apache License,
7 | // Version 2.0 (the "License"); you may not use this file except in
8 | // compliance with the License. You may obtain a copy of the License at:
9 | //
10 | // http://www.apache.org/licenses/LICENSE-2.0
11 | //
12 | // Unless required by applicable law or agreed to in writing, software
13 | // distributed under the License is distributed on an "AS IS" BASIS,
14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | // See the License for the specific language governing permissions and
16 | // limitations under the License.
17 | */
18 |
19 | /**
20 | * Contains generated code for the
21 | * {@link org.eigenbase.sql.parser Eigenbase SQL parser}.
22 | */
23 | package org.eigenbase.sql.parser.impl;
24 |
25 | // End package-info.java
26 |
--------------------------------------------------------------------------------
/core/src/main/java/org/eigenbase/sql/parser/package-info.java:
--------------------------------------------------------------------------------
1 | /*
2 | // Licensed to Julian Hyde under one or more contributor license
3 | // agreements. See the NOTICE file distributed with this work for
4 | // additional information regarding copyright ownership.
5 | //
6 | // Julian Hyde licenses this file to you under the Apache License,
7 | // Version 2.0 (the "License"); you may not use this file except in
8 | // compliance with the License. You may obtain a copy of the License at:
9 | //
10 | // http://www.apache.org/licenses/LICENSE-2.0
11 | //
12 | // Unless required by applicable law or agreed to in writing, software
13 | // distributed under the License is distributed on an "AS IS" BASIS,
14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | // See the License for the specific language governing permissions and
16 | // limitations under the License.
17 | */
18 |
19 | /**
20 | * Provides a SQL parser.
21 | */
22 | package org.eigenbase.sql.parser;
23 |
24 | // End package-info.java
25 |
--------------------------------------------------------------------------------
/core/src/main/java/org/eigenbase/sql/pretty/package-info.java:
--------------------------------------------------------------------------------
1 | /*
2 | // Licensed to Julian Hyde under one or more contributor license
3 | // agreements. See the NOTICE file distributed with this work for
4 | // additional information regarding copyright ownership.
5 | //
6 | // Julian Hyde licenses this file to you under the Apache License,
7 | // Version 2.0 (the "License"); you may not use this file except in
8 | // compliance with the License. You may obtain a copy of the License at:
9 | //
10 | // http://www.apache.org/licenses/LICENSE-2.0
11 | //
12 | // Unless required by applicable law or agreed to in writing, software
13 | // distributed under the License is distributed on an "AS IS" BASIS,
14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | // See the License for the specific language governing permissions and
16 | // limitations under the License.
17 | */
18 |
19 | /**
20 | * Provides a pretty-printer for SQL statements.
21 | */
22 | package org.eigenbase.sql.pretty;
23 |
24 | // End package-info.java
25 |
--------------------------------------------------------------------------------
/core/src/main/java/org/eigenbase/sql/type/OperandsTypeChecking.java:
--------------------------------------------------------------------------------
1 | /*
2 | // Licensed to Julian Hyde under one or more contributor license
3 | // agreements. See the NOTICE file distributed with this work for
4 | // additional information regarding copyright ownership.
5 | //
6 | // Julian Hyde licenses this file to you under the Apache License,
7 | // Version 2.0 (the "License"); you may not use this file except in
8 | // compliance with the License. You may obtain a copy of the License at:
9 | //
10 | // http://www.apache.org/licenses/LICENSE-2.0
11 | //
12 | // Unless required by applicable law or agreed to in writing, software
13 | // distributed under the License is distributed on an "AS IS" BASIS,
14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | // See the License for the specific language governing permissions and
16 | // limitations under the License.
17 | */
18 | package org.eigenbase.sql.type;
19 |
20 | import org.eigenbase.reltype.*;
21 | import org.eigenbase.sql.*;
22 |
23 | /**
24 | * Strategies to check for allowed operand types of an operator call.
25 | */
26 | public abstract class OperandsTypeChecking {
27 | }
28 |
29 | // End OperandsTypeChecking.java
30 |
--------------------------------------------------------------------------------
/core/src/main/java/org/eigenbase/sql/type/SqlOperandTypeInference.java:
--------------------------------------------------------------------------------
1 | /*
2 | // Licensed to Julian Hyde under one or more contributor license
3 | // agreements. See the NOTICE file distributed with this work for
4 | // additional information regarding copyright ownership.
5 | //
6 | // Julian Hyde licenses this file to you under the Apache License,
7 | // Version 2.0 (the "License"); you may not use this file except in
8 | // compliance with the License. You may obtain a copy of the License at:
9 | //
10 | // http://www.apache.org/licenses/LICENSE-2.0
11 | //
12 | // Unless required by applicable law or agreed to in writing, software
13 | // distributed under the License is distributed on an "AS IS" BASIS,
14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | // See the License for the specific language governing permissions and
16 | // limitations under the License.
17 | */
18 | package org.eigenbase.sql.type;
19 |
20 | import org.eigenbase.reltype.*;
21 | import org.eigenbase.sql.*;
22 |
23 | /**
24 | * Strategy to infer unknown types of the operands of an operator call.
25 | */
26 | public interface SqlOperandTypeInference {
27 | //~ Methods ----------------------------------------------------------------
28 |
29 | /**
30 | * Infers any unknown operand types.
31 | *
32 | * @param callBinding description of the call being analyzed
33 | * @param returnType the type known or inferred for the result of the call
34 | * @param operandTypes receives the inferred types for all operands
35 | */
36 | void inferOperandTypes(
37 | SqlCallBinding callBinding,
38 | RelDataType returnType,
39 | RelDataType[] operandTypes);
40 | }
41 |
42 | // End SqlOperandTypeInference.java
43 |
--------------------------------------------------------------------------------
/core/src/main/java/org/eigenbase/sql/type/package-info.java:
--------------------------------------------------------------------------------
1 | /*
2 | // Licensed to Julian Hyde under one or more contributor license
3 | // agreements. See the NOTICE file distributed with this work for
4 | // additional information regarding copyright ownership.
5 | //
6 | // Julian Hyde licenses this file to you under the Apache License,
7 | // Version 2.0 (the "License"); you may not use this file except in
8 | // compliance with the License. You may obtain a copy of the License at:
9 | //
10 | // http://www.apache.org/licenses/LICENSE-2.0
11 | //
12 | // Unless required by applicable law or agreed to in writing, software
13 | // distributed under the License is distributed on an "AS IS" BASIS,
14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | // See the License for the specific language governing permissions and
16 | // limitations under the License.
17 | */
18 |
19 | /**
20 | * SQL type system.
21 | */
22 | package org.eigenbase.sql.type;
23 |
24 | // End package-info.java
25 |
--------------------------------------------------------------------------------
/core/src/main/java/org/eigenbase/sql/util/package-info.java:
--------------------------------------------------------------------------------
1 | /*
2 | // Licensed to Julian Hyde under one or more contributor license
3 | // agreements. See the NOTICE file distributed with this work for
4 | // additional information regarding copyright ownership.
5 | //
6 | // Julian Hyde licenses this file to you under the Apache License,
7 | // Version 2.0 (the "License"); you may not use this file except in
8 | // compliance with the License. You may obtain a copy of the License at:
9 | //
10 | // http://www.apache.org/licenses/LICENSE-2.0
11 | //
12 | // Unless required by applicable law or agreed to in writing, software
13 | // distributed under the License is distributed on an "AS IS" BASIS,
14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | // See the License for the specific language governing permissions and
16 | // limitations under the License.
17 | */
18 |
19 | /**
20 | * Utility classes for the SQL object model, parsing, and validation.
21 | */
22 | package org.eigenbase.sql.util;
23 |
24 | // End package-info.java
25 |
--------------------------------------------------------------------------------
/core/src/main/java/org/eigenbase/sql/validate/SqlMoniker.java:
--------------------------------------------------------------------------------
1 | /*
2 | // Licensed to Julian Hyde under one or more contributor license
3 | // agreements. See the NOTICE file distributed with this work for
4 | // additional information regarding copyright ownership.
5 | //
6 | // Julian Hyde licenses this file to you under the Apache License,
7 | // Version 2.0 (the "License"); you may not use this file except in
8 | // compliance with the License. You may obtain a copy of the License at:
9 | //
10 | // http://www.apache.org/licenses/LICENSE-2.0
11 | //
12 | // Unless required by applicable law or agreed to in writing, software
13 | // distributed under the License is distributed on an "AS IS" BASIS,
14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | // See the License for the specific language governing permissions and
16 | // limitations under the License.
17 | */
18 | package org.eigenbase.sql.validate;
19 |
20 | import java.util.List;
21 |
22 | import org.eigenbase.sql.*;
23 |
24 | /**
25 | * An interface of an object identifier that represents a SqlIdentifier
26 | */
27 | public interface SqlMoniker {
28 | //~ Methods ----------------------------------------------------------------
29 |
30 | /**
31 | * Returns the type of object referred to by this moniker. Never null.
32 | */
33 | SqlMonikerType getType();
34 |
35 | /**
36 | * Returns the array of component names.
37 | */
38 | List getFullyQualifiedNames();
39 |
40 | /**
41 | * Creates a {@link SqlIdentifier} containing the fully-qualified name.
42 | */
43 | SqlIdentifier toIdentifier();
44 |
45 | String id();
46 | }
47 |
48 | // End SqlMoniker.java
49 |
--------------------------------------------------------------------------------
/core/src/main/java/org/eigenbase/sql/validate/SqlMonikerComparator.java:
--------------------------------------------------------------------------------
1 | /*
2 | // Licensed to Julian Hyde under one or more contributor license
3 | // agreements. See the NOTICE file distributed with this work for
4 | // additional information regarding copyright ownership.
5 | //
6 | // Julian Hyde licenses this file to you under the Apache License,
7 | // Version 2.0 (the "License"); you may not use this file except in
8 | // compliance with the License. You may obtain a copy of the License at:
9 | //
10 | // http://www.apache.org/licenses/LICENSE-2.0
11 | //
12 | // Unless required by applicable law or agreed to in writing, software
13 | // distributed under the License is distributed on an "AS IS" BASIS,
14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | // See the License for the specific language governing permissions and
16 | // limitations under the License.
17 | */
18 | package org.eigenbase.sql.validate;
19 |
20 | import java.util.*;
21 |
22 | /**
23 | * A general-purpose implementation of {@link Comparator} to compare {@link
24 | * SqlMoniker} values.
25 | */
26 | public class SqlMonikerComparator implements Comparator {
27 | //~ Methods ----------------------------------------------------------------
28 |
29 | public int compare(SqlMoniker m1, SqlMoniker m2) {
30 | if (m1.getType().ordinal() > m2.getType().ordinal()) {
31 | return 1;
32 | } else if (m1.getType().ordinal() < m2.getType().ordinal()) {
33 | return -1;
34 | } else {
35 | return m1.toString().compareTo(m2.toString());
36 | }
37 | }
38 | }
39 |
40 | // End SqlMonikerComparator.java
41 |
--------------------------------------------------------------------------------
/core/src/main/java/org/eigenbase/sql/validate/SqlMonikerType.java:
--------------------------------------------------------------------------------
1 | /*
2 | // Licensed to Julian Hyde under one or more contributor license
3 | // agreements. See the NOTICE file distributed with this work for
4 | // additional information regarding copyright ownership.
5 | //
6 | // Julian Hyde licenses this file to you under the Apache License,
7 | // Version 2.0 (the "License"); you may not use this file except in
8 | // compliance with the License. You may obtain a copy of the License at:
9 | //
10 | // http://www.apache.org/licenses/LICENSE-2.0
11 | //
12 | // Unless required by applicable law or agreed to in writing, software
13 | // distributed under the License is distributed on an "AS IS" BASIS,
14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | // See the License for the specific language governing permissions and
16 | // limitations under the License.
17 | */
18 | package org.eigenbase.sql.validate;
19 |
20 | /**
21 | * An enumeration of moniker types.
22 | *
23 | * Used in {@link SqlMoniker}.
24 | */
25 | public enum SqlMonikerType {
26 | COLUMN, TABLE, VIEW, SCHEMA, REPOSITORY, FUNCTION, KEYWORD
27 | }
28 |
29 | // End SqlMonikerType.java
30 |
--------------------------------------------------------------------------------
/core/src/main/java/org/eigenbase/sql/validate/SqlValidatorTable.java:
--------------------------------------------------------------------------------
1 | /*
2 | // Licensed to Julian Hyde under one or more contributor license
3 | // agreements. See the NOTICE file distributed with this work for
4 | // additional information regarding copyright ownership.
5 | //
6 | // Julian Hyde licenses this file to you under the Apache License,
7 | // Version 2.0 (the "License"); you may not use this file except in
8 | // compliance with the License. You may obtain a copy of the License at:
9 | //
10 | // http://www.apache.org/licenses/LICENSE-2.0
11 | //
12 | // Unless required by applicable law or agreed to in writing, software
13 | // distributed under the License is distributed on an "AS IS" BASIS,
14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | // See the License for the specific language governing permissions and
16 | // limitations under the License.
17 | */
18 | package org.eigenbase.sql.validate;
19 |
20 | import java.util.List;
21 |
22 | import org.eigenbase.reltype.*;
23 | import org.eigenbase.sql.*;
24 |
25 | /**
26 | * Supplies a {@link SqlValidator} with the metadata for a table.
27 | *
28 | * @see SqlValidatorCatalogReader
29 | */
30 | public interface SqlValidatorTable {
31 | //~ Methods ----------------------------------------------------------------
32 |
33 | RelDataType getRowType();
34 |
35 | List getQualifiedName();
36 |
37 | /**
38 | * Returns whether a given column is monotonic.
39 | */
40 | SqlMonotonicity getMonotonicity(String columnName);
41 |
42 | /**
43 | * Returns the access type of the table
44 | */
45 | SqlAccessType getAllowedAccess();
46 | }
47 |
48 | // End SqlValidatorTable.java
49 |
--------------------------------------------------------------------------------
/core/src/main/java/org/eigenbase/sql/validate/package-info.java:
--------------------------------------------------------------------------------
1 | /*
2 | // Licensed to Julian Hyde under one or more contributor license
3 | // agreements. See the NOTICE file distributed with this work for
4 | // additional information regarding copyright ownership.
5 | //
6 | // Julian Hyde licenses this file to you under the Apache License,
7 | // Version 2.0 (the "License"); you may not use this file except in
8 | // compliance with the License. You may obtain a copy of the License at:
9 | //
10 | // http://www.apache.org/licenses/LICENSE-2.0
11 | //
12 | // Unless required by applicable law or agreed to in writing, software
13 | // distributed under the License is distributed on an "AS IS" BASIS,
14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | // See the License for the specific language governing permissions and
16 | // limitations under the License.
17 | */
18 |
19 | /**
20 | * SQL validation.
21 | */
22 | package org.eigenbase.sql.validate;
23 |
24 | // End package-info.java
25 |
--------------------------------------------------------------------------------
/core/src/main/java/org/eigenbase/sql2rel/SqlRexConvertlet.java:
--------------------------------------------------------------------------------
1 | /*
2 | // Licensed to Julian Hyde under one or more contributor license
3 | // agreements. See the NOTICE file distributed with this work for
4 | // additional information regarding copyright ownership.
5 | //
6 | // Julian Hyde licenses this file to you under the Apache License,
7 | // Version 2.0 (the "License"); you may not use this file except in
8 | // compliance with the License. You may obtain a copy of the License at:
9 | //
10 | // http://www.apache.org/licenses/LICENSE-2.0
11 | //
12 | // Unless required by applicable law or agreed to in writing, software
13 | // distributed under the License is distributed on an "AS IS" BASIS,
14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | // See the License for the specific language governing permissions and
16 | // limitations under the License.
17 | */
18 | package org.eigenbase.sql2rel;
19 |
20 | import org.eigenbase.rex.*;
21 | import org.eigenbase.sql.*;
22 |
23 | /**
24 | * Thunk which converts a {@link SqlNode} expression into a {@link RexNode}
25 | * expression.
26 | */
27 | public interface SqlRexConvertlet {
28 | //~ Methods ----------------------------------------------------------------
29 |
30 | RexNode convertCall(
31 | SqlRexContext cx,
32 | SqlCall call);
33 | }
34 |
35 | // End SqlRexConvertlet.java
36 |
--------------------------------------------------------------------------------
/core/src/main/java/org/eigenbase/sql2rel/SqlRexConvertletTable.java:
--------------------------------------------------------------------------------
1 | /*
2 | // Licensed to Julian Hyde under one or more contributor license
3 | // agreements. See the NOTICE file distributed with this work for
4 | // additional information regarding copyright ownership.
5 | //
6 | // Julian Hyde licenses this file to you under the Apache License,
7 | // Version 2.0 (the "License"); you may not use this file except in
8 | // compliance with the License. You may obtain a copy of the License at:
9 | //
10 | // http://www.apache.org/licenses/LICENSE-2.0
11 | //
12 | // Unless required by applicable law or agreed to in writing, software
13 | // distributed under the License is distributed on an "AS IS" BASIS,
14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | // See the License for the specific language governing permissions and
16 | // limitations under the License.
17 | */
18 | package org.eigenbase.sql2rel;
19 |
20 | import org.eigenbase.sql.*;
21 |
22 | /**
23 | * Collection of {@link SqlRexConvertlet}s.
24 | */
25 | public interface SqlRexConvertletTable {
26 | //~ Methods ----------------------------------------------------------------
27 |
28 | /**
29 | * Returns the convertlet applicable to a given expression.
30 | */
31 | SqlRexConvertlet get(SqlCall call);
32 | }
33 |
34 | // End SqlRexConvertletTable.java
35 |
--------------------------------------------------------------------------------
/core/src/main/java/org/eigenbase/sql2rel/package-info.java:
--------------------------------------------------------------------------------
1 | /*
2 | // Licensed to Julian Hyde under one or more contributor license
3 | // agreements. See the NOTICE file distributed with this work for
4 | // additional information regarding copyright ownership.
5 | //
6 | // Julian Hyde licenses this file to you under the Apache License,
7 | // Version 2.0 (the "License"); you may not use this file except in
8 | // compliance with the License. You may obtain a copy of the License at:
9 | //
10 | // http://www.apache.org/licenses/LICENSE-2.0
11 | //
12 | // Unless required by applicable law or agreed to in writing, software
13 | // distributed under the License is distributed on an "AS IS" BASIS,
14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | // See the License for the specific language governing permissions and
16 | // limitations under the License.
17 | */
18 |
19 | /**
20 | * Translates a SQL parse tree to relational expression.
21 | */
22 | package org.eigenbase.sql2rel;
23 |
24 | // End package-info.java
25 |
--------------------------------------------------------------------------------
/core/src/main/java/org/eigenbase/stat/package-info.java:
--------------------------------------------------------------------------------
1 | /*
2 | // Licensed to Julian Hyde under one or more contributor license
3 | // agreements. See the NOTICE file distributed with this work for
4 | // additional information regarding copyright ownership.
5 | //
6 | // Julian Hyde licenses this file to you under the Apache License,
7 | // Version 2.0 (the "License"); you may not use this file except in
8 | // compliance with the License. You may obtain a copy of the License at:
9 | //
10 | // http://www.apache.org/licenses/LICENSE-2.0
11 | //
12 | // Unless required by applicable law or agreed to in writing, software
13 | // distributed under the License is distributed on an "AS IS" BASIS,
14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | // See the License for the specific language governing permissions and
16 | // limitations under the License.
17 | */
18 |
19 | /**
20 | * Defines interfaces related to statistics about data sets produced by
21 | * relational expressions.
22 | */
23 | package org.eigenbase.stat;
24 |
25 | // End package-info.java
26 |
--------------------------------------------------------------------------------
/core/src/main/java/org/eigenbase/trace/package-info.java:
--------------------------------------------------------------------------------
1 | /*
2 | // Licensed to Julian Hyde under one or more contributor license
3 | // agreements. See the NOTICE file distributed with this work for
4 | // additional information regarding copyright ownership.
5 | //
6 | // Julian Hyde licenses this file to you under the Apache License,
7 | // Version 2.0 (the "License"); you may not use this file except in
8 | // compliance with the License. You may obtain a copy of the License at:
9 | //
10 | // http://www.apache.org/licenses/LICENSE-2.0
11 | //
12 | // Unless required by applicable law or agreed to in writing, software
13 | // distributed under the License is distributed on an "AS IS" BASIS,
14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | // See the License for the specific language governing permissions and
16 | // limitations under the License.
17 | */
18 |
19 | /**
20 | * Tracing services.
21 | */
22 | package org.eigenbase.trace;
23 |
24 | // End package-info.java
25 |
--------------------------------------------------------------------------------
/core/src/main/java/org/eigenbase/util/ClosableAllocation.java:
--------------------------------------------------------------------------------
1 | /*
2 | // Licensed to Julian Hyde under one or more contributor license
3 | // agreements. See the NOTICE file distributed with this work for
4 | // additional information regarding copyright ownership.
5 | //
6 | // Julian Hyde licenses this file to you under the Apache License,
7 | // Version 2.0 (the "License"); you may not use this file except in
8 | // compliance with the License. You may obtain a copy of the License at:
9 | //
10 | // http://www.apache.org/licenses/LICENSE-2.0
11 | //
12 | // Unless required by applicable law or agreed to in writing, software
13 | // distributed under the License is distributed on an "AS IS" BASIS,
14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | // See the License for the specific language governing permissions and
16 | // limitations under the License.
17 | */
18 | package org.eigenbase.util;
19 |
20 | /**
21 | * ClosableAllocation represents an object which requires a call in order to
22 | * release resources early rather than waiting for finalization.
23 | */
24 | public interface ClosableAllocation {
25 | //~ Methods ----------------------------------------------------------------
26 |
27 | /**
28 | * Closes this object.
29 | */
30 | void closeAllocation();
31 | }
32 |
33 | // End ClosableAllocation.java
34 |
--------------------------------------------------------------------------------
/core/src/main/java/org/eigenbase/util/ClosableAllocationOwner.java:
--------------------------------------------------------------------------------
1 | /*
2 | // Licensed to Julian Hyde under one or more contributor license
3 | // agreements. See the NOTICE file distributed with this work for
4 | // additional information regarding copyright ownership.
5 | //
6 | // Julian Hyde licenses this file to you under the Apache License,
7 | // Version 2.0 (the "License"); you may not use this file except in
8 | // compliance with the License. You may obtain a copy of the License at:
9 | //
10 | // http://www.apache.org/licenses/LICENSE-2.0
11 | //
12 | // Unless required by applicable law or agreed to in writing, software
13 | // distributed under the License is distributed on an "AS IS" BASIS,
14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | // See the License for the specific language governing permissions and
16 | // limitations under the License.
17 | */
18 | package org.eigenbase.util;
19 |
20 | /**
21 | * ClosableAllocationOwner represents an object which can take ownership of
22 | * ClosableAllocations and guarantee that they will be cleaned up correctly when
23 | * its own closeAllocation() is called.
24 | */
25 | public interface ClosableAllocationOwner extends ClosableAllocation {
26 | //~ Methods ----------------------------------------------------------------
27 |
28 | /**
29 | * Assigns ownership of a ClosableAllocation to this owner.
30 | *
31 | * @param allocation the ClosableAllocation to take over
32 | */
33 | void addAllocation(ClosableAllocation allocation);
34 | }
35 |
36 | // End ClosableAllocationOwner.java
37 |
--------------------------------------------------------------------------------
/core/src/main/java/org/eigenbase/util/ControlFlowException.java:
--------------------------------------------------------------------------------
1 | /*
2 | // Licensed to Julian Hyde under one or more contributor license
3 | // agreements. See the NOTICE file distributed with this work for
4 | // additional information regarding copyright ownership.
5 | //
6 | // Julian Hyde licenses this file to you under the Apache License,
7 | // Version 2.0 (the "License"); you may not use this file except in
8 | // compliance with the License. You may obtain a copy of the License at:
9 | //
10 | // http://www.apache.org/licenses/LICENSE-2.0
11 | //
12 | // Unless required by applicable law or agreed to in writing, software
13 | // distributed under the License is distributed on an "AS IS" BASIS,
14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | // See the License for the specific language governing permissions and
16 | // limitations under the License.
17 | */
18 | package org.eigenbase.util;
19 |
20 | /**
21 | * Exception intended to be used for control flow, as opposed to the usual
22 | * use of exceptions which is to signal an error condition.
23 | *
24 | * {@code ControlFlowException} does not populate its own stack trace, which
25 | * makes instantiating one of these (or a sub-class) more efficient.
26 | */
27 | public class ControlFlowException extends RuntimeException {
28 | @Override public Throwable fillInStackTrace() {
29 | return this;
30 | }
31 | }
32 |
33 | // End ControlFlowException.java
34 |
--------------------------------------------------------------------------------
/core/src/main/java/org/eigenbase/util/ReflectiveVisitor.java:
--------------------------------------------------------------------------------
1 | /*
2 | // Licensed to Julian Hyde under one or more contributor license
3 | // agreements. See the NOTICE file distributed with this work for
4 | // additional information regarding copyright ownership.
5 | //
6 | // Julian Hyde licenses this file to you under the Apache License,
7 | // Version 2.0 (the "License"); you may not use this file except in
8 | // compliance with the License. You may obtain a copy of the License at:
9 | //
10 | // http://www.apache.org/licenses/LICENSE-2.0
11 | //
12 | // Unless required by applicable law or agreed to in writing, software
13 | // distributed under the License is distributed on an "AS IS" BASIS,
14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | // See the License for the specific language governing permissions and
16 | // limitations under the License.
17 | */
18 | package org.eigenbase.util;
19 |
20 | /**
21 | * Object which can be a target for a reflective visitation (see {@link
22 | * ReflectUtil#invokeVisitor(ReflectiveVisitor, Object, Class, String)}.
23 | *
24 | * This is a tagging interface: it has no methods, and is not even required
25 | * in order to use reflective visitation, but serves to advise users of the
26 | * class of the intended use of the class and refer them to auxilliary classes.
27 | */
28 | public interface ReflectiveVisitor {
29 | }
30 |
31 | // End ReflectiveVisitor.java
32 |
--------------------------------------------------------------------------------
/core/src/main/java/org/eigenbase/util/Static.java:
--------------------------------------------------------------------------------
1 | /*
2 | // Licensed to Julian Hyde under one or more contributor license
3 | // agreements. See the NOTICE file distributed with this work for
4 | // additional information regarding copyright ownership.
5 | //
6 | // Julian Hyde licenses this file to you under the Apache License,
7 | // Version 2.0 (the "License"); you may not use this file except in
8 | // compliance with the License. You may obtain a copy of the License at:
9 | //
10 | // http://www.apache.org/licenses/LICENSE-2.0
11 | //
12 | // Unless required by applicable law or agreed to in writing, software
13 | // distributed under the License is distributed on an "AS IS" BASIS,
14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | // See the License for the specific language governing permissions and
16 | // limitations under the License.
17 | */
18 | package org.eigenbase.util;
19 |
20 | import org.eigenbase.resource.EigenbaseNewResource;
21 | import org.eigenbase.resource.Resources;
22 |
23 | /**
24 | * Definitions of objects to be statically imported.
25 | *
26 | *
Developers: Give careful consideration before including an object in this
27 | * class.
28 | * Pros: Code that uses these objects will be terser.
29 | * Cons: Namespace pollution,
30 | * code that is difficult to understand (a general problem with static imports),
31 | * potential cyclic initialization.
32 | */
33 | public abstract class Static {
34 | private Static() {}
35 |
36 | /** Resources. */
37 | public static final EigenbaseNewResource RESOURCE =
38 | Resources.create("org.eigenbase.resource.EigenbaseResource",
39 | EigenbaseNewResource.class);
40 | }
41 |
42 | // End Static.java
43 |
--------------------------------------------------------------------------------
/core/src/main/java/org/eigenbase/util/mapping/package-info.java:
--------------------------------------------------------------------------------
1 | /*
2 | // Licensed to Julian Hyde under one or more contributor license
3 | // agreements. See the NOTICE file distributed with this work for
4 | // additional information regarding copyright ownership.
5 | //
6 | // Julian Hyde licenses this file to you under the Apache License,
7 | // Version 2.0 (the "License"); you may not use this file except in
8 | // compliance with the License. You may obtain a copy of the License at:
9 | //
10 | // http://www.apache.org/licenses/LICENSE-2.0
11 | //
12 | // Unless required by applicable law or agreed to in writing, software
13 | // distributed under the License is distributed on an "AS IS" BASIS,
14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | // See the License for the specific language governing permissions and
16 | // limitations under the License.
17 | */
18 |
19 | /**
20 | * Support for algebraic maps.
21 | */
22 | package org.eigenbase.util.mapping;
23 |
24 | // End package-info.java
25 |
--------------------------------------------------------------------------------
/core/src/main/java/org/eigenbase/util/package-info.java:
--------------------------------------------------------------------------------
1 | /*
2 | // Licensed to Julian Hyde under one or more contributor license
3 | // agreements. See the NOTICE file distributed with this work for
4 | // additional information regarding copyright ownership.
5 | //
6 | // Julian Hyde licenses this file to you under the Apache License,
7 | // Version 2.0 (the "License"); you may not use this file except in
8 | // compliance with the License. You may obtain a copy of the License at:
9 | //
10 | // http://www.apache.org/licenses/LICENSE-2.0
11 | //
12 | // Unless required by applicable law or agreed to in writing, software
13 | // distributed under the License is distributed on an "AS IS" BASIS,
14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | // See the License for the specific language governing permissions and
16 | // limitations under the License.
17 | */
18 | /**
19 | * Provides utility classes.
20 | */
21 | package org.eigenbase.util;
22 |
23 |
24 | // End package-info.java
25 |
--------------------------------------------------------------------------------
/core/src/main/java/org/eigenbase/util14/EigenbaseParserException.java:
--------------------------------------------------------------------------------
1 | /*
2 | // Licensed to Julian Hyde under one or more contributor license
3 | // agreements. See the NOTICE file distributed with this work for
4 | // additional information regarding copyright ownership.
5 | //
6 | // Julian Hyde licenses this file to you under the Apache License,
7 | // Version 2.0 (the "License"); you may not use this file except in
8 | // compliance with the License. You may obtain a copy of the License at:
9 | //
10 | // http://www.apache.org/licenses/LICENSE-2.0
11 | //
12 | // Unless required by applicable law or agreed to in writing, software
13 | // distributed under the License is distributed on an "AS IS" BASIS,
14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | // See the License for the specific language governing permissions and
16 | // limitations under the License.
17 | */
18 | package org.eigenbase.util14;
19 |
20 | /**
21 | * This is a tagging interface to allow a {@link
22 | * org.eigenbase.sql.parser.SqlParseException} to be identified without adding a
23 | * dependency on it from client-side code.
24 | */
25 | public interface EigenbaseParserException {
26 | }
27 |
28 | // End EigenbaseParserException.java
29 |
--------------------------------------------------------------------------------
/core/src/main/java/org/eigenbase/util14/EigenbaseValidatorException.java:
--------------------------------------------------------------------------------
1 | /*
2 | // Licensed to Julian Hyde under one or more contributor license
3 | // agreements. See the NOTICE file distributed with this work for
4 | // additional information regarding copyright ownership.
5 | //
6 | // Julian Hyde licenses this file to you under the Apache License,
7 | // Version 2.0 (the "License"); you may not use this file except in
8 | // compliance with the License. You may obtain a copy of the License at:
9 | //
10 | // http://www.apache.org/licenses/LICENSE-2.0
11 | //
12 | // Unless required by applicable law or agreed to in writing, software
13 | // distributed under the License is distributed on an "AS IS" BASIS,
14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | // See the License for the specific language governing permissions and
16 | // limitations under the License.
17 | */
18 | package org.eigenbase.util14;
19 |
20 | /**
21 | * This is a tagging interface to allow {@link
22 | * org.eigenbase.sql.validate.SqlValidatorException} to be identified without
23 | * adding a dependency on it from client-side code.
24 | */
25 | public interface EigenbaseValidatorException {
26 | }
27 |
28 | // End EigenbaseValidatorException.java
29 |
--------------------------------------------------------------------------------
/core/src/main/java/org/eigenbase/util14/package-info.java:
--------------------------------------------------------------------------------
1 | /*
2 | // Licensed to Julian Hyde under one or more contributor license
3 | // agreements. See the NOTICE file distributed with this work for
4 | // additional information regarding copyright ownership.
5 | //
6 | // Julian Hyde licenses this file to you under the Apache License,
7 | // Version 2.0 (the "License"); you may not use this file except in
8 | // compliance with the License. You may obtain a copy of the License at:
9 | //
10 | // http://www.apache.org/licenses/LICENSE-2.0
11 | //
12 | // Unless required by applicable law or agreed to in writing, software
13 | // distributed under the License is distributed on an "AS IS" BASIS,
14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | // See the License for the specific language governing permissions and
16 | // limitations under the License.
17 | */
18 |
19 | /**
20 | * Provides utility classes for use from code which must remain
21 | * source-compatible with JDK 1.4.
22 | */
23 | package org.eigenbase.util14;
24 |
25 | // End package-info.java
26 |
--------------------------------------------------------------------------------
/core/src/main/resources/META-INF/services/java.sql.Driver:
--------------------------------------------------------------------------------
1 | net.hydromatic.optiq.jdbc.Driver
--------------------------------------------------------------------------------
/core/src/main/resources/version/net-hydromatic-optiq-jdbc.properties:
--------------------------------------------------------------------------------
1 | driver.name=Optiq JDBC Driver
2 | driver.version=${pom.version}
3 | product.name=Optiq
4 | product.version=${pom.version}
5 | jdbc.compliant=true
6 | driver.version.major=${version.major}
7 | driver.version.minor=${version.minor}
8 | database.version.major=${version.major}
9 | database.version.minor=${version.minor}
10 | build.timestamp=${build.timestamp}
11 |
--------------------------------------------------------------------------------
/core/src/test/java/net/hydromatic/optiq/test/OptiqSqlOperatorTest.java:
--------------------------------------------------------------------------------
1 | /*
2 | // Licensed to Julian Hyde under one or more contributor license
3 | // agreements. See the NOTICE file distributed with this work for
4 | // additional information regarding copyright ownership.
5 | //
6 | // Julian Hyde licenses this file to you under the Apache License,
7 | // Version 2.0 (the "License"); you may not use this file except in
8 | // compliance with the License. You may obtain a copy of the License at:
9 | //
10 | // http://www.apache.org/licenses/LICENSE-2.0
11 | //
12 | // Unless required by applicable law or agreed to in writing, software
13 | // distributed under the License is distributed on an "AS IS" BASIS,
14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | // See the License for the specific language governing permissions and
16 | // limitations under the License.
17 | */
18 | package net.hydromatic.optiq.test;
19 |
20 | import net.hydromatic.optiq.jdbc.OptiqConnection;
21 |
22 | import org.eigenbase.sql.test.SqlOperatorBaseTest;
23 | import org.eigenbase.sql.test.SqlTester;
24 |
25 | /**
26 | * Embodiment of {@link org.eigenbase.sql.test.SqlOperatorBaseTest}
27 | * that generates SQL statements and executes them using Optiq.
28 | */
29 | public class OptiqSqlOperatorTest extends SqlOperatorBaseTest {
30 | private static SqlTester getHrTester() {
31 | try {
32 | OptiqConnection connection = OptiqAssert.getConnection("hr");
33 | return tester(connection);
34 | } catch (Exception e) {
35 | throw new RuntimeException(e);
36 | }
37 | }
38 |
39 | public OptiqSqlOperatorTest() {
40 | super(false, getHrTester());
41 | }
42 | }
43 |
44 | // End OptiqSqlOperatorTest.java
45 |
--------------------------------------------------------------------------------
/core/src/test/java/net/hydromatic/optiq/test/package-info.java:
--------------------------------------------------------------------------------
1 | /*
2 | // Licensed to Julian Hyde under one or more contributor license
3 | // agreements. See the NOTICE file distributed with this work for
4 | // additional information regarding copyright ownership.
5 | //
6 | // Julian Hyde licenses this file to you under the Apache License,
7 | // Version 2.0 (the "License"); you may not use this file except in
8 | // compliance with the License. You may obtain a copy of the License at:
9 | //
10 | // http://www.apache.org/licenses/LICENSE-2.0
11 | //
12 | // Unless required by applicable law or agreed to in writing, software
13 | // distributed under the License is distributed on an "AS IS" BASIS,
14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | // See the License for the specific language governing permissions and
16 | // limitations under the License.
17 | */
18 |
19 | /**
20 | * Tests for Optiq.
21 | */
22 | package net.hydromatic.optiq.test;
23 |
24 | // End package-info.java
25 |
--------------------------------------------------------------------------------
/core/src/test/java/org/eigenbase/sql/parser/SqlUnParserTest.java:
--------------------------------------------------------------------------------
1 | /*
2 | // Licensed to Julian Hyde under one or more contributor license
3 | // agreements. See the NOTICE file distributed with this work for
4 | // additional information regarding copyright ownership.
5 | //
6 | // Julian Hyde licenses this file to you under the Apache License,
7 | // Version 2.0 (the "License"); you may not use this file except in
8 | // compliance with the License. You may obtain a copy of the License at:
9 | //
10 | // http://www.apache.org/licenses/LICENSE-2.0
11 | //
12 | // Unless required by applicable law or agreed to in writing, software
13 | // distributed under the License is distributed on an "AS IS" BASIS,
14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | // See the License for the specific language governing permissions and
16 | // limitations under the License.
17 | */
18 | package org.eigenbase.sql.parser;
19 |
20 | /**
21 | * Extension to {@link SqlParserTest} which ensures that every expression can
22 | * un-parse successfully.
23 | */
24 | public class SqlUnParserTest extends SqlParserTest {
25 | //~ Constructors -----------------------------------------------------------
26 |
27 | public SqlUnParserTest() {
28 | }
29 |
30 | //~ Methods ----------------------------------------------------------------
31 |
32 | protected Tester getTester() {
33 | return new UnparsingTesterImpl();
34 | }
35 | }
36 |
37 | // End SqlUnParserTest.java
38 |
--------------------------------------------------------------------------------
/core/src/test/java/org/eigenbase/sql/test/SqlOperatorTest.java:
--------------------------------------------------------------------------------
1 | /*
2 | // Licensed to Julian Hyde under one or more contributor license
3 | // agreements. See the NOTICE file distributed with this work for
4 | // additional information regarding copyright ownership.
5 | //
6 | // Julian Hyde licenses this file to you under the Apache License,
7 | // Version 2.0 (the "License"); you may not use this file except in
8 | // compliance with the License. You may obtain a copy of the License at:
9 | //
10 | // http://www.apache.org/licenses/LICENSE-2.0
11 | //
12 | // Unless required by applicable law or agreed to in writing, software
13 | // distributed under the License is distributed on an "AS IS" BASIS,
14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | // See the License for the specific language governing permissions and
16 | // limitations under the License.
17 | */
18 | package org.eigenbase.sql.test;
19 |
20 | import org.eigenbase.sql.validate.*;
21 | import org.eigenbase.test.*;
22 |
23 | /**
24 | * Concrete subclass of {@link SqlOperatorBaseTest} which checks against
25 | * a {@link SqlValidator}. Tests that involve execution trivially succeed.
26 | */
27 | public class SqlOperatorTest extends SqlOperatorBaseTest {
28 | private static final SqlTester DEFAULT_TESTER =
29 | (SqlTester) new SqlValidatorTestCase().getTester();
30 |
31 | /**
32 | * Creates a SqlOperatorTest.
33 | */
34 | public SqlOperatorTest() {
35 | super(false, DEFAULT_TESTER);
36 | }
37 | }
38 |
39 | // End SqlOperatorTest.java
40 |
--------------------------------------------------------------------------------
/core/src/test/java/org/eigenbase/sql/test/SqlTestFactory.java:
--------------------------------------------------------------------------------
1 | /*
2 | // Licensed to Julian Hyde under one or more contributor license
3 | // agreements. See the NOTICE file distributed with this work for
4 | // additional information regarding copyright ownership.
5 | //
6 | // Julian Hyde licenses this file to you under the Apache License,
7 | // Version 2.0 (the "License"); you may not use this file except in
8 | // compliance with the License. You may obtain a copy of the License at:
9 | //
10 | // http://www.apache.org/licenses/LICENSE-2.0
11 | //
12 | // Unless required by applicable law or agreed to in writing, software
13 | // distributed under the License is distributed on an "AS IS" BASIS,
14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | // See the License for the specific language governing permissions and
16 | // limitations under the License.
17 | */
18 | package org.eigenbase.sql.test;
19 |
20 | import org.eigenbase.sql.SqlOperatorTable;
21 | import org.eigenbase.sql.advise.SqlAdvisor;
22 | import org.eigenbase.sql.parser.SqlParser;
23 | import org.eigenbase.sql.validate.SqlValidator;
24 | import org.eigenbase.sql.validate.SqlValidatorWithHints;
25 |
26 | /**
27 | * Creates the objects needed to run a SQL parsing or validation test.
28 | *
29 | * @see org.eigenbase.sql.test.SqlTester
30 | */
31 | public interface SqlTestFactory {
32 | SqlOperatorTable createOperatorTable();
33 | SqlParser createParser(SqlTestFactory factory, String sql);
34 | SqlValidator getValidator(SqlTestFactory factory);
35 | SqlAdvisor createAdvisor(SqlValidatorWithHints validator);
36 | Object get(String name);
37 | }
38 |
39 | // End SqlTestFactory.java
40 |
--------------------------------------------------------------------------------
/core/src/test/java/org/eigenbase/sql/test/package-info.java:
--------------------------------------------------------------------------------
1 | /*
2 | // Licensed to Julian Hyde under one or more contributor license
3 | // agreements. See the NOTICE file distributed with this work for
4 | // additional information regarding copyright ownership.
5 | //
6 | // Julian Hyde licenses this file to you under the Apache License,
7 | // Version 2.0 (the "License"); you may not use this file except in
8 | // compliance with the License. You may obtain a copy of the License at:
9 | //
10 | // http://www.apache.org/licenses/LICENSE-2.0
11 | //
12 | // Unless required by applicable law or agreed to in writing, software
13 | // distributed under the License is distributed on an "AS IS" BASIS,
14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | // See the License for the specific language governing permissions and
16 | // limitations under the License.
17 | */
18 |
19 | /**
20 | * Regression tests for the SQL model.
21 | */
22 | package org.eigenbase.sql.test;
23 |
24 | // End package-info.java
25 |
--------------------------------------------------------------------------------
/core/src/test/java/org/eigenbase/test/concurrent/mtsql:
--------------------------------------------------------------------------------
1 | #! /bin/bash
2 | # $Id$
3 | # Command-line tool to run an mtsql script.
4 | # Usage: mtlsql [-vg] -u URL -d DRIVER [-n USER] [-p PASSWORD] SCRIPT [SCRIPT]...
5 | # -u URL : sets the server connected to; argument is a jdbc URL. Required.
6 | # -d DRIVER : specifies the jdbc driver class. Required.
7 | # -v : print sql results to stdout
8 | # -g : print some trace messages to stderr
9 |
10 | # TODO: handle -g and -d here, not in java code.
11 |
12 | JFLAGS="-client -ea -esa -Djava.util.logging.config.file=$(dirname $0)/mtsql.loggers"
13 | java $JFLAGS -cp $CLASSPATH org.eigenbase.test.concurrent.ConcurrentTestCommandScript "$@"
14 | exit $?
15 |
--------------------------------------------------------------------------------
/core/src/test/java/org/eigenbase/test/concurrent/mtsql.loggers:
--------------------------------------------------------------------------------
1 | handlers=java.util.logging.ConsoleHandler
2 | .level=WARNING
3 |
4 |
--------------------------------------------------------------------------------
/core/src/test/java/org/eigenbase/test/concurrent/test.mtsql:
--------------------------------------------------------------------------------
1 | -- for manual testing of the tool 'mtsql'
2 | -- expects to connect to farrago
3 | -- $Id$
4 |
5 | @var N=7
6 | @var S=bagel bag
7 | @var HOSTNAME
8 | @var USER
9 | @var WHO=$USER@$HOSTNAME
10 | @var RecursiveVar=$N $S $HOSTNAME $WHO
11 |
12 | @setup
13 | create schema foo;
14 | create view foo.crossview as (
15 | select * from sales.depts x
16 | cross join sales.emps y
17 | cross join sales.emps z
18 | );
19 | @end
20 |
21 | @cleanup
22 | drop schema foo cascade;
23 | @end
24 |
25 | @thread reader
26 | @shell pwd
27 | @shell echo mtsql*
28 | @shell hostname; whoami
29 | @shell head -1 < package.html | cat | cat > foo; cat foo
30 | @echo $$N is $N and $$S is $S.
31 | @echo The $$HOSTNAME is $HOSTNAME.
32 | @echo The $$HOSTNAME is $HOSTNAME, ${HOSTNAME}, "$HOSTNAME", "${HOSTNAME}", '$HOSTNAME', '${HOSTNAME}'.
33 | @echo The $$HOSTNAME is "$HOSTNAME, ${HOSTNAME}".
34 | @echo $$WHO is $WHO
35 | @echo $$RecursiveVar is $RecursiveVar
36 |
37 | values (1,2,3);
38 | values (4, '$HOSTNAME', '$USER@$HOSTNAME');
39 | values ($N, '$S');
40 | select * from sales.depts;
41 | @sync
42 | @end
43 |
44 | @thread printer
45 | @prepare select * from foo.crossview;
46 | @sync
47 |
48 | @echo printing all
49 | @print all
50 | @fetch
51 |
52 | @echo printing none
53 | @print none
54 | @fetch
55 |
56 | @echo printing every 5th row
57 | @print count every 5
58 | @fetch
59 |
60 | @echo printing every ${N}th row
61 | @print count every $N
62 | @fetch
63 |
64 | @echo printing every other row
65 | @print count every 2
66 | @fetch
67 |
68 | @close
69 | @end
70 |
71 |
72 |
--------------------------------------------------------------------------------
/core/src/test/java/org/eigenbase/test/package-info.java:
--------------------------------------------------------------------------------
1 | /*
2 | // Licensed to Julian Hyde under one or more contributor license
3 | // agreements. See the NOTICE file distributed with this work for
4 | // additional information regarding copyright ownership.
5 | //
6 | // Julian Hyde licenses this file to you under the Apache License,
7 | // Version 2.0 (the "License"); you may not use this file except in
8 | // compliance with the License. You may obtain a copy of the License at:
9 | //
10 | // http://www.apache.org/licenses/LICENSE-2.0
11 | //
12 | // Unless required by applicable law or agreed to in writing, software
13 | // distributed under the License is distributed on an "AS IS" BASIS,
14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | // See the License for the specific language governing permissions and
16 | // limitations under the License.
17 | */
18 |
19 | /**
20 | * Eigenbase regression tests.
21 | */
22 | package org.eigenbase.test;
23 |
24 | // End package-info.java
25 |
--------------------------------------------------------------------------------
/mongodb/src/main/java/net/hydromatic/optiq/impl/mongodb/MongoSchemaFactory.java:
--------------------------------------------------------------------------------
1 | /*
2 | // Licensed to Julian Hyde under one or more contributor license
3 | // agreements. See the NOTICE file distributed with this work for
4 | // additional information regarding copyright ownership.
5 | //
6 | // Julian Hyde licenses this file to you under the Apache License,
7 | // Version 2.0 (the "License"); you may not use this file except in
8 | // compliance with the License. You may obtain a copy of the License at:
9 | //
10 | // http://www.apache.org/licenses/LICENSE-2.0
11 | //
12 | // Unless required by applicable law or agreed to in writing, software
13 | // distributed under the License is distributed on an "AS IS" BASIS,
14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | // See the License for the specific language governing permissions and
16 | // limitations under the License.
17 | */
18 | package net.hydromatic.optiq.impl.mongodb;
19 |
20 | import net.hydromatic.optiq.*;
21 |
22 | import java.util.Map;
23 |
24 | /**
25 | * Factory that creates a {@link MongoSchema}.
26 | *
27 | * Allows a custom schema to be included in a model.json file.
28 | */
29 | @SuppressWarnings("UnusedDeclaration")
30 | public class MongoSchemaFactory implements SchemaFactory {
31 | // public constructor, per factory contract
32 | public MongoSchemaFactory() {
33 | }
34 |
35 | public Schema create(SchemaPlus parentSchema, String name,
36 | Map operand) {
37 | Map map = (Map) operand;
38 | String host = (String) map.get("host");
39 | String database = (String) map.get("database");
40 | return new MongoSchema(host, database);
41 | }
42 | }
43 |
44 | // End MongoSchemaFactory.java
45 |
--------------------------------------------------------------------------------
/mongodb/src/main/java/net/hydromatic/optiq/impl/mongodb/package-info.java:
--------------------------------------------------------------------------------
1 | /*
2 | // Licensed to Julian Hyde under one or more contributor license
3 | // agreements. See the NOTICE file distributed with this work for
4 | // additional information regarding copyright ownership.
5 | //
6 | // Julian Hyde licenses this file to you under the Apache License,
7 | // Version 2.0 (the "License"); you may not use this file except in
8 | // compliance with the License. You may obtain a copy of the License at:
9 | //
10 | // http://www.apache.org/licenses/LICENSE-2.0
11 | //
12 | // Unless required by applicable law or agreed to in writing, software
13 | // distributed under the License is distributed on an "AS IS" BASIS,
14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | // See the License for the specific language governing permissions and
16 | // limitations under the License.
17 | */
18 |
19 | /**
20 | * Query provider based on a MongoDB database.
21 | */
22 | package net.hydromatic.optiq.impl.mongodb;
23 |
24 | // End package-info.java
25 |
--------------------------------------------------------------------------------
/mongodb/src/test/java/net/hydromatic/optiq/test/package-info.java:
--------------------------------------------------------------------------------
1 | /*
2 | // Licensed to Julian Hyde under one or more contributor license
3 | // agreements. See the NOTICE file distributed with this work for
4 | // additional information regarding copyright ownership.
5 | //
6 | // Julian Hyde licenses this file to you under the Apache License,
7 | // Version 2.0 (the "License"); you may not use this file except in
8 | // compliance with the License. You may obtain a copy of the License at:
9 | //
10 | // http://www.apache.org/licenses/LICENSE-2.0
11 | //
12 | // Unless required by applicable law or agreed to in writing, software
13 | // distributed under the License is distributed on an "AS IS" BASIS,
14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | // See the License for the specific language governing permissions and
16 | // limitations under the License.
17 | */
18 |
19 | /**
20 | * Provides utility classes.
21 | */
22 | package org.eigenbase.util;
23 |
24 | // End package-info.java
25 |
--------------------------------------------------------------------------------
/mongodb/src/test/resources/mongo-zips-model.json:
--------------------------------------------------------------------------------
1 | {
2 | version: '1.0',
3 | defaultSchema: 'mongo',
4 | schemas: [
5 | {
6 | type: 'custom',
7 | name: 'mongo_raw',
8 | factory: 'net.hydromatic.optiq.impl.mongodb.MongoSchemaFactory',
9 | operand: {
10 | host: 'localhost',
11 | database: 'test'
12 | }
13 | },
14 | {
15 | name: 'mongo',
16 | tables: [
17 | {
18 | name: 'ZIPS',
19 | type: 'view',
20 | sql: 'select cast(_MAP[\'city\'] AS varchar(20)) AS city,\n cast(_MAP[\'loc\'][0] AS float) AS longitude, cast(_MAP[\'loc\'][1] AS float) AS latitude, cast(_MAP[\'pop\'] AS integer) AS pop, cast(_MAP[\'state\'] AS varchar(2)) AS state, cast(_MAP[\'_id\'] AS varchar(5)) AS id from \"mongo_raw\".\"zips\"'
21 | }
22 | ]
23 | }
24 | ]
25 | }
26 |
--------------------------------------------------------------------------------
/plus/src/main/java/net/hydromatic/optiq/impl/tpcds/package-info.java:
--------------------------------------------------------------------------------
1 | /*
2 | // Licensed to Julian Hyde under one or more contributor license
3 | // agreements. See the NOTICE file distributed with this work for
4 | // additional information regarding copyright ownership.
5 | //
6 | // Julian Hyde licenses this file to you under the Apache License,
7 | // Version 2.0 (the "License"); you may not use this file except in
8 | // compliance with the License. You may obtain a copy of the License at:
9 | //
10 | // http://www.apache.org/licenses/LICENSE-2.0
11 | //
12 | // Unless required by applicable law or agreed to in writing, software
13 | // distributed under the License is distributed on an "AS IS" BASIS,
14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | // See the License for the specific language governing permissions and
16 | // limitations under the License.
17 | */
18 |
19 | /**
20 | * TPC-DS schema.
21 | */
22 | package net.hydromatic.optiq.impl.tpcds;
23 |
24 | // End package-info.java
25 |
--------------------------------------------------------------------------------
/plus/src/main/java/net/hydromatic/optiq/impl/tpch/package-info.java:
--------------------------------------------------------------------------------
1 | /*
2 | // Licensed to Julian Hyde under one or more contributor license
3 | // agreements. See the NOTICE file distributed with this work for
4 | // additional information regarding copyright ownership.
5 | //
6 | // Julian Hyde licenses this file to you under the Apache License,
7 | // Version 2.0 (the "License"); you may not use this file except in
8 | // compliance with the License. You may obtain a copy of the License at:
9 | //
10 | // http://www.apache.org/licenses/LICENSE-2.0
11 | //
12 | // Unless required by applicable law or agreed to in writing, software
13 | // distributed under the License is distributed on an "AS IS" BASIS,
14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | // See the License for the specific language governing permissions and
16 | // limitations under the License.
17 | */
18 |
19 | /**
20 | * TPC-H schema.
21 | */
22 | package net.hydromatic.optiq.impl.tpch;
23 |
24 | // End package-info.java
25 |
--------------------------------------------------------------------------------
/plus/src/test/java/net/hydromatic/optiq/test/PlusSuite.java:
--------------------------------------------------------------------------------
1 | /*
2 | // Licensed to Julian Hyde under one or more contributor license
3 | // agreements. See the NOTICE file distributed with this work for
4 | // additional information regarding copyright ownership.
5 | //
6 | // Julian Hyde licenses this file to you under the Apache License,
7 | // Version 2.0 (the "License"); you may not use this file except in
8 | // compliance with the License. You may obtain a copy of the License at:
9 | //
10 | // http://www.apache.org/licenses/LICENSE-2.0
11 | //
12 | // Unless required by applicable law or agreed to in writing, software
13 | // distributed under the License is distributed on an "AS IS" BASIS,
14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | // See the License for the specific language governing permissions and
16 | // limitations under the License.
17 | */
18 | package net.hydromatic.optiq.test;
19 |
20 | import net.hydromatic.optiq.impl.tpcds.TpcdsTest;
21 | import net.hydromatic.optiq.impl.tpch.TpchTest;
22 |
23 | import org.junit.runner.RunWith;
24 | import org.junit.runners.Suite;
25 |
26 | /**
27 | * Suite consisting of all tests in the optiq-plus
module.
28 | */
29 | @RunWith(Suite.class)
30 | @Suite.SuiteClasses({
31 | TpcdsTest.class,
32 | TpchTest.class
33 | })
34 | public class PlusSuite {
35 | }
36 |
37 | // End PlusSuite.java
38 |
--------------------------------------------------------------------------------
/spark/src/main/java/net/hydromatic/optiq/impl/spark/package-info.java:
--------------------------------------------------------------------------------
1 | /*
2 | // Licensed to Julian Hyde under one or more contributor license
3 | // agreements. See the NOTICE file distributed with this work for
4 | // additional information regarding copyright ownership.
5 | //
6 | // Julian Hyde licenses this file to you under the Apache License,
7 | // Version 2.0 (the "License"); you may not use this file except in
8 | // compliance with the License. You may obtain a copy of the License at:
9 | //
10 | // http://www.apache.org/licenses/LICENSE-2.0
11 | //
12 | // Unless required by applicable law or agreed to in writing, software
13 | // distributed under the License is distributed on an "AS IS" BASIS,
14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | // See the License for the specific language governing permissions and
16 | // limitations under the License.
17 | */
18 |
19 | /**
20 | * Adapter based on the Apache Spark data management system.
21 | */
22 | package net.hydromatic.optiq.impl.spark;
23 |
24 | // End package-info.java
25 |
--------------------------------------------------------------------------------
/spark/src/test/java/net/hydromatic/optiq/test/package-info.java:
--------------------------------------------------------------------------------
1 | /*
2 | // Licensed to Julian Hyde under one or more contributor license
3 | // agreements. See the NOTICE file distributed with this work for
4 | // additional information regarding copyright ownership.
5 | //
6 | // Julian Hyde licenses this file to you under the Apache License,
7 | // Version 2.0 (the "License"); you may not use this file except in
8 | // compliance with the License. You may obtain a copy of the License at:
9 | //
10 | // http://www.apache.org/licenses/LICENSE-2.0
11 | //
12 | // Unless required by applicable law or agreed to in writing, software
13 | // distributed under the License is distributed on an "AS IS" BASIS,
14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | // See the License for the specific language governing permissions and
16 | // limitations under the License.
17 | */
18 |
19 | /**
20 | * Unit tests for Optiq.
21 | */
22 | package net.hydromatic.optiq.test;
23 |
24 | // End package-info.java
25 |
--------------------------------------------------------------------------------
/splunk/src/main/java/net/hydromatic/optiq/impl/splunk/SplunkDriverVersion.java:
--------------------------------------------------------------------------------
1 | /*
2 | // Licensed to Julian Hyde under one or more contributor license
3 | // agreements. See the NOTICE file distributed with this work for
4 | // additional information regarding copyright ownership.
5 | //
6 | // Julian Hyde licenses this file to you under the Apache License,
7 | // Version 2.0 (the "License"); you may not use this file except in
8 | // compliance with the License. You may obtain a copy of the License at:
9 | //
10 | // http://www.apache.org/licenses/LICENSE-2.0
11 | //
12 | // Unless required by applicable law or agreed to in writing, software
13 | // distributed under the License is distributed on an "AS IS" BASIS,
14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | // See the License for the specific language governing permissions and
16 | // limitations under the License.
17 | */
18 | package net.hydromatic.optiq.impl.splunk;
19 |
20 | import net.hydromatic.avatica.DriverVersion;
21 |
22 | /**
23 | * Version information for Optiq JDBC Driver for Splunk.
24 | */
25 | class SplunkDriverVersion extends DriverVersion {
26 | /** Creates an OptiqDriverVersion. */
27 | SplunkDriverVersion() {
28 | super(
29 | "Optiq JDBC Driver for Splunk",
30 | "0.2",
31 | "Optiq-Splunk",
32 | "0.2",
33 | true,
34 | 0,
35 | 1,
36 | 0,
37 | 1);
38 | }
39 | }
40 |
41 | // End SplunkDriverVersion.java
42 |
--------------------------------------------------------------------------------
/splunk/src/main/java/net/hydromatic/optiq/impl/splunk/package-info.java:
--------------------------------------------------------------------------------
1 | /*
2 | // Licensed to Julian Hyde under one or more contributor license
3 | // agreements. See the NOTICE file distributed with this work for
4 | // additional information regarding copyright ownership.
5 | //
6 | // Julian Hyde licenses this file to you under the Apache License,
7 | // Version 2.0 (the "License"); you may not use this file except in
8 | // compliance with the License. You may obtain a copy of the License at:
9 | //
10 | // http://www.apache.org/licenses/LICENSE-2.0
11 | //
12 | // Unless required by applicable law or agreed to in writing, software
13 | // distributed under the License is distributed on an "AS IS" BASIS,
14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | // See the License for the specific language governing permissions and
16 | // limitations under the License.
17 | */
18 |
19 | /**
20 | * Splunk query provider.
21 | *
22 | * There is a single table, called "Splunk". It has fixed columns
23 | * "host", "index", "source", "sourcetype". It has a variable type, so other
24 | * fields are held in a map field called "_others".
25 | */
26 | package net.hydromatic.optiq.impl.splunk;
27 |
28 | // End package-info.java
29 |
--------------------------------------------------------------------------------
/splunk/src/main/java/net/hydromatic/optiq/impl/splunk/search/SearchResultListener.java:
--------------------------------------------------------------------------------
1 | /*
2 | // Licensed to Julian Hyde under one or more contributor license
3 | // agreements. See the NOTICE file distributed with this work for
4 | // additional information regarding copyright ownership.
5 | //
6 | // Julian Hyde licenses this file to you under the Apache License,
7 | // Version 2.0 (the "License"); you may not use this file except in
8 | // compliance with the License. You may obtain a copy of the License at:
9 | //
10 | // http://www.apache.org/licenses/LICENSE-2.0
11 | //
12 | // Unless required by applicable law or agreed to in writing, software
13 | // distributed under the License is distributed on an "AS IS" BASIS,
14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | // See the License for the specific language governing permissions and
16 | // limitations under the License.
17 | */
18 | package net.hydromatic.optiq.impl.splunk.search;
19 |
20 | /**
21 | * Called each time a search returns a record.
22 | */
23 | public interface SearchResultListener {
24 | /**
25 | * Handles a record from a search result.
26 | *
27 | * @param fieldValues Values of the record
28 | * @return true to continue parsing, false otherwise
29 | */
30 | boolean processSearchResult(String[] fieldValues);
31 |
32 | void setFieldNames(String[] fieldNames);
33 | }
34 |
35 | // End SearchResultListener.java
36 |
--------------------------------------------------------------------------------
/splunk/src/main/java/net/hydromatic/optiq/impl/splunk/search/SplunkConnection.java:
--------------------------------------------------------------------------------
1 | /*
2 | // Licensed to Julian Hyde under one or more contributor license
3 | // agreements. See the NOTICE file distributed with this work for
4 | // additional information regarding copyright ownership.
5 | //
6 | // Julian Hyde licenses this file to you under the Apache License,
7 | // Version 2.0 (the "License"); you may not use this file except in
8 | // compliance with the License. You may obtain a copy of the License at:
9 | //
10 | // http://www.apache.org/licenses/LICENSE-2.0
11 | //
12 | // Unless required by applicable law or agreed to in writing, software
13 | // distributed under the License is distributed on an "AS IS" BASIS,
14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | // See the License for the specific language governing permissions and
16 | // limitations under the License.
17 | */
18 | package net.hydromatic.optiq.impl.splunk.search;
19 |
20 | import net.hydromatic.linq4j.Enumerator;
21 |
22 | import java.util.List;
23 | import java.util.Map;
24 |
25 | /**
26 | * Connection to Splunk.
27 | */
28 | public interface SplunkConnection {
29 | void getSearchResults(String search, Map otherArgs,
30 | List fieldList, SearchResultListener srl);
31 |
32 | Enumerator getSearchResultEnumerator(String search,
33 | Map otherArgs, List fieldList);
34 | }
35 |
36 | // End SplunkConnection.java
37 |
--------------------------------------------------------------------------------
/splunk/src/main/java/net/hydromatic/optiq/impl/splunk/search/package-info.java:
--------------------------------------------------------------------------------
1 | /*
2 | // Licensed to Julian Hyde under one or more contributor license
3 | // agreements. See the NOTICE file distributed with this work for
4 | // additional information regarding copyright ownership.
5 | //
6 | // Julian Hyde licenses this file to you under the Apache License,
7 | // Version 2.0 (the "License"); you may not use this file except in
8 | // compliance with the License. You may obtain a copy of the License at:
9 | //
10 | // http://www.apache.org/licenses/LICENSE-2.0
11 | //
12 | // Unless required by applicable law or agreed to in writing, software
13 | // distributed under the License is distributed on an "AS IS" BASIS,
14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | // See the License for the specific language governing permissions and
16 | // limitations under the License.
17 | */
18 |
19 | /**
20 | * Provides utility classes.
21 | */
22 | package org.eigenbase.util;
23 |
24 | // End package-info.java
25 |
--------------------------------------------------------------------------------
/splunk/src/main/java/net/hydromatic/optiq/impl/splunk/util/package-info.java:
--------------------------------------------------------------------------------
1 | /*
2 | // Licensed to Julian Hyde under one or more contributor license
3 | // agreements. See the NOTICE file distributed with this work for
4 | // additional information regarding copyright ownership.
5 | //
6 | // Julian Hyde licenses this file to you under the Apache License,
7 | // Version 2.0 (the "License"); you may not use this file except in
8 | // compliance with the License. You may obtain a copy of the License at:
9 | //
10 | // http://www.apache.org/licenses/LICENSE-2.0
11 | //
12 | // Unless required by applicable law or agreed to in writing, software
13 | // distributed under the License is distributed on an "AS IS" BASIS,
14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | // See the License for the specific language governing permissions and
16 | // limitations under the License.
17 | */
18 |
19 | /**
20 | * Provides utility classes.
21 | */
22 | package org.eigenbase.util;
23 |
24 | // End package-info.java
25 |
--------------------------------------------------------------------------------
/splunk/src/test/java/net/hydromatic/optiq/test/package-info.java:
--------------------------------------------------------------------------------
1 | /*
2 | // Licensed to Julian Hyde under one or more contributor license
3 | // agreements. See the NOTICE file distributed with this work for
4 | // additional information regarding copyright ownership.
5 | //
6 | // Julian Hyde licenses this file to you under the Apache License,
7 | // Version 2.0 (the "License"); you may not use this file except in
8 | // compliance with the License. You may obtain a copy of the License at:
9 | //
10 | // http://www.apache.org/licenses/LICENSE-2.0
11 | //
12 | // Unless required by applicable law or agreed to in writing, software
13 | // distributed under the License is distributed on an "AS IS" BASIS,
14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | // See the License for the specific language governing permissions and
16 | // limitations under the License.
17 | */
18 |
19 | /**
20 | * Provides utility classes.
21 | */
22 | package org.eigenbase.util;
23 |
24 | // End package-info.java
25 |
--------------------------------------------------------------------------------
/sqlline.bat:
--------------------------------------------------------------------------------
1 | @echo off
2 | :: sqlline.bat - Windows script to launch SQL shell
3 | ::
4 | :: Licensed to Julian Hyde under one or more contributor license
5 | :: agreements. See the NOTICE file distributed with this work for
6 | :: additional information regarding copyright ownership.
7 | ::
8 | :: Julian Hyde licenses this file to you under the Apache License,
9 | :: Version 2.0 (the "License"); you may not use this file except in
10 | :: compliance with the License. You may obtain a copy of the License at:
11 | ::
12 | :: http://www.apache.org/licenses/LICENSE-2.0
13 | ::
14 | :: Unless required by applicable law or agreed to in writing, software
15 | :: distributed under the License is distributed on an "AS IS" BASIS,
16 | :: WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 | :: See the License for the specific language governing permissions and
18 | :: limitations under the License.
19 | ::
20 | :: Example:
21 | :: > sqlline.bat
22 | :: sqlline> !connect jdbc:optiq: admin admin
23 |
24 | :: Copy dependency jars on first call. (To force jar refresh, remove target\dependencies)
25 | if not exist target\dependencies (call mvn -B dependency:copy-dependencies -DoverWriteReleases=false -DoverWriteSnapshots=false -DoverWriteIfNewer=true -DoutputDirectory=target\dependencies)
26 |
27 | java -Xmx1G -cp ".\target\dependencies\*;core\target\dependencies\*;avatica\target\dependencies\*;mongodb\target\dependencies\*;spark\target\dependencies\*;splunk\target\dependencies\*" sqlline.SqlLine --verbose=true %*
28 |
29 | :: End sqlline.bat
30 |
--------------------------------------------------------------------------------
/src/main/config/checkstyle/header.txt:
--------------------------------------------------------------------------------
1 | /*
2 | // Licensed to Julian Hyde under one or more contributor license
3 | // agreements. See the NOTICE file distributed with this work for
4 | // additional information regarding copyright ownership.
5 | //
6 | // Julian Hyde licenses this file to you under the Apache License,
7 | // Version 2.0 (the "License"); you may not use this file except in
8 | // compliance with the License. You may obtain a copy of the License at:
9 | //
10 | // http://www.apache.org/licenses/LICENSE-2.0
11 | //
12 | // Unless required by applicable law or agreed to in writing, software
13 | // distributed under the License is distributed on an "AS IS" BASIS,
14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | // See the License for the specific language governing permissions and
16 | // limitations under the License.
17 | */
18 |
--------------------------------------------------------------------------------
/ubenchmark/src/main/java/net/hydromatic/optiq/package-info.java:
--------------------------------------------------------------------------------
1 | /*
2 | // Licensed to Julian Hyde under one or more contributor license
3 | // agreements. See the NOTICE file distributed with this work for
4 | // additional information regarding copyright ownership.
5 | //
6 | // Julian Hyde licenses this file to you under the Apache License,
7 | // Version 2.0 (the "License"); you may not use this file except in
8 | // compliance with the License. You may obtain a copy of the License at:
9 | //
10 | // http://www.apache.org/licenses/LICENSE-2.0
11 | //
12 | // Unless required by applicable law or agreed to in writing, software
13 | // distributed under the License is distributed on an "AS IS" BASIS,
14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | // See the License for the specific language governing permissions and
16 | // limitations under the License.
17 | */
18 | /**
19 | * Microbenchmarks to test optiq performance.
20 | * The way to run is
21 | * {@code mvn package && java -jar ./target/ubenchmarks.jar -wi 5 -i 5 -f 1}.
22 | *
23 | * To run with profiling, use {@code java -Djmh.stack.lines=10 -jar
24 | * ./target/ubenchmarks.jar -prof hs_comp,hs_gc,stack -f 1 -wi 5}.
25 | */
26 | package net.hydromatic.optiq;
27 |
--------------------------------------------------------------------------------