Repository: asterixdb Updated Branches: refs/heads/master dc7e68a02 -> 35b6c1317
http://git-wip-us.apache.org/repos/asf/asterixdb/blob/35b6c131/hyracks-fullstack/algebricks/algebricks-examples/piglet-example/src/main/java/org/apache/hyracks/algebricks/examples/piglet/metadata/PigletMetadataProvider.java ---------------------------------------------------------------------- diff --git a/hyracks-fullstack/algebricks/algebricks-examples/piglet-example/src/main/java/org/apache/hyracks/algebricks/examples/piglet/metadata/PigletMetadataProvider.java b/hyracks-fullstack/algebricks/algebricks-examples/piglet-example/src/main/java/org/apache/hyracks/algebricks/examples/piglet/metadata/PigletMetadataProvider.java deleted file mode 100644 index 3f7f56d..0000000 --- a/hyracks-fullstack/algebricks/algebricks-examples/piglet-example/src/main/java/org/apache/hyracks/algebricks/examples/piglet/metadata/PigletMetadataProvider.java +++ /dev/null @@ -1,261 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.hyracks.algebricks.examples.piglet.metadata; - -import java.util.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.apache.hyracks.algebricks.common.constraints.AlgebricksAbsolutePartitionConstraint; -import org.apache.hyracks.algebricks.common.constraints.AlgebricksPartitionConstraint; -import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException; -import org.apache.hyracks.algebricks.common.utils.Pair; -import org.apache.hyracks.algebricks.core.algebra.base.ILogicalExpression; -import org.apache.hyracks.algebricks.core.algebra.base.LogicalVariable; -import org.apache.hyracks.algebricks.core.algebra.expressions.IVariableTypeEnvironment; -import org.apache.hyracks.algebricks.core.algebra.functions.AlgebricksBuiltinFunctions; -import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier; -import org.apache.hyracks.algebricks.core.algebra.functions.IFunctionInfo; -import org.apache.hyracks.algebricks.core.algebra.metadata.IDataSink; -import org.apache.hyracks.algebricks.core.algebra.metadata.IDataSource; -import org.apache.hyracks.algebricks.core.algebra.metadata.IDataSourceIndex; -import org.apache.hyracks.algebricks.core.algebra.metadata.IMetadataProvider; -import org.apache.hyracks.algebricks.core.algebra.operators.logical.IOperatorSchema; -import org.apache.hyracks.algebricks.core.jobgen.impl.JobGenContext; -import org.apache.hyracks.algebricks.data.IPrinterFactory; -import org.apache.hyracks.algebricks.examples.piglet.types.Type; -import org.apache.hyracks.algebricks.runtime.base.IPushRuntimeFactory; -import org.apache.hyracks.algebricks.runtime.operators.std.SinkWriterRuntimeFactory; -import org.apache.hyracks.algebricks.runtime.writers.PrinterBasedWriterFactory; -import org.apache.hyracks.api.dataflow.IOperatorDescriptor; -import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer; -import org.apache.hyracks.api.dataflow.value.RecordDescriptor; -import org.apache.hyracks.api.exceptions.HyracksDataException; -import org.apache.hyracks.api.io.FileSplit; -import org.apache.hyracks.api.job.JobSpecification; -import org.apache.hyracks.dataflow.common.data.marshalling.FloatSerializerDeserializer; -import org.apache.hyracks.dataflow.common.data.marshalling.IntegerSerializerDeserializer; -import org.apache.hyracks.dataflow.common.data.marshalling.UTF8StringSerializerDeserializer; -import org.apache.hyracks.dataflow.common.data.parsers.FloatParserFactory; -import org.apache.hyracks.dataflow.common.data.parsers.IValueParserFactory; -import org.apache.hyracks.dataflow.common.data.parsers.IntegerParserFactory; -import org.apache.hyracks.dataflow.common.data.parsers.UTF8StringParserFactory; -import org.apache.hyracks.dataflow.std.file.ConstantFileSplitProvider; -import org.apache.hyracks.dataflow.std.file.DelimitedDataTupleParserFactory; -import org.apache.hyracks.dataflow.std.file.FileScanOperatorDescriptor; -import org.apache.hyracks.dataflow.std.file.IFileSplitProvider; -import org.apache.hyracks.dataflow.std.file.ITupleParserFactory; - -public class PigletMetadataProvider implements IMetadataProvider<String, String> { - private static final Map<FunctionIdentifier, PigletFunction> FN_MAP; - - static { - Map<FunctionIdentifier, PigletFunction> map = new HashMap<>(); - - map.put(AlgebricksBuiltinFunctions.EQ, new PigletFunction(AlgebricksBuiltinFunctions.EQ)); - - FN_MAP = Collections.unmodifiableMap(map); - } - - @Override - public IDataSource<String> findDataSource(String id) throws AlgebricksException { - return null; - } - - @Override - public Pair<IOperatorDescriptor, AlgebricksPartitionConstraint> getScannerRuntime(IDataSource<String> dataSource, - List<LogicalVariable> scanVariables, List<LogicalVariable> projectVariables, boolean projectPushed, - List<LogicalVariable> minFilterVars, List<LogicalVariable> maxFilterVars, IOperatorSchema opSchema, - IVariableTypeEnvironment typeEnv, JobGenContext context, JobSpecification jobSpec, Object implConfig) - throws AlgebricksException { - PigletFileDataSource ds = (PigletFileDataSource) dataSource; - - FileSplit[] fileSplits = ds.getFileSplits(); - String[] locations = new String[fileSplits.length]; - for (int i = 0; i < fileSplits.length; ++i) { - locations[i] = fileSplits[i].getNodeName(); - } - IFileSplitProvider fsp = new ConstantFileSplitProvider(fileSplits); - - Object[] colTypes = ds.getSchemaTypes(); - IValueParserFactory[] vpfs = new IValueParserFactory[colTypes.length]; - ISerializerDeserializer[] serDesers = new ISerializerDeserializer[colTypes.length]; - - for (int i = 0; i < colTypes.length; ++i) { - Type colType = (Type) colTypes[i]; - IValueParserFactory vpf; - ISerializerDeserializer serDeser; - switch (colType.getTag()) { - case INTEGER: - vpf = IntegerParserFactory.INSTANCE; - serDeser = IntegerSerializerDeserializer.INSTANCE; - break; - - case CHAR_ARRAY: - vpf = UTF8StringParserFactory.INSTANCE; - serDeser = new UTF8StringSerializerDeserializer(); - break; - - case FLOAT: - vpf = FloatParserFactory.INSTANCE; - serDeser = FloatSerializerDeserializer.INSTANCE; - break; - - default: - throw new UnsupportedOperationException(); - } - vpfs[i] = vpf; - serDesers[i] = serDeser; - } - - ITupleParserFactory tpf = new DelimitedDataTupleParserFactory(vpfs, ','); - RecordDescriptor rDesc = new RecordDescriptor(serDesers); - - IOperatorDescriptor scanner = new FileScanOperatorDescriptor(jobSpec, fsp, tpf, rDesc); - AlgebricksAbsolutePartitionConstraint constraint = new AlgebricksAbsolutePartitionConstraint(locations); - return new Pair<>(scanner, constraint); - } - - @Override - public Pair<IPushRuntimeFactory, AlgebricksPartitionConstraint> getWriteFileRuntime(IDataSink sink, - int[] printColumns, IPrinterFactory[] printerFactories, RecordDescriptor inputDesc) - throws AlgebricksException { - PigletFileDataSink ds = (PigletFileDataSink) sink; - FileSplit[] fileSplits = ds.getFileSplits(); - String[] locations = new String[fileSplits.length]; - for (int i = 0; i < fileSplits.length; ++i) { - locations[i] = fileSplits[i].getNodeName(); - } - IPushRuntimeFactory prf; - try { - prf = new SinkWriterRuntimeFactory(printColumns, printerFactories, - fileSplits[0].getFile(null), PrinterBasedWriterFactory.INSTANCE, inputDesc); - AlgebricksAbsolutePartitionConstraint constraint = new AlgebricksAbsolutePartitionConstraint(locations); - return new Pair<>(prf, constraint); - } catch (HyracksDataException e) { - throw new AlgebricksException(e); - } - } - - @Override - public IDataSourceIndex<String, String> findDataSourceIndex(String indexId, String dataSourceId) - throws AlgebricksException { - return null; - } - - @Override - public Pair<IOperatorDescriptor, AlgebricksPartitionConstraint> getResultHandleRuntime(IDataSink sink, - int[] printColumns, IPrinterFactory[] printerFactories, RecordDescriptor inputDesc, boolean ordered, - JobSpecification spec) throws AlgebricksException { - return null; - } - - @Override - public Pair<IOperatorDescriptor, AlgebricksPartitionConstraint> getWriteResultRuntime( - IDataSource<String> dataSource, IOperatorSchema propagatedSchema, List<LogicalVariable> keys, - LogicalVariable payLoadVar, List<LogicalVariable> additionalNonKeyFields, JobGenContext context, - JobSpecification jobSpec) throws AlgebricksException { - // TODO Auto-generated method stub - return null; - } - - @Override - public Pair<IOperatorDescriptor, AlgebricksPartitionConstraint> getIndexInsertRuntime( - IDataSourceIndex<String, String> dataSource, IOperatorSchema propagatedSchema, - IOperatorSchema[] inputSchemas, IVariableTypeEnvironment typeEnv, List<LogicalVariable> primaryKeys, - List<LogicalVariable> secondaryKeys, List<LogicalVariable> additionalNonKeyFields, - ILogicalExpression filterExpr, RecordDescriptor recordDesc, JobGenContext context, JobSpecification spec, - boolean bulkload) throws AlgebricksException { - // TODO Auto-generated method stub - return null; - } - - @Override - public Pair<IOperatorDescriptor, AlgebricksPartitionConstraint> getIndexDeleteRuntime( - IDataSourceIndex<String, String> dataSource, IOperatorSchema propagatedSchema, - IOperatorSchema[] inputSchemas, IVariableTypeEnvironment typeEnv, List<LogicalVariable> primaryKeys, - List<LogicalVariable> secondaryKeys, List<LogicalVariable> additionalNonKeyFields, - ILogicalExpression filterExpr, RecordDescriptor recordDesc, JobGenContext context, JobSpecification spec) - throws AlgebricksException { - // TODO Auto-generated method stub - return null; - } - - @Override - public Pair<IOperatorDescriptor, AlgebricksPartitionConstraint> getTokenizerRuntime( - IDataSourceIndex<String, String> dataSource, IOperatorSchema propagatedSchema, - IOperatorSchema[] inputSchemas, IVariableTypeEnvironment typeEnv, List<LogicalVariable> primaryKeys, - List<LogicalVariable> secondaryKeys, ILogicalExpression filterExpr, RecordDescriptor recordDesc, - JobGenContext context, JobSpecification spec, boolean bulkload) throws AlgebricksException { - // TODO Auto-generated method stub - return null; - } - - @Override - public IFunctionInfo lookupFunction(FunctionIdentifier fid) { - return FN_MAP.get(fid); - } - - @Override - public Pair<IOperatorDescriptor, AlgebricksPartitionConstraint> getInsertRuntime(IDataSource<String> dataSource, - IOperatorSchema propagatedSchema, IVariableTypeEnvironment typeEnv, List<LogicalVariable> keys, - LogicalVariable payLoadVar, List<LogicalVariable> additionalFilterKeyFields, - List<LogicalVariable> additionalNonFilteringFields, RecordDescriptor recordDesc, JobGenContext context, - JobSpecification jobSpec, boolean bulkload) throws AlgebricksException { - // TODO Auto-generated method stub - return null; - } - - @Override - public Pair<IOperatorDescriptor, AlgebricksPartitionConstraint> getDeleteRuntime(IDataSource<String> dataSource, - IOperatorSchema propagatedSchema, IVariableTypeEnvironment typeEnv, List<LogicalVariable> keys, - LogicalVariable payLoadVar, List<LogicalVariable> additionalNonKeyFields, RecordDescriptor recordDesc, - JobGenContext context, JobSpecification jobSpec) throws AlgebricksException { - // TODO Auto-generated method stub - return null; - } - - @Override - public Pair<IOperatorDescriptor, AlgebricksPartitionConstraint> getUpsertRuntime(IDataSource<String> dataSource, - IOperatorSchema propagatedSchema, IVariableTypeEnvironment typeEnv, List<LogicalVariable> keys, - LogicalVariable payLoadVar, List<LogicalVariable> additionalFilterFields, - List<LogicalVariable> additionalNonFilteringFields, RecordDescriptor recordDesc, JobGenContext context, - JobSpecification jobSpec) throws AlgebricksException { - // TODO Auto-generated method stub - return null; - } - - @Override - public Pair<IOperatorDescriptor, AlgebricksPartitionConstraint> getIndexUpsertRuntime( - IDataSourceIndex<String, String> dataSourceIndex, IOperatorSchema propagatedSchema, - IOperatorSchema[] inputSchemas, IVariableTypeEnvironment typeEnv, List<LogicalVariable> primaryKeys, - List<LogicalVariable> secondaryKeys, List<LogicalVariable> additionalFilteringKeys, - ILogicalExpression filterExpr, List<LogicalVariable> prevSecondaryKeys, - LogicalVariable prevAdditionalFilteringFields, RecordDescriptor inputDesc, JobGenContext context, - JobSpecification spec) throws AlgebricksException { - // TODO Auto-generated method stub - return null; - } - - @Override - public Map<String, String> getConfig() { - return Collections.emptyMap(); - } -} http://git-wip-us.apache.org/repos/asf/asterixdb/blob/35b6c131/hyracks-fullstack/algebricks/algebricks-examples/piglet-example/src/main/java/org/apache/hyracks/algebricks/examples/piglet/rewriter/PigletRewriteRuleset.java ---------------------------------------------------------------------- diff --git a/hyracks-fullstack/algebricks/algebricks-examples/piglet-example/src/main/java/org/apache/hyracks/algebricks/examples/piglet/rewriter/PigletRewriteRuleset.java b/hyracks-fullstack/algebricks/algebricks-examples/piglet-example/src/main/java/org/apache/hyracks/algebricks/examples/piglet/rewriter/PigletRewriteRuleset.java deleted file mode 100644 index 407700f..0000000 --- a/hyracks-fullstack/algebricks/algebricks-examples/piglet-example/src/main/java/org/apache/hyracks/algebricks/examples/piglet/rewriter/PigletRewriteRuleset.java +++ /dev/null @@ -1,135 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.hyracks.algebricks.examples.piglet.rewriter; - -import java.util.LinkedList; -import java.util.List; - -import org.apache.hyracks.algebricks.core.rewriter.base.HeuristicOptimizer; -import org.apache.hyracks.algebricks.core.rewriter.base.IAlgebraicRewriteRule; -import org.apache.hyracks.algebricks.rewriter.rules.BreakSelectIntoConjunctsRule; -import org.apache.hyracks.algebricks.rewriter.rules.ComplexJoinInferenceRule; -import org.apache.hyracks.algebricks.rewriter.rules.ConsolidateAssignsRule; -import org.apache.hyracks.algebricks.rewriter.rules.ConsolidateSelectsRule; -import org.apache.hyracks.algebricks.rewriter.rules.EnforceStructuralPropertiesRule; -import org.apache.hyracks.algebricks.rewriter.rules.ExtractCommonOperatorsRule; -import org.apache.hyracks.algebricks.rewriter.rules.ExtractGbyExpressionsRule; -import org.apache.hyracks.algebricks.rewriter.rules.FactorRedundantGroupAndDecorVarsRule; -import org.apache.hyracks.algebricks.rewriter.rules.InferTypesRule; -import org.apache.hyracks.algebricks.rewriter.rules.InlineVariablesRule; -import org.apache.hyracks.algebricks.rewriter.rules.IsolateHyracksOperatorsRule; -import org.apache.hyracks.algebricks.rewriter.rules.PullSelectOutOfEqJoin; -import org.apache.hyracks.algebricks.rewriter.rules.CopyLimitDownRule; -import org.apache.hyracks.algebricks.rewriter.rules.PushProjectDownRule; -import org.apache.hyracks.algebricks.rewriter.rules.PushProjectIntoDataSourceScanRule; -import org.apache.hyracks.algebricks.rewriter.rules.PushSelectDownRule; -import org.apache.hyracks.algebricks.rewriter.rules.PushSelectIntoJoinRule; -import org.apache.hyracks.algebricks.rewriter.rules.ReinferAllTypesRule; -import org.apache.hyracks.algebricks.rewriter.rules.RemoveUnusedAssignAndAggregateRule; -import org.apache.hyracks.algebricks.rewriter.rules.SetAlgebricksPhysicalOperatorsRule; -import org.apache.hyracks.algebricks.rewriter.rules.SetExecutionModeRule; -import org.apache.hyracks.algebricks.rewriter.rules.subplan.EliminateSubplanRule; - -public class PigletRewriteRuleset { - - public final static List<IAlgebraicRewriteRule> buildTypeInferenceRuleCollection() { - List<IAlgebraicRewriteRule> typeInfer = new LinkedList<IAlgebraicRewriteRule>(); - typeInfer.add(new InferTypesRule()); - return typeInfer; - } - - public final static List<IAlgebraicRewriteRule> buildNormalizationRuleCollection() { - List<IAlgebraicRewriteRule> normalization = new LinkedList<IAlgebraicRewriteRule>(); - normalization.add(new EliminateSubplanRule()); - // TODO: This rule is incorrect and has been removed. Its replacement in - // Asterix (PushAggFuncIntoStandaloneAggregateRule) - // is language-specific. - // normalization.add(new IntroduceGroupByForStandaloneAggregRule()); - normalization.add(new BreakSelectIntoConjunctsRule()); - normalization.add(new PushSelectIntoJoinRule()); - normalization.add(new ExtractGbyExpressionsRule()); - return normalization; - } - - public final static List<IAlgebraicRewriteRule> buildCondPushDownRuleCollection() { - List<IAlgebraicRewriteRule> condPushDown = new LinkedList<IAlgebraicRewriteRule>(); - condPushDown.add(new PushSelectDownRule()); - condPushDown.add(new InlineVariablesRule()); - condPushDown.add(new FactorRedundantGroupAndDecorVarsRule()); - condPushDown.add(new EliminateSubplanRule()); - return condPushDown; - } - - public final static List<IAlgebraicRewriteRule> buildJoinInferenceRuleCollection() { - List<IAlgebraicRewriteRule> joinInference = new LinkedList<IAlgebraicRewriteRule>(); - joinInference.add(new InlineVariablesRule()); - joinInference.add(new ComplexJoinInferenceRule()); - return joinInference; - } - - public final static List<IAlgebraicRewriteRule> buildOpPushDownRuleCollection() { - List<IAlgebraicRewriteRule> opPushDown = new LinkedList<IAlgebraicRewriteRule>(); - opPushDown.add(new PushProjectDownRule()); - opPushDown.add(new PushSelectDownRule()); - return opPushDown; - } - - public final static List<IAlgebraicRewriteRule> buildDataExchangeRuleCollection() { - List<IAlgebraicRewriteRule> dataExchange = new LinkedList<IAlgebraicRewriteRule>(); - dataExchange.add(new SetExecutionModeRule()); - return dataExchange; - } - - public final static List<IAlgebraicRewriteRule> buildConsolidationRuleCollection() { - List<IAlgebraicRewriteRule> consolidation = new LinkedList<IAlgebraicRewriteRule>(); - consolidation.add(new ConsolidateSelectsRule()); - consolidation.add(new ConsolidateAssignsRule()); - consolidation.add(new RemoveUnusedAssignAndAggregateRule()); - return consolidation; - } - - public final static List<IAlgebraicRewriteRule> buildPhysicalRewritesAllLevelsRuleCollection() { - List<IAlgebraicRewriteRule> physicalPlanRewrites = new LinkedList<IAlgebraicRewriteRule>(); - physicalPlanRewrites.add(new PullSelectOutOfEqJoin()); - physicalPlanRewrites.add(new SetAlgebricksPhysicalOperatorsRule()); - physicalPlanRewrites.add(new EnforceStructuralPropertiesRule()); - physicalPlanRewrites.add(new PushProjectDownRule()); - physicalPlanRewrites.add(new CopyLimitDownRule()); - return physicalPlanRewrites; - } - - public final static List<IAlgebraicRewriteRule> buildPhysicalRewritesTopLevelRuleCollection() { - List<IAlgebraicRewriteRule> physicalPlanRewrites = new LinkedList<IAlgebraicRewriteRule>(); - physicalPlanRewrites.add(new CopyLimitDownRule()); - return physicalPlanRewrites; - } - - public final static List<IAlgebraicRewriteRule> prepareForJobGenRuleCollection() { - List<IAlgebraicRewriteRule> prepareForJobGenRewrites = new LinkedList<IAlgebraicRewriteRule>(); - prepareForJobGenRewrites.add(new IsolateHyracksOperatorsRule( - HeuristicOptimizer.hyraxOperatorsBelowWhichJobGenIsDisabled)); - prepareForJobGenRewrites.add(new ExtractCommonOperatorsRule()); - // Re-infer all types, so that, e.g., the effect of not-is-null is - // propagated. - prepareForJobGenRewrites.add(new PushProjectIntoDataSourceScanRule()); - prepareForJobGenRewrites.add(new ReinferAllTypesRule()); - return prepareForJobGenRewrites; - } - -} http://git-wip-us.apache.org/repos/asf/asterixdb/blob/35b6c131/hyracks-fullstack/algebricks/algebricks-examples/piglet-example/src/main/java/org/apache/hyracks/algebricks/examples/piglet/runtime/PigletExpressionJobGen.java ---------------------------------------------------------------------- diff --git a/hyracks-fullstack/algebricks/algebricks-examples/piglet-example/src/main/java/org/apache/hyracks/algebricks/examples/piglet/runtime/PigletExpressionJobGen.java b/hyracks-fullstack/algebricks/algebricks-examples/piglet-example/src/main/java/org/apache/hyracks/algebricks/examples/piglet/runtime/PigletExpressionJobGen.java deleted file mode 100644 index a19247a..0000000 --- a/hyracks-fullstack/algebricks/algebricks-examples/piglet-example/src/main/java/org/apache/hyracks/algebricks/examples/piglet/runtime/PigletExpressionJobGen.java +++ /dev/null @@ -1,146 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.hyracks.algebricks.examples.piglet.runtime; - -import java.io.DataOutput; -import java.util.Arrays; -import java.util.List; - -import org.apache.commons.lang3.mutable.Mutable; - -import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException; -import org.apache.hyracks.algebricks.core.algebra.base.ILogicalExpression; -import org.apache.hyracks.algebricks.core.algebra.base.LogicalVariable; -import org.apache.hyracks.algebricks.core.algebra.expressions.AggregateFunctionCallExpression; -import org.apache.hyracks.algebricks.core.algebra.expressions.ConstantExpression; -import org.apache.hyracks.algebricks.core.algebra.expressions.ILogicalExpressionJobGen; -import org.apache.hyracks.algebricks.core.algebra.expressions.IVariableTypeEnvironment; -import org.apache.hyracks.algebricks.core.algebra.expressions.ScalarFunctionCallExpression; -import org.apache.hyracks.algebricks.core.algebra.expressions.StatefulFunctionCallExpression; -import org.apache.hyracks.algebricks.core.algebra.expressions.UnnestingFunctionCallExpression; -import org.apache.hyracks.algebricks.core.algebra.expressions.VariableReferenceExpression; -import org.apache.hyracks.algebricks.core.algebra.operators.logical.IOperatorSchema; -import org.apache.hyracks.algebricks.core.jobgen.impl.JobGenContext; -import org.apache.hyracks.algebricks.examples.piglet.compiler.ConstantValue; -import org.apache.hyracks.algebricks.examples.piglet.exceptions.PigletException; -import org.apache.hyracks.algebricks.examples.piglet.runtime.functions.PigletFunctionRegistry; -import org.apache.hyracks.algebricks.examples.piglet.types.Type; -import org.apache.hyracks.algebricks.runtime.base.IAggregateEvaluatorFactory; -import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory; -import org.apache.hyracks.algebricks.runtime.base.IRunningAggregateEvaluatorFactory; -import org.apache.hyracks.algebricks.runtime.base.ISerializedAggregateEvaluatorFactory; -import org.apache.hyracks.algebricks.runtime.base.IUnnestingEvaluatorFactory; -import org.apache.hyracks.algebricks.runtime.evaluators.ColumnAccessEvalFactory; -import org.apache.hyracks.algebricks.runtime.evaluators.ConstantEvalFactory; -import org.apache.hyracks.data.std.util.ArrayBackedValueStorage; -import org.apache.hyracks.dataflow.common.data.marshalling.IntegerSerializerDeserializer; -import org.apache.hyracks.dataflow.common.data.marshalling.UTF8StringSerializerDeserializer; - -public class PigletExpressionJobGen implements ILogicalExpressionJobGen { - private final UTF8StringSerializerDeserializer utf8SerDer = new UTF8StringSerializerDeserializer(); - - @Override - public IScalarEvaluatorFactory createEvaluatorFactory(ILogicalExpression expr, IVariableTypeEnvironment env, - IOperatorSchema[] inputSchemas, JobGenContext context) throws AlgebricksException { - switch (expr.getExpressionTag()) { - case CONSTANT: { - ConstantValue cv = (ConstantValue) ((ConstantExpression) expr).getValue(); - Type type = cv.getType(); - String image = cv.getImage(); - ArrayBackedValueStorage abvs = new ArrayBackedValueStorage(); - DataOutput dos = abvs.getDataOutput(); - switch (type.getTag()) { - case INTEGER: - try { - IntegerSerializerDeserializer.INSTANCE.serialize(Integer.valueOf(image), dos); - } catch (Exception e) { - throw new AlgebricksException(e); - } - break; - - case CHAR_ARRAY: - try { - utf8SerDer.serialize(image, dos); - } catch (Exception e) { - throw new AlgebricksException(e); - } - break; - - default: - throw new UnsupportedOperationException("Unsupported constant type: " + type.getTag()); - } - return new ConstantEvalFactory(Arrays.copyOf(abvs.getByteArray(), abvs.getLength())); - } - - case FUNCTION_CALL: { - ScalarFunctionCallExpression sfce = (ScalarFunctionCallExpression) expr; - - List<Mutable<ILogicalExpression>> argExprs = sfce.getArguments(); - IScalarEvaluatorFactory argEvalFactories[] = new IScalarEvaluatorFactory[argExprs.size()]; - for (int i = 0; i < argEvalFactories.length; ++i) { - Mutable<ILogicalExpression> er = argExprs.get(i); - argEvalFactories[i] = createEvaluatorFactory(er.getValue(), env, inputSchemas, context); - } - IScalarEvaluatorFactory funcEvalFactory; - try { - funcEvalFactory = PigletFunctionRegistry.createFunctionEvaluatorFactory( - sfce.getFunctionIdentifier(), argEvalFactories); - } catch (PigletException e) { - throw new AlgebricksException(e); - } - return funcEvalFactory; - } - - case VARIABLE: { - LogicalVariable var = ((VariableReferenceExpression) expr).getVariableReference(); - int index = inputSchemas[0].findVariable(var); - return new ColumnAccessEvalFactory(index); - } - } - throw new IllegalArgumentException("Unknown expression type: " + expr.getExpressionTag()); - } - - @Override - public IAggregateEvaluatorFactory createAggregateFunctionFactory(AggregateFunctionCallExpression expr, - IVariableTypeEnvironment env, IOperatorSchema[] inputSchemas, JobGenContext context) - throws AlgebricksException { - throw new UnsupportedOperationException(); - } - - @Override - public ISerializedAggregateEvaluatorFactory createSerializableAggregateFunctionFactory( - AggregateFunctionCallExpression expr, IVariableTypeEnvironment env, IOperatorSchema[] inputSchemas, - JobGenContext context) throws AlgebricksException { - throw new UnsupportedOperationException(); - } - - @Override - public IRunningAggregateEvaluatorFactory createRunningAggregateFunctionFactory(StatefulFunctionCallExpression expr, - IVariableTypeEnvironment env, IOperatorSchema[] inputSchemas, JobGenContext context) - throws AlgebricksException { - throw new UnsupportedOperationException(); - } - - @Override - public IUnnestingEvaluatorFactory createUnnestingFunctionFactory(UnnestingFunctionCallExpression expr, - IVariableTypeEnvironment env, IOperatorSchema[] inputSchemas, JobGenContext context) - throws AlgebricksException { - throw new UnsupportedOperationException(); - } -} http://git-wip-us.apache.org/repos/asf/asterixdb/blob/35b6c131/hyracks-fullstack/algebricks/algebricks-examples/piglet-example/src/main/java/org/apache/hyracks/algebricks/examples/piglet/runtime/functions/IPigletFunctionEvaluatorFactoryBuilder.java ---------------------------------------------------------------------- diff --git a/hyracks-fullstack/algebricks/algebricks-examples/piglet-example/src/main/java/org/apache/hyracks/algebricks/examples/piglet/runtime/functions/IPigletFunctionEvaluatorFactoryBuilder.java b/hyracks-fullstack/algebricks/algebricks-examples/piglet-example/src/main/java/org/apache/hyracks/algebricks/examples/piglet/runtime/functions/IPigletFunctionEvaluatorFactoryBuilder.java deleted file mode 100644 index 4c0328b..0000000 --- a/hyracks-fullstack/algebricks/algebricks-examples/piglet-example/src/main/java/org/apache/hyracks/algebricks/examples/piglet/runtime/functions/IPigletFunctionEvaluatorFactoryBuilder.java +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.hyracks.algebricks.examples.piglet.runtime.functions; - -import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier; -import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory; - -public interface IPigletFunctionEvaluatorFactoryBuilder { - public IScalarEvaluatorFactory buildEvaluatorFactory(FunctionIdentifier fid, IScalarEvaluatorFactory[] arguments); -} http://git-wip-us.apache.org/repos/asf/asterixdb/blob/35b6c131/hyracks-fullstack/algebricks/algebricks-examples/piglet-example/src/main/java/org/apache/hyracks/algebricks/examples/piglet/runtime/functions/IntegerEqFunctionEvaluatorFactory.java ---------------------------------------------------------------------- diff --git a/hyracks-fullstack/algebricks/algebricks-examples/piglet-example/src/main/java/org/apache/hyracks/algebricks/examples/piglet/runtime/functions/IntegerEqFunctionEvaluatorFactory.java b/hyracks-fullstack/algebricks/algebricks-examples/piglet-example/src/main/java/org/apache/hyracks/algebricks/examples/piglet/runtime/functions/IntegerEqFunctionEvaluatorFactory.java deleted file mode 100644 index 7a83126..0000000 --- a/hyracks-fullstack/algebricks/algebricks-examples/piglet-example/src/main/java/org/apache/hyracks/algebricks/examples/piglet/runtime/functions/IntegerEqFunctionEvaluatorFactory.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.hyracks.algebricks.examples.piglet.runtime.functions; - -import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator; -import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory; -import org.apache.hyracks.api.context.IHyracksTaskContext; -import org.apache.hyracks.api.exceptions.HyracksDataException; -import org.apache.hyracks.data.std.api.IPointable; -import org.apache.hyracks.data.std.primitive.IntegerPointable; -import org.apache.hyracks.data.std.primitive.VoidPointable; -import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference; - -public class IntegerEqFunctionEvaluatorFactory implements IScalarEvaluatorFactory { - private static final long serialVersionUID = 1L; - - private final IScalarEvaluatorFactory arg1Factory; - - private final IScalarEvaluatorFactory arg2Factory; - - public IntegerEqFunctionEvaluatorFactory(IScalarEvaluatorFactory arg1Factory, IScalarEvaluatorFactory arg2Factory) { - this.arg1Factory = arg1Factory; - this.arg2Factory = arg2Factory; - } - - @Override - public IScalarEvaluator createScalarEvaluator(final IHyracksTaskContext ctx) throws HyracksDataException { - return new IScalarEvaluator() { - private IPointable out1 = new VoidPointable(); - private IPointable out2 = new VoidPointable(); - private IScalarEvaluator eval1 = arg1Factory.createScalarEvaluator(ctx); - private IScalarEvaluator eval2 = arg2Factory.createScalarEvaluator(ctx); - private byte[] resultData = new byte[1]; - - @Override - public void evaluate(IFrameTupleReference tuple, IPointable result) throws HyracksDataException { - eval1.evaluate(tuple, out1); - eval2.evaluate(tuple, out2); - int v1 = IntegerPointable.getInteger(out1.getByteArray(), out1.getStartOffset()); - int v2 = IntegerPointable.getInteger(out2.getByteArray(), out2.getStartOffset()); - boolean r = v1 == v2; - resultData[0] = r ? (byte) 1 : (byte) 0; - result.set(resultData, 0, 1); - } - }; - } -} http://git-wip-us.apache.org/repos/asf/asterixdb/blob/35b6c131/hyracks-fullstack/algebricks/algebricks-examples/piglet-example/src/main/java/org/apache/hyracks/algebricks/examples/piglet/runtime/functions/PigletFunctionRegistry.java ---------------------------------------------------------------------- diff --git a/hyracks-fullstack/algebricks/algebricks-examples/piglet-example/src/main/java/org/apache/hyracks/algebricks/examples/piglet/runtime/functions/PigletFunctionRegistry.java b/hyracks-fullstack/algebricks/algebricks-examples/piglet-example/src/main/java/org/apache/hyracks/algebricks/examples/piglet/runtime/functions/PigletFunctionRegistry.java deleted file mode 100644 index 366f238..0000000 --- a/hyracks-fullstack/algebricks/algebricks-examples/piglet-example/src/main/java/org/apache/hyracks/algebricks/examples/piglet/runtime/functions/PigletFunctionRegistry.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.hyracks.algebricks.examples.piglet.runtime.functions; - -import java.util.Collections; -import java.util.HashMap; -import java.util.Map; - -import org.apache.hyracks.algebricks.core.algebra.functions.AlgebricksBuiltinFunctions; -import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier; -import org.apache.hyracks.algebricks.examples.piglet.exceptions.PigletException; -import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory; - -public class PigletFunctionRegistry { - private static final Map<FunctionIdentifier, IPigletFunctionEvaluatorFactoryBuilder> builderMap; - - static { - Map<FunctionIdentifier, IPigletFunctionEvaluatorFactoryBuilder> temp = new HashMap<FunctionIdentifier, IPigletFunctionEvaluatorFactoryBuilder>(); - - temp.put(AlgebricksBuiltinFunctions.EQ, new IPigletFunctionEvaluatorFactoryBuilder() { - @Override - public IScalarEvaluatorFactory buildEvaluatorFactory(FunctionIdentifier fid, IScalarEvaluatorFactory[] arguments) { - return new IntegerEqFunctionEvaluatorFactory(arguments[0], arguments[1]); - } - }); - - builderMap = Collections.unmodifiableMap(temp); - } - - public static IScalarEvaluatorFactory createFunctionEvaluatorFactory(FunctionIdentifier fid, IScalarEvaluatorFactory[] args) - throws PigletException { - IPigletFunctionEvaluatorFactoryBuilder builder = builderMap.get(fid); - if (builder == null) { - throw new PigletException("Unknown function: " + fid); - } - return builder.buildEvaluatorFactory(fid, args); - } -} http://git-wip-us.apache.org/repos/asf/asterixdb/blob/35b6c131/hyracks-fullstack/algebricks/algebricks-examples/piglet-example/src/main/java/org/apache/hyracks/algebricks/examples/piglet/types/BagType.java ---------------------------------------------------------------------- diff --git a/hyracks-fullstack/algebricks/algebricks-examples/piglet-example/src/main/java/org/apache/hyracks/algebricks/examples/piglet/types/BagType.java b/hyracks-fullstack/algebricks/algebricks-examples/piglet-example/src/main/java/org/apache/hyracks/algebricks/examples/piglet/types/BagType.java deleted file mode 100644 index 551663b..0000000 --- a/hyracks-fullstack/algebricks/algebricks-examples/piglet-example/src/main/java/org/apache/hyracks/algebricks/examples/piglet/types/BagType.java +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.hyracks.algebricks.examples.piglet.types; - -public class BagType extends Type { - @Override - public Tag getTag() { - return Tag.BAG; - } -} http://git-wip-us.apache.org/repos/asf/asterixdb/blob/35b6c131/hyracks-fullstack/algebricks/algebricks-examples/piglet-example/src/main/java/org/apache/hyracks/algebricks/examples/piglet/types/CharArrayType.java ---------------------------------------------------------------------- diff --git a/hyracks-fullstack/algebricks/algebricks-examples/piglet-example/src/main/java/org/apache/hyracks/algebricks/examples/piglet/types/CharArrayType.java b/hyracks-fullstack/algebricks/algebricks-examples/piglet-example/src/main/java/org/apache/hyracks/algebricks/examples/piglet/types/CharArrayType.java deleted file mode 100644 index 03bb154..0000000 --- a/hyracks-fullstack/algebricks/algebricks-examples/piglet-example/src/main/java/org/apache/hyracks/algebricks/examples/piglet/types/CharArrayType.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.hyracks.algebricks.examples.piglet.types; - -public class CharArrayType extends Type { - public static final Type INSTANCE = new CharArrayType(); - - private CharArrayType() { - } - - @Override - public Tag getTag() { - return Tag.CHAR_ARRAY; - } -} http://git-wip-us.apache.org/repos/asf/asterixdb/blob/35b6c131/hyracks-fullstack/algebricks/algebricks-examples/piglet-example/src/main/java/org/apache/hyracks/algebricks/examples/piglet/types/DoubleType.java ---------------------------------------------------------------------- diff --git a/hyracks-fullstack/algebricks/algebricks-examples/piglet-example/src/main/java/org/apache/hyracks/algebricks/examples/piglet/types/DoubleType.java b/hyracks-fullstack/algebricks/algebricks-examples/piglet-example/src/main/java/org/apache/hyracks/algebricks/examples/piglet/types/DoubleType.java deleted file mode 100644 index 2db0edd..0000000 --- a/hyracks-fullstack/algebricks/algebricks-examples/piglet-example/src/main/java/org/apache/hyracks/algebricks/examples/piglet/types/DoubleType.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.hyracks.algebricks.examples.piglet.types; - -public class DoubleType extends Type { - public static final Type INSTANCE = new DoubleType(); - - private DoubleType() { - } - - @Override - public Tag getTag() { - return Tag.DOUBLE; - } -} http://git-wip-us.apache.org/repos/asf/asterixdb/blob/35b6c131/hyracks-fullstack/algebricks/algebricks-examples/piglet-example/src/main/java/org/apache/hyracks/algebricks/examples/piglet/types/FloatType.java ---------------------------------------------------------------------- diff --git a/hyracks-fullstack/algebricks/algebricks-examples/piglet-example/src/main/java/org/apache/hyracks/algebricks/examples/piglet/types/FloatType.java b/hyracks-fullstack/algebricks/algebricks-examples/piglet-example/src/main/java/org/apache/hyracks/algebricks/examples/piglet/types/FloatType.java deleted file mode 100644 index 35fe797..0000000 --- a/hyracks-fullstack/algebricks/algebricks-examples/piglet-example/src/main/java/org/apache/hyracks/algebricks/examples/piglet/types/FloatType.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.hyracks.algebricks.examples.piglet.types; - -public class FloatType extends Type { - public static final Type INSTANCE = new FloatType(); - - private FloatType() { - } - - @Override - public Tag getTag() { - return Tag.FLOAT; - } -} http://git-wip-us.apache.org/repos/asf/asterixdb/blob/35b6c131/hyracks-fullstack/algebricks/algebricks-examples/piglet-example/src/main/java/org/apache/hyracks/algebricks/examples/piglet/types/IntegerType.java ---------------------------------------------------------------------- diff --git a/hyracks-fullstack/algebricks/algebricks-examples/piglet-example/src/main/java/org/apache/hyracks/algebricks/examples/piglet/types/IntegerType.java b/hyracks-fullstack/algebricks/algebricks-examples/piglet-example/src/main/java/org/apache/hyracks/algebricks/examples/piglet/types/IntegerType.java deleted file mode 100644 index 57caa1b..0000000 --- a/hyracks-fullstack/algebricks/algebricks-examples/piglet-example/src/main/java/org/apache/hyracks/algebricks/examples/piglet/types/IntegerType.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.hyracks.algebricks.examples.piglet.types; - -public class IntegerType extends Type { - public static final Type INSTANCE = new IntegerType(); - - private IntegerType() { - } - - @Override - public Tag getTag() { - return Tag.INTEGER; - } -} http://git-wip-us.apache.org/repos/asf/asterixdb/blob/35b6c131/hyracks-fullstack/algebricks/algebricks-examples/piglet-example/src/main/java/org/apache/hyracks/algebricks/examples/piglet/types/LongType.java ---------------------------------------------------------------------- diff --git a/hyracks-fullstack/algebricks/algebricks-examples/piglet-example/src/main/java/org/apache/hyracks/algebricks/examples/piglet/types/LongType.java b/hyracks-fullstack/algebricks/algebricks-examples/piglet-example/src/main/java/org/apache/hyracks/algebricks/examples/piglet/types/LongType.java deleted file mode 100644 index c8f0738..0000000 --- a/hyracks-fullstack/algebricks/algebricks-examples/piglet-example/src/main/java/org/apache/hyracks/algebricks/examples/piglet/types/LongType.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.hyracks.algebricks.examples.piglet.types; - -public class LongType extends Type { - public static final Type INSTANCE = new LongType(); - - private LongType() { - } - - @Override - public Tag getTag() { - return Tag.LONG; - } -} http://git-wip-us.apache.org/repos/asf/asterixdb/blob/35b6c131/hyracks-fullstack/algebricks/algebricks-examples/piglet-example/src/main/java/org/apache/hyracks/algebricks/examples/piglet/types/MapType.java ---------------------------------------------------------------------- diff --git a/hyracks-fullstack/algebricks/algebricks-examples/piglet-example/src/main/java/org/apache/hyracks/algebricks/examples/piglet/types/MapType.java b/hyracks-fullstack/algebricks/algebricks-examples/piglet-example/src/main/java/org/apache/hyracks/algebricks/examples/piglet/types/MapType.java deleted file mode 100644 index ae57255..0000000 --- a/hyracks-fullstack/algebricks/algebricks-examples/piglet-example/src/main/java/org/apache/hyracks/algebricks/examples/piglet/types/MapType.java +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.hyracks.algebricks.examples.piglet.types; - -public class MapType extends Type { - @Override - public Tag getTag() { - return Tag.MAP; - } -} http://git-wip-us.apache.org/repos/asf/asterixdb/blob/35b6c131/hyracks-fullstack/algebricks/algebricks-examples/piglet-example/src/main/java/org/apache/hyracks/algebricks/examples/piglet/types/Schema.java ---------------------------------------------------------------------- diff --git a/hyracks-fullstack/algebricks/algebricks-examples/piglet-example/src/main/java/org/apache/hyracks/algebricks/examples/piglet/types/Schema.java b/hyracks-fullstack/algebricks/algebricks-examples/piglet-example/src/main/java/org/apache/hyracks/algebricks/examples/piglet/types/Schema.java deleted file mode 100644 index 4b7f767..0000000 --- a/hyracks-fullstack/algebricks/algebricks-examples/piglet-example/src/main/java/org/apache/hyracks/algebricks/examples/piglet/types/Schema.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.hyracks.algebricks.examples.piglet.types; - -import java.util.List; - -import org.apache.hyracks.algebricks.common.utils.Pair; - -public class Schema { - private List<Pair<String, Type>> schema; - - public Schema(List<Pair<String, Type>> schema) { - this.schema = schema; - } - - public List<Pair<String, Type>> getSchema() { - return schema; - } -} http://git-wip-us.apache.org/repos/asf/asterixdb/blob/35b6c131/hyracks-fullstack/algebricks/algebricks-examples/piglet-example/src/main/java/org/apache/hyracks/algebricks/examples/piglet/types/TupleType.java ---------------------------------------------------------------------- diff --git a/hyracks-fullstack/algebricks/algebricks-examples/piglet-example/src/main/java/org/apache/hyracks/algebricks/examples/piglet/types/TupleType.java b/hyracks-fullstack/algebricks/algebricks-examples/piglet-example/src/main/java/org/apache/hyracks/algebricks/examples/piglet/types/TupleType.java deleted file mode 100644 index 713b846..0000000 --- a/hyracks-fullstack/algebricks/algebricks-examples/piglet-example/src/main/java/org/apache/hyracks/algebricks/examples/piglet/types/TupleType.java +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.hyracks.algebricks.examples.piglet.types; - -public class TupleType extends Type { - @Override - public Tag getTag() { - return Tag.TUPLE; - } -} http://git-wip-us.apache.org/repos/asf/asterixdb/blob/35b6c131/hyracks-fullstack/algebricks/algebricks-examples/piglet-example/src/main/java/org/apache/hyracks/algebricks/examples/piglet/types/Type.java ---------------------------------------------------------------------- diff --git a/hyracks-fullstack/algebricks/algebricks-examples/piglet-example/src/main/java/org/apache/hyracks/algebricks/examples/piglet/types/Type.java b/hyracks-fullstack/algebricks/algebricks-examples/piglet-example/src/main/java/org/apache/hyracks/algebricks/examples/piglet/types/Type.java deleted file mode 100644 index f8ffe93..0000000 --- a/hyracks-fullstack/algebricks/algebricks-examples/piglet-example/src/main/java/org/apache/hyracks/algebricks/examples/piglet/types/Type.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.hyracks.algebricks.examples.piglet.types; - -public abstract class Type { - public enum Tag { - INTEGER, - LONG, - FLOAT, - DOUBLE, - CHAR_ARRAY, - TUPLE, - BAG, - MAP - } - - public abstract Tag getTag(); -} http://git-wip-us.apache.org/repos/asf/asterixdb/blob/35b6c131/hyracks-fullstack/algebricks/algebricks-examples/piglet-example/src/main/javacc/PigletParser.jj ---------------------------------------------------------------------- diff --git a/hyracks-fullstack/algebricks/algebricks-examples/piglet-example/src/main/javacc/PigletParser.jj b/hyracks-fullstack/algebricks/algebricks-examples/piglet-example/src/main/javacc/PigletParser.jj deleted file mode 100644 index 103003c..0000000 --- a/hyracks-fullstack/algebricks/algebricks-examples/piglet-example/src/main/javacc/PigletParser.jj +++ /dev/null @@ -1,395 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -options { - STATIC = false; - IGNORE_CASE = true; - LOOKAHEAD = 2; -} - -PARSER_BEGIN(PigletParser) - -package org.apache.hyracks.algebricks.examples.piglet.parser; - -import java.util.*; -import org.apache.hyracks.algebricks.common.utils.Pair; -import org.apache.hyracks.algebricks.examples.piglet.ast.*; -import org.apache.hyracks.algebricks.examples.piglet.types.*; - -public class PigletParser { - private ExpressionNode createFunction(FunctionTag fTag, String fName, ExpressionNode... arguments) { - List<ASTNode> args = new ArrayList<ASTNode>(); - for(ExpressionNode e : arguments) { - args.add(e); - } - return new ScalarFunctionExpressionNode(fTag, fName, args); - } - - private String stripQuotes(String s) { - s = s.substring(1); - s = s.substring(0, s.length() - 1); - return s; - } -} - -PARSER_END(PigletParser) - -List<ASTNode> Statements(): { - List<ASTNode> statememts = new ArrayList<ASTNode>(); - ASTNode s; -} { - ( - ( - s = AssignmentStatement() { - statememts.add(s); - } - | s = DumpStatement() { - statememts.add(s); - } - ) ";" - )* <EOF> { - return statememts; - } -} - -ASTNode AssignmentStatement(): { - String a; - RelationNode r; -} { - a = Alias() "=" r = RelationalStatement() { - return new AssignmentNode(a, r); - } -} - -String Alias(): { - Token t; -} { - t = <IDENTIFIER> { - return t.image; - } -} - -String ColumnName(): { - Token t; -} { - t = <IDENTIFIER> { - return t.image; - } -} - -Type TypeName(): { - Token t; -} { - "int" { - return IntegerType.INSTANCE; - } - | "long" { - return LongType.INSTANCE; - } - | "float" { - return FloatType.INSTANCE; - } - | "double" { - return DoubleType.INSTANCE; - } - | "chararray" { - return CharArrayType.INSTANCE; - } - | "tuple" { - return new TupleType(); - } - | "bag" { - return new BagType(); - } - | "map" { - return new MapType(); - } -} - -Pair<String, Type> ColumnSchema(): { - String c; - Type t; -} { - c = ColumnName() ":" t = TypeName() { - return new Pair<String, Type>(c, t); - } -} - -Schema Schema(): { - List<Pair<String, Type>> schema = new ArrayList<Pair<String, Type>>(); - Pair<String, Type> cSchema; -} { - "(" ( - cSchema = ColumnSchema() { - schema.add(cSchema); - } ( - "," cSchema = ColumnSchema() { - schema.add(cSchema); - } - )* - )? ")" { - return new Schema(schema); - } -} - -RelationNode RelationalStatement(): { - RelationNode r; -} { - r = LoadStatement() { - return r; - } - | r = FilterStatement() { - return r; - } -} - -RelationNode LoadStatement(): { - Token t; - Schema s; -} { - "load" t = <STRING_LITERAL> "as" s = Schema() { - return new LoadNode(t.image, s); - } -} - -RelationNode FilterStatement(): { - String a; - ExpressionNode e; -} { - "filter" a = Alias() "by" e = Expression() { - return new FilterNode(a, e); - } -} - -ASTNode DumpStatement(): { - String a; - Token t; -} { - "dump" a = Alias() "into" t = <STRING_LITERAL> { - return new DumpNode(t.image, a); - } -} - -ExpressionNode Expression(): { - ExpressionNode e; -} { - e = OrExpression() { - return e; - } -} - -ExpressionNode OrExpression(): { - ExpressionNode e1; - ExpressionNode e2; -} { - e1 = AndExpression() ( - "or" e2 = AndExpression() { - e1 = createFunction(FunctionTag.BOOLEAN_OR, null, e1, e2); - } - )* { - return e1; - } -} - -ExpressionNode AndExpression(): { - ExpressionNode e1; - ExpressionNode e2; -} { - e1 = ComparisonExpression() ( - "and" e2 = ComparisonExpression() { - e1 = createFunction(FunctionTag.BOOLEAN_AND, null, e1, e2); - } - )* { - return e1; - } -} - -ExpressionNode ComparisonExpression(): { - ExpressionNode e1; - ExpressionNode e2; - FunctionTag fTag; -} { - e1 = AdditiveExpression() ( - fTag = ComparisonOperator() e2 = AdditiveExpression() { - e1 = createFunction(fTag, null, e1, e2); - } - )? { - return e1; - } -} - -FunctionTag ComparisonOperator(): { -} { - "==" { - return FunctionTag.EQ; - } - | "!=" { - return FunctionTag.NEQ; - } - | "<" { - return FunctionTag.LT; - } - | "<=" { - return FunctionTag.LTE; - } - | ">" { - return FunctionTag.GT; - } - | ">=" { - return FunctionTag.GTE; - } -} - -ExpressionNode AdditiveExpression(): { - ExpressionNode e1; - ExpressionNode e2; - FunctionTag fTag; -} { - e1 = MultiplicativeExpression() ( - fTag = AdditiveOperator() e2 = MultiplicativeExpression() { - e1 = createFunction(fTag, null, e1, e2); - } - )* { - return e1; - } -} - -FunctionTag AdditiveOperator(): { -} { - "+" { - return FunctionTag.ADD; - } - | "-" { - return FunctionTag.SUBTRACT; - } -} - -ExpressionNode MultiplicativeExpression(): { - ExpressionNode e1; - ExpressionNode e2; - FunctionTag fTag; -} { - e1 = PrimaryExpression() ( - fTag = MultiplicativeOperator() e2 = PrimaryExpression() { - e1 = createFunction(fTag, null, e1, e2); - } - )* { - return e1; - } -} - -FunctionTag MultiplicativeOperator(): { -} { - "*" { - return FunctionTag.MULTIPLY; - } - | "/" { - return FunctionTag.DIVIDE; - } - | "%" { - return FunctionTag.MOD; - } -} - -ExpressionNode PrimaryExpression(): { - ExpressionNode e; -} { - e = Literal() { - return e; - } - | e = FieldAccess() { - return e; - } -} - -ExpressionNode Literal(): { - Token t; -} { - t = <STRING_LITERAL> { - return new LiteralExpressionNode(stripQuotes(t.image), CharArrayType.INSTANCE); - } - | t = <INTEGER_LITERAL> { - return new LiteralExpressionNode(t.image, IntegerType.INSTANCE); - } - | t = <DOUBLE_LITERAL> { - return new LiteralExpressionNode(t.image, DoubleType.INSTANCE); - } -} - -ExpressionNode FieldAccess(): { - String relName = null; - Token fieldName; -} { - (relName = Alias() ".")? fieldName = <IDENTIFIER> { - return new FieldAccessExpressionNode(relName, fieldName.image); - } -} - -<DEFAULT> -TOKEN : { - <STRING_LITERAL: (("\"" (~["\"", "\n"])* "\"") | ("'" (~["'", "\n"])* "'"))> - | <IDENTIFIER: <Letter> (<Letter> | <Digit> | <Extender>)*> - | <INTEGER_LITERAL: (<Digit>)+> - | <DOUBLE_LITERAL: (((<Digit>)* "." (<Digit>)+ (<Exponent>)?) | (<INTEGER_LITERAL> <Exponent>))> - | <INDEXED_FIELD: ("$" <INTEGER_LITERAL>)> -} - -TOKEN : -{ - < #Exponent : ((["+", "-"])? ["E", "e"] <INTEGER_LITERAL>)> -} - -SPECIAL_TOKEN : -{ - < WhitespaceChar : ["\t", "\r", "\n", " "] > -} - -TOKEN : -{ - < #Letter : (<BaseChar> | <Ideographic>) > -} - -TOKEN : -{ - < #BaseChar : ["\u0041" - "\u005a", "\u0061" - "\u007a", "\u00c0" - "\u00d6", "\u00d8" - "\u00f6", "\u00f8" - "\u00ff", "\u0100" - "\u0131", "\u0134" - "\u013e", "\u0141" - "\u0148", "\u014a" - "\u017e", "\u0180" - "\u01c3", "\u01cd" - "\u01f0", "\u01f4" - "\u01f5", "\u01fa" - "\u0217", "\u0250" - "\u02a8", "\u02bb" - "\u02c1", "\u0386", "\u0388" - "\u038a", "\u038c", "\u038e" - "\u03a1", "\u03a3" - "\u03ce", "\u03d0" - "\u03d6", "\u03da", "\u03dc", "\u03de", "\u03e0", "\u03e2" - "\u03f3", "\u0401" - "\u040c", "\u040e" - "\u044f", "\u0451" - "\u045c", "\u045e" - "\u0481", "\u0490" - "\u04c4", "\u04c7" - "\u04c8", "\u04cb" - "\u04cc", "\u04d0" - "\u04eb", "\u04ee" - "\u04f5", "\u04f8" - "\u04f9", "\u0531" - "\u0556", "\u0559", "\u0561" - "\u0586", "\u05d0" - "\u05ea", "\u05f0" - "\u05f2", "\u0621" - "\u063a", "\u0641" - "\u064a", "\u0671" - "\u06b7", "\u06ba" - "\u06be", "\u06c0" - "\u06ce", "\u06d0" - "\u06d3", "\u06d5", "\u06e5" - "\u06e6", "\u0905" - "\u0939", "\u093d", "\u0958" - "\u0961", "\u0985" - "\u098c", "\u098f" - "\u0990", "\u0993" - "\u09a8", "\u09aa" - "\u09b0", "\u09b2", "\u09b6" - "\u09b9", "\u09dc" - "\u09dd", "\u09df" - "\u09e1", "\u09f0" - "\u09f1", "\u0a05" - "\u0a0a", "\u0a0f" - "\u0a10", "\u0a13" - "\u0a28", "\u0a2a" - "\u0a30", "\u0a32" - "\u0a33", "\u0a35" - "\u0a36", "\u0a38" - "\u0a39", "\u0a59" - "\u0a5c", "\u0a5e", "\u0a72" - "\u0a74", "\u0a85" - "\u0a8b", "\u0a8d", "\u0a8f" - "\u0a91", "\u0a93" - "\u0aa8", "\u0aaa" - "\u0ab0", "\u0ab2" - "\u0ab3", "\u0ab5" - "\u0ab9", "\u0abd", "\u0ae0", "\u0b05" - "\u0b0c", "\u0b0f" - "\u0b10", "\u0b13" - "\u0b28", "\u0b2a" - "\u0b30", "\u0b32" - "\u0b33", "\u0b36" - "\u0b39", "\u0b3d", "\u0b5c" - "\u0b5d", "\u0b5f" - "\u0b61", "\u0b85" - "\u0b8a", "\u0b8e" - "\u0b90", "\u0b92" - "\u0b95", "\u0b99" - "\u0b9a", "\u0b9c", "\u0b9e" - "\u0b9f", "\u0ba3" - "\u0ba4", "\u0ba8" - "\u0baa", "\u0bae" - "\u0bb5", "\u0bb7" - "\u0bb9", "\u0c05" - "\u0c0c", "\u0c0e" - "\u0c10", "\u0c12" - "\u0c28", "\u0c2a" - " \u0c33", "\u0c35" - "\u0c39", "\u0c60" - "\u0c61", "\u0c85" - "\u0c8c", "\u0c8e" - "\u0c90", "\u0c92" - "\u0ca8", "\u0caa" - "\u0cb3", "\u0cb5" - "\u0cb9", "\u0cde", "\u0ce0" - "\u0ce1", "\u0d05" - "\u0d0c", "\u0d0e" - "\u0d10", "\u0d12" - "\u0d28", "\u0d2a" - "\u0d39", "\u0d60" - "\u0d61", "\u0e01" - "\u0e2e", "\u0e30", "\u0e32" - "\u0e33", "\u0e40" - "\u0e45", "\u0e81" - "\u0e82", "\u0e84", "\u0e87" - "\u0e88", "\u0e8a", "\u0e8d", "\u0e94" - "\u0e97", "\u0e99" - "\u0e9f", "\u0ea1" - "\u0ea3", "\u0ea5", "\u0ea7", "\u0eaa" - "\u0eab", "\u0ead" - "\u0eae", "\u0eb0", "\u0eb2" - "\u0eb3", "\u0ebd", "\u0ec0" - "\u0ec4", "\u0f40" - "\u0f47", "\u0f49" - "\u0f69", "\u10a0" - "\u10c5", "\u10d0" - "\u10f6", "\u1100", "\u1102" - "\u1103", "\u1105" - "\u1107", "\u1109", "\u110b" - "\u110c", "\u110e" - "\u1112", "\u113c", "\u113e", "\u1140", "\u114c", "\u114e", "\u1150", "\u1154" - "\u1155", "\u1159", "\u115f" - "\u1161", "\u1163", "\u1165", "\u1167", "\u1169", "\u116d" - "\u116e", "\u1172" - " \u1173", "\u1175", "\u119e", "\u11a8", "\u11ab", "\u11ae" - "\u11af", "\u11b7" - "\u11b8", "\u11ba", "\u11bc" - "\u11c2", "\u11eb", "\u11f0", "\u11f9", "\u1e00" - "\u1e9b", "\u1ea0" - "\u1ef9", "\u1f00" - "\u1f15", "\u1f18" - "\u1f1d", "\u1f20" - "\u1f45", "\u1f48" - "\u1f4d", "\u1f50" - "\u1f57", "\u1f59", "\u1f5b", "\u1f5d", "\u1f5f" - "\u1f7d", "\u1f80" - "\u1fb4", "\u1fb6" - "\u1fbc", "\u1fbe", "\u1fc2" - "\u1fc4", "\u1fc6" - "\u1fcc", "\u1fd0" - "\u1fd3", "\u1fd6" - "\u1fdb", "\u1fe0" - "\u1fec", "\u1ff2" - "\u1ff4", "\u1ff6" - "\u1ffc", "\u2126", "\u212a" - "\u212b", "\u212e", "\u2180" - "\u2182", "\u3041" - "\u3094", "\u30a1" - "\u30fa", "\u3105" - "\u312c", "\uac00" - "\ud7a3"] > -} - -TOKEN : -{ - < #Ideographic : ["\u4e00" - "\u9fa5", "\u3007", "\u3021" - "\u3029"] > -} - -TOKEN : -{ - < #CombiningChar : ["\u0300" - "\u0345", "\u0360" - "\u0361", "\u0483" - "\u0486", "\u0591" - "\u05a1", "\u05a3" - "\u05b9", "\u05bb" - "\u05bd", "\u05bf", "\u05c1" - "\u05c2", "\u05c4", "\u064b" - "\u0652", "\u0670", "\u06d6" - "\u06dc", "\u06dd" - "\u06df", "\u06e0" - "\u06e4", "\u06e7" - "\u06e8", "\u06ea" - "\u06ed", "\u0901" - "\u0903", "\u093c", "\u093e" - "\u094c", "\u094d", "\u0951" - "\u0954", "\u0962" - "\u0963", "\u0981" - "\u0983", "\u09bc", "\u09be", "\u09bf", "\u09c0" - "\u09c4", "\u09c7" - "\u09c8", "\u09cb" - "\u09cd", "\u09d7", "\u09e2" - "\u09e3", "\u0a02", "\u0a3c", "\u0a3e", "\u0a3f", "\u0a40" - "\u0a42", "\u0a47" - "\u0a48", "\u0a4b" - "\u0a4d", "\u0a70" - "\u0a71", "\u0a81" - "\u0a83", "\u0abc", "\u0abe" - "\u0ac5", "\u0ac7" - "\u0ac9", "\u0acb" - "\u0acd", "\u0b01" - "\u0b03", "\u0b3c", "\u0b3e" - "\u0b43", "\u0b47" - "\u0b48", "\u0b4b" - "\u0b4d", "\u0b56" - "\u0b57", "\u0b82" - "\u0b83", "\u0bbe" - "\u0bc2", "\u0bc6" - "\u0bc8", "\u0bca" - "\u0bcd", "\u0bd7 ", "\u0c01" - "\u0c03", "\u0c3e" - "\u0c44", "\u0c46" - "\u0c48", "\u0c4a" - "\u0c4d", "\u0c55" - "\u0c56", "\u0c82" - "\u0c83", "\u0cbe" - "\u0cc4", "\u0cc6" - "\u0cc8", "\u0cca" - "\u0ccd", "\u0cd5" - "\u0cd6", "\u0d02" - "\u0d03", "\u0d3e" - "\u0d43", "\u0d46" - "\u0d48", "\u0d4a" - "\u0d4d", "\u0d57", "\u0e31", "\u0e34" - "\u0e3a", "\u0e47" - "\u0e4e", "\u0eb1", "\u0eb4" - "\u0eb9", "\u0ebb" - "\u0ebc", "\u0ec8" - "\u0ecd", "\u0f18" - "\u0f19", "\u0f35", "\u0f37", "\u0f39", "\u0f3e", "\u0f3f", "\u0f71" - "\u0f84", "\u0f86" - "\u0f8b", "\u0f90" - "\u0f95", "\u0f97", "\u0f99" - "\u0fad", "\u0fb1" - "\u0fb7", "\u0fb9", "\u20d0" - "\u20dc", "\u20e1", "\u302a" - "\u302f", "\u3099", "\u309a"] > -} - -TOKEN : -{ - < #Digit : ["\u0030" - "\u0039", "\u0660" - "\u0669", "\u06f0" - "\u06f9", "\u0966" - "\u096f", "\u09e6" - "\u09ef", "\u0a66" - "\u0a6f", "\u0ae6" - "\u0aef", "\u0b66" - "\u0b6f", "\u0be7" - "\u0bef", "\u0c66" - "\u0c6f", "\u0ce6" - "\u0cef", "\u0d66" - "\u0d6f", "\u0e50" - "\u0e59", "\u0ed0" - "\u0ed9", "\u0f20" - "\u0f29"] > -} - -TOKEN : -{ - < #Extender : ["\u00b7", "\u02d0", "\u02d1", "\u0387", "\u0640", "\u0e46", "\u0ec6", "\u3005", "\u3031" - "\u3035", "\u309d" - "\u309e", "\u30fc" - "\u30fe"] > -} - -SKIP: -{ - <"--" (~["\n","\r"])* ("\n"|"\r"|"\r\n")?> -} http://git-wip-us.apache.org/repos/asf/asterixdb/blob/35b6c131/hyracks-fullstack/algebricks/algebricks-examples/piglet-example/src/test/java/org/apache/algebricks/examples/piglet/test/PigletTest.java ---------------------------------------------------------------------- diff --git a/hyracks-fullstack/algebricks/algebricks-examples/piglet-example/src/test/java/org/apache/algebricks/examples/piglet/test/PigletTest.java b/hyracks-fullstack/algebricks/algebricks-examples/piglet-example/src/test/java/org/apache/algebricks/examples/piglet/test/PigletTest.java deleted file mode 100644 index 4ea43a3..0000000 --- a/hyracks-fullstack/algebricks/algebricks-examples/piglet-example/src/test/java/org/apache/algebricks/examples/piglet/test/PigletTest.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.algebricks.examples.piglet.test; - -import java.io.File; - -import junit.framework.Test; -import junit.framework.TestSuite; - -public class PigletTest { - public static Test suite() { - TestSuite suite = new TestSuite(); - File dir = new File("testcases"); - findAndAddTests(suite, dir); - - return suite; - } - - private static void findAndAddTests(TestSuite suite, File dir) { - for (final File f : dir.listFiles()) { - if (f.getName().startsWith(".")) { - continue; - } - if (f.isDirectory()) { - findAndAddTests(suite, f); - } else if (f.getName().endsWith(".piglet")) { - suite.addTest(new PigletTestCase(f)); - } - } - } -} http://git-wip-us.apache.org/repos/asf/asterixdb/blob/35b6c131/hyracks-fullstack/algebricks/algebricks-examples/piglet-example/src/test/java/org/apache/algebricks/examples/piglet/test/PigletTestCase.java ---------------------------------------------------------------------- diff --git a/hyracks-fullstack/algebricks/algebricks-examples/piglet-example/src/test/java/org/apache/algebricks/examples/piglet/test/PigletTestCase.java b/hyracks-fullstack/algebricks/algebricks-examples/piglet-example/src/test/java/org/apache/algebricks/examples/piglet/test/PigletTestCase.java deleted file mode 100644 index 3964edc..0000000 --- a/hyracks-fullstack/algebricks/algebricks-examples/piglet-example/src/test/java/org/apache/algebricks/examples/piglet/test/PigletTestCase.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.algebricks.examples.piglet.test; - -import java.io.File; -import java.io.FileReader; -import java.util.List; - -import junit.framework.TestCase; - -import org.junit.Test; - -import org.apache.hyracks.algebricks.examples.piglet.ast.ASTNode; -import org.apache.hyracks.algebricks.examples.piglet.compiler.PigletCompiler; -import org.apache.hyracks.api.job.JobSpecification; - -public class PigletTestCase extends TestCase { - - private final File file; - - PigletTestCase(File file) { - super("testPiglet"); - this.file = file; - } - - @Test - public void testPiglet() { - try { - FileReader in = new FileReader(file); - try { - PigletCompiler c = new PigletCompiler(); - - List<ASTNode> ast = c.parse(in); - JobSpecification jobSpec = c.compile(ast); - - System.err.println(jobSpec.toJSON()); - } finally { - in.close(); - } - } catch (Exception e) { - throw new RuntimeException(e); - } - } -} http://git-wip-us.apache.org/repos/asf/asterixdb/blob/35b6c131/hyracks-fullstack/algebricks/algebricks-examples/piglet-example/testcases/q1.piglet ---------------------------------------------------------------------- diff --git a/hyracks-fullstack/algebricks/algebricks-examples/piglet-example/testcases/q1.piglet b/hyracks-fullstack/algebricks/algebricks-examples/piglet-example/testcases/q1.piglet deleted file mode 100644 index ff1806e..0000000 --- a/hyracks-fullstack/algebricks/algebricks-examples/piglet-example/testcases/q1.piglet +++ /dev/null @@ -1,19 +0,0 @@ --- Licensed to the Apache Software Foundation (ASF) under one --- or more contributor license agreements. See the NOTICE file --- distributed with this work for additional information --- regarding copyright ownership. The ASF licenses this file --- to you under the Apache License, Version 2.0 (the --- "License"); you may not use this file except in compliance --- with the License. You may obtain a copy of the License at --- --- http://www.apache.org/licenses/LICENSE-2.0 --- --- Unless required by applicable law or agreed to in writing, --- software distributed under the License is distributed on an --- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY --- KIND, either express or implied. See the License for the --- specific language governing permissions and limitations --- under the License. - -R = load "nc1:data/file1.txt,nc2:data/file2.txt" as (id : int, name : chararray); -dump R into "nc1:output"; http://git-wip-us.apache.org/repos/asf/asterixdb/blob/35b6c131/hyracks-fullstack/algebricks/algebricks-examples/piglet-example/testcases/q2.piglet ---------------------------------------------------------------------- diff --git a/hyracks-fullstack/algebricks/algebricks-examples/piglet-example/testcases/q2.piglet b/hyracks-fullstack/algebricks/algebricks-examples/piglet-example/testcases/q2.piglet deleted file mode 100644 index 0335b7d..0000000 --- a/hyracks-fullstack/algebricks/algebricks-examples/piglet-example/testcases/q2.piglet +++ /dev/null @@ -1,20 +0,0 @@ --- Licensed to the Apache Software Foundation (ASF) under one --- or more contributor license agreements. See the NOTICE file --- distributed with this work for additional information --- regarding copyright ownership. The ASF licenses this file --- to you under the Apache License, Version 2.0 (the --- "License"); you may not use this file except in compliance --- with the License. You may obtain a copy of the License at --- --- http://www.apache.org/licenses/LICENSE-2.0 --- --- Unless required by applicable law or agreed to in writing, --- software distributed under the License is distributed on an --- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY --- KIND, either express or implied. See the License for the --- specific language governing permissions and limitations --- under the License. - -R = load "nc1:data/file1.txt,nc2:data/file2.txt" as (id : int, name : chararray); -S = filter R by id == 5; -dump S into "nc1:output"; http://git-wip-us.apache.org/repos/asf/asterixdb/blob/35b6c131/hyracks-fullstack/algebricks/algebricks-examples/pom.xml ---------------------------------------------------------------------- diff --git a/hyracks-fullstack/algebricks/algebricks-examples/pom.xml b/hyracks-fullstack/algebricks/algebricks-examples/pom.xml deleted file mode 100644 index 299e76d..0000000 --- a/hyracks-fullstack/algebricks/algebricks-examples/pom.xml +++ /dev/null @@ -1,55 +0,0 @@ -<!-- - ! Licensed to the Apache Software Foundation (ASF) under one - ! or more contributor license agreements. See the NOTICE file - ! distributed with this work for additional information - ! regarding copyright ownership. The ASF licenses this file - ! to you under the Apache License, Version 2.0 (the - ! "License"); you may not use this file except in compliance - ! with the License. You may obtain a copy of the License at - ! - ! http://www.apache.org/licenses/LICENSE-2.0 - ! - ! Unless required by applicable law or agreed to in writing, - ! software distributed under the License is distributed on an - ! "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - ! KIND, either express or implied. See the License for the - ! specific language governing permissions and limitations - ! under the License. - !--> - -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> - <modelVersion>4.0.0</modelVersion> - <artifactId>algebricks-examples</artifactId> - <packaging>pom</packaging> - <name>algebricks-examples</name> - <dependencies> - <dependency> - <groupId>org.apache.hyracks</groupId> - <artifactId>algebricks-core</artifactId> - <version>${project.version}</version> - </dependency> - </dependencies> - - <parent> - <groupId>org.apache.hyracks</groupId> - <artifactId>algebricks</artifactId> - <version>0.3.3-SNAPSHOT</version> - </parent> - - <licenses> - <license> - <name>Apache License, Version 2.0</name> - <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url> - <distribution>repo</distribution> - <comments>A business-friendly OSS license</comments> - </license> - </licenses> - - <properties> - <root.dir>${basedir}/../..</root.dir> - </properties> - - <modules> - <module>piglet-example</module> - </modules> -</project> http://git-wip-us.apache.org/repos/asf/asterixdb/blob/35b6c131/hyracks-fullstack/algebricks/pom.xml ---------------------------------------------------------------------- diff --git a/hyracks-fullstack/algebricks/pom.xml b/hyracks-fullstack/algebricks/pom.xml index eecb010..274018d 100644 --- a/hyracks-fullstack/algebricks/pom.xml +++ b/hyracks-fullstack/algebricks/pom.xml @@ -50,6 +50,5 @@ <module>algebricks-runtime</module> <module>algebricks-rewriter</module> <module>algebricks-tests</module> - <module>algebricks-examples</module> </modules> </project>
