Repository: incubator-carbondata Updated Branches: refs/heads/master e30853975 -> 9302ff16d
removeUselessFiles Project: http://git-wip-us.apache.org/repos/asf/incubator-carbondata/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-carbondata/commit/6635bbeb Tree: http://git-wip-us.apache.org/repos/asf/incubator-carbondata/tree/6635bbeb Diff: http://git-wip-us.apache.org/repos/asf/incubator-carbondata/diff/6635bbeb Branch: refs/heads/master Commit: 6635bbebf4386b0762a348670b48991b82d1996a Parents: e3085397 Author: lion-x <xlion....@gmail.com> Authored: Thu Nov 3 16:04:48 2016 +0800 Committer: jackylk <jacky.li...@huawei.com> Committed: Fri Nov 11 23:35:14 2016 +0800 ---------------------------------------------------------------------- .../scan/expression/UnaryExpression.java | 33 -------- .../expression/arithmetic/AddExpression.java | 86 ------------------- .../arithmetic/BinaryArithmeticExpression.java | 34 -------- .../expression/arithmetic/DivideExpression.java | 86 ------------------- .../arithmetic/MultiplyExpression.java | 87 ------------------- .../arithmetic/SubstractExpression.java | 88 -------------------- .../scan/expression/logical/NotExpression.java | 60 ------------- 7 files changed, 474 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/6635bbeb/core/src/main/java/org/apache/carbondata/scan/expression/UnaryExpression.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/carbondata/scan/expression/UnaryExpression.java b/core/src/main/java/org/apache/carbondata/scan/expression/UnaryExpression.java deleted file mode 100644 index 64be9a5..0000000 --- a/core/src/main/java/org/apache/carbondata/scan/expression/UnaryExpression.java +++ /dev/null @@ -1,33 +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.carbondata.scan.expression; - -public abstract class UnaryExpression extends Expression { - - private static final long serialVersionUID = 1L; - protected Expression child; - - public UnaryExpression(Expression child) { - this.child = child; - children.add(child); - - } - -} http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/6635bbeb/core/src/main/java/org/apache/carbondata/scan/expression/arithmetic/AddExpression.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/carbondata/scan/expression/arithmetic/AddExpression.java b/core/src/main/java/org/apache/carbondata/scan/expression/arithmetic/AddExpression.java deleted file mode 100644 index e5dcc21..0000000 --- a/core/src/main/java/org/apache/carbondata/scan/expression/arithmetic/AddExpression.java +++ /dev/null @@ -1,86 +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.carbondata.scan.expression.arithmetic; - -import org.apache.carbondata.core.carbon.metadata.datatype.DataType; -import org.apache.carbondata.scan.expression.Expression; -import org.apache.carbondata.scan.expression.ExpressionResult; -import org.apache.carbondata.scan.expression.exception.FilterIllegalMemberException; -import org.apache.carbondata.scan.expression.exception.FilterUnsupportedException; -import org.apache.carbondata.scan.filter.intf.ExpressionType; -import org.apache.carbondata.scan.filter.intf.RowIntf; - -public class AddExpression extends BinaryArithmeticExpression { - private static final long serialVersionUID = 7999436055420911612L; - - public AddExpression(Expression left, Expression right) { - super(left, right); - } - - @Override public ExpressionResult evaluate(RowIntf value) - throws FilterUnsupportedException, FilterIllegalMemberException { - ExpressionResult addExprLeftRes = left.evaluate(value); - ExpressionResult addExprRightRes = right.evaluate(value); - ExpressionResult val1 = addExprLeftRes; - ExpressionResult val2 = addExprRightRes; - if (addExprLeftRes.isNull() || addExprRightRes.isNull()) { - addExprLeftRes.set(addExprLeftRes.getDataType(), null); - return addExprLeftRes; - } - - if (addExprLeftRes.getDataType() != addExprRightRes.getDataType()) { - if (addExprLeftRes.getDataType().getPrecedenceOrder() < addExprRightRes.getDataType() - .getPrecedenceOrder()) { - val2 = addExprLeftRes; - val1 = addExprRightRes; - } - } - switch (val1.getDataType()) { - case STRING: - case DOUBLE: - addExprRightRes.set(DataType.DOUBLE, val1.getDouble() + val2.getDouble()); - break; - case SHORT: - addExprRightRes.set(DataType.SHORT, val1.getShort() + val2.getShort()); - break; - case INT: - addExprRightRes.set(DataType.INT, val1.getInt() + val2.getInt()); - break; - case LONG: - addExprRightRes.set(DataType.LONG, val1.getLong() + val2.getLong()); - break; - case DECIMAL: - addExprRightRes.set(DataType.DECIMAL, val1.getDecimal().add(val2.getDecimal())); - break; - default: - throw new FilterUnsupportedException( - "Incompatible datatype for applying Add Expression Filter " + val1.getDataType()); - } - return addExprRightRes; - } - - @Override public ExpressionType getFilterExpressionType() { - return ExpressionType.ADD; - } - - @Override public String getString() { - return "Add(" + left.getString() + ',' + right.getString() + ','; - } -} http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/6635bbeb/core/src/main/java/org/apache/carbondata/scan/expression/arithmetic/BinaryArithmeticExpression.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/carbondata/scan/expression/arithmetic/BinaryArithmeticExpression.java b/core/src/main/java/org/apache/carbondata/scan/expression/arithmetic/BinaryArithmeticExpression.java deleted file mode 100644 index 3ccd92e..0000000 --- a/core/src/main/java/org/apache/carbondata/scan/expression/arithmetic/BinaryArithmeticExpression.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.carbondata.scan.expression.arithmetic; - -import org.apache.carbondata.scan.expression.BinaryExpression; -import org.apache.carbondata.scan.expression.Expression; - -public abstract class BinaryArithmeticExpression extends BinaryExpression { - - private static final long serialVersionUID = 1L; - - public BinaryArithmeticExpression(Expression left, Expression right) { - super(left, right); - // TODO Auto-generated constructor stub - } - -} http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/6635bbeb/core/src/main/java/org/apache/carbondata/scan/expression/arithmetic/DivideExpression.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/carbondata/scan/expression/arithmetic/DivideExpression.java b/core/src/main/java/org/apache/carbondata/scan/expression/arithmetic/DivideExpression.java deleted file mode 100644 index 4525681..0000000 --- a/core/src/main/java/org/apache/carbondata/scan/expression/arithmetic/DivideExpression.java +++ /dev/null @@ -1,86 +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.carbondata.scan.expression.arithmetic; - -import org.apache.carbondata.core.carbon.metadata.datatype.DataType; -import org.apache.carbondata.scan.expression.Expression; -import org.apache.carbondata.scan.expression.ExpressionResult; -import org.apache.carbondata.scan.expression.exception.FilterIllegalMemberException; -import org.apache.carbondata.scan.expression.exception.FilterUnsupportedException; -import org.apache.carbondata.scan.filter.intf.ExpressionType; -import org.apache.carbondata.scan.filter.intf.RowIntf; - -public class DivideExpression extends BinaryArithmeticExpression { - private static final long serialVersionUID = -7269266926782365612L; - - public DivideExpression(Expression left, Expression right) { - super(left, right); - } - - @Override public ExpressionResult evaluate(RowIntf value) - throws FilterUnsupportedException, FilterIllegalMemberException { - ExpressionResult divideExprLeftRes = left.evaluate(value); - ExpressionResult divideExprRightRes = right.evaluate(value); - ExpressionResult val1 = divideExprLeftRes; - ExpressionResult val2 = divideExprRightRes; - if (divideExprLeftRes.isNull() || divideExprRightRes.isNull()) { - divideExprLeftRes.set(divideExprLeftRes.getDataType(), null); - return divideExprLeftRes; - } - if (divideExprLeftRes.getDataType() != divideExprRightRes.getDataType()) { - if (divideExprLeftRes.getDataType().getPrecedenceOrder() < divideExprRightRes.getDataType() - .getPrecedenceOrder()) { - val2 = divideExprLeftRes; - val1 = divideExprRightRes; - } - } - switch (val1.getDataType()) { - case STRING: - case DOUBLE: - divideExprRightRes.set(DataType.DOUBLE, val1.getDouble() / val2.getDouble()); - break; - case SHORT: - divideExprRightRes.set(DataType.SHORT, val1.getShort() / val2.getShort()); - break; - case INT: - divideExprRightRes.set(DataType.INT, val1.getInt() / val2.getInt()); - break; - case LONG: - divideExprRightRes.set(DataType.LONG, val1.getLong() / val2.getLong()); - break; - case DECIMAL: - divideExprRightRes.set(DataType.DECIMAL, val1.getDecimal().divide(val2.getDecimal())); - break; - default: - throw new FilterUnsupportedException( - "Incompatible datatype for applying Add Expression Filter " + divideExprLeftRes - .getDataType()); - } - return divideExprRightRes; - } - - @Override public ExpressionType getFilterExpressionType() { - return ExpressionType.DIVIDE; - } - - @Override public String getString() { - return "Divide(" + left.getString() + ',' + right.getString() + ')'; - } -} http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/6635bbeb/core/src/main/java/org/apache/carbondata/scan/expression/arithmetic/MultiplyExpression.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/carbondata/scan/expression/arithmetic/MultiplyExpression.java b/core/src/main/java/org/apache/carbondata/scan/expression/arithmetic/MultiplyExpression.java deleted file mode 100644 index d110acd..0000000 --- a/core/src/main/java/org/apache/carbondata/scan/expression/arithmetic/MultiplyExpression.java +++ /dev/null @@ -1,87 +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.carbondata.scan.expression.arithmetic; - -import org.apache.carbondata.core.carbon.metadata.datatype.DataType; -import org.apache.carbondata.scan.expression.Expression; -import org.apache.carbondata.scan.expression.ExpressionResult; -import org.apache.carbondata.scan.expression.exception.FilterIllegalMemberException; -import org.apache.carbondata.scan.expression.exception.FilterUnsupportedException; -import org.apache.carbondata.scan.filter.intf.ExpressionType; -import org.apache.carbondata.scan.filter.intf.RowIntf; - -public class MultiplyExpression extends BinaryArithmeticExpression { - private static final long serialVersionUID = 1L; - - public MultiplyExpression(Expression left, Expression right) { - super(left, right); - } - - @Override public ExpressionResult evaluate(RowIntf value) - throws FilterUnsupportedException, FilterIllegalMemberException { - ExpressionResult multiplyExprLeftRes = left.evaluate(value); - ExpressionResult multiplyExprRightRes = right.evaluate(value); - ExpressionResult val1 = multiplyExprLeftRes; - ExpressionResult val2 = multiplyExprRightRes; - if (multiplyExprLeftRes.isNull() || multiplyExprRightRes.isNull()) { - multiplyExprLeftRes.set(multiplyExprLeftRes.getDataType(), null); - return multiplyExprLeftRes; - } - - if (multiplyExprLeftRes.getDataType() != multiplyExprRightRes.getDataType()) { - if (multiplyExprLeftRes.getDataType().getPrecedenceOrder() < multiplyExprRightRes - .getDataType().getPrecedenceOrder()) { - val2 = multiplyExprLeftRes; - val1 = multiplyExprRightRes; - } - } - switch (val1.getDataType()) { - case STRING: - case DOUBLE: - multiplyExprRightRes.set(DataType.DOUBLE, val1.getDouble() * val2.getDouble()); - break; - case SHORT: - multiplyExprRightRes.set(DataType.SHORT, val1.getShort() * val2.getShort()); - break; - case INT: - multiplyExprRightRes.set(DataType.INT, val1.getInt() * val2.getInt()); - break; - case LONG: - multiplyExprRightRes.set(DataType.LONG, val1.getLong() * val2.getLong()); - break; - case DECIMAL: - multiplyExprRightRes.set(DataType.DECIMAL, val1.getDecimal().multiply(val2.getDecimal())); - break; - default: - throw new FilterUnsupportedException( - "Incompatible datatype for applying Add Expression Filter " + multiplyExprLeftRes - .getDataType()); - } - return multiplyExprRightRes; - } - - @Override public ExpressionType getFilterExpressionType() { - return ExpressionType.MULTIPLY; - } - - @Override public String getString() { - return "Substract(" + left.getString() + ',' + right.getString() + ')'; - } -} http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/6635bbeb/core/src/main/java/org/apache/carbondata/scan/expression/arithmetic/SubstractExpression.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/carbondata/scan/expression/arithmetic/SubstractExpression.java b/core/src/main/java/org/apache/carbondata/scan/expression/arithmetic/SubstractExpression.java deleted file mode 100644 index 5410f50..0000000 --- a/core/src/main/java/org/apache/carbondata/scan/expression/arithmetic/SubstractExpression.java +++ /dev/null @@ -1,88 +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.carbondata.scan.expression.arithmetic; - -import org.apache.carbondata.core.carbon.metadata.datatype.DataType; -import org.apache.carbondata.scan.expression.Expression; -import org.apache.carbondata.scan.expression.ExpressionResult; -import org.apache.carbondata.scan.expression.exception.FilterIllegalMemberException; -import org.apache.carbondata.scan.expression.exception.FilterUnsupportedException; -import org.apache.carbondata.scan.filter.intf.ExpressionType; -import org.apache.carbondata.scan.filter.intf.RowIntf; - -public class SubstractExpression extends BinaryArithmeticExpression { - - private static final long serialVersionUID = -8304726440185363102L; - - public SubstractExpression(Expression left, Expression right) { - super(left, right); - } - - @Override public ExpressionResult evaluate(RowIntf value) - throws FilterUnsupportedException, FilterIllegalMemberException { - ExpressionResult subtractExprLeftRes = left.evaluate(value); - ExpressionResult subtractExprRightRes = right.evaluate(value); - ExpressionResult val1 = subtractExprLeftRes; - ExpressionResult val2 = subtractExprRightRes; - if (subtractExprLeftRes.isNull() || subtractExprRightRes.isNull()) { - subtractExprLeftRes.set(subtractExprLeftRes.getDataType(), null); - return subtractExprLeftRes; - } - if (subtractExprLeftRes.getDataType() != subtractExprRightRes.getDataType()) { - if (subtractExprLeftRes.getDataType().getPrecedenceOrder() < subtractExprRightRes - .getDataType().getPrecedenceOrder()) { - val2 = subtractExprLeftRes; - val1 = subtractExprRightRes; - } - } - switch (val1.getDataType()) { - case STRING: - case DOUBLE: - subtractExprRightRes.set(DataType.DOUBLE, val1.getDouble() - val2.getDouble()); - break; - case SHORT: - subtractExprRightRes.set(DataType.SHORT, val1.getShort() - val2.getShort()); - break; - case INT: - subtractExprRightRes.set(DataType.INT, val1.getInt() - val2.getInt()); - break; - case LONG: - subtractExprRightRes.set(DataType.LONG, val1.getLong() - val2.getLong()); - break; - case DECIMAL: - subtractExprRightRes - .set(DataType.DECIMAL, val1.getDecimal().subtract(val2.getDecimal())); - break; - default: - throw new FilterUnsupportedException( - "Incompatible datatype for applying Add Expression Filter " + subtractExprLeftRes - .getDataType()); - } - return subtractExprRightRes; - } - - @Override public ExpressionType getFilterExpressionType() { - return ExpressionType.SUBSTRACT; - } - - @Override public String getString() { - return "Substract(" + left.getString() + ',' + right.getString() + ')'; - } -} http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/6635bbeb/core/src/main/java/org/apache/carbondata/scan/expression/logical/NotExpression.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/carbondata/scan/expression/logical/NotExpression.java b/core/src/main/java/org/apache/carbondata/scan/expression/logical/NotExpression.java deleted file mode 100644 index 2be732b..0000000 --- a/core/src/main/java/org/apache/carbondata/scan/expression/logical/NotExpression.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.carbondata.scan.expression.logical; - -import org.apache.carbondata.core.carbon.metadata.datatype.DataType; -import org.apache.carbondata.scan.expression.Expression; -import org.apache.carbondata.scan.expression.ExpressionResult; -import org.apache.carbondata.scan.expression.UnaryExpression; -import org.apache.carbondata.scan.expression.exception.FilterIllegalMemberException; -import org.apache.carbondata.scan.expression.exception.FilterUnsupportedException; -import org.apache.carbondata.scan.filter.intf.ExpressionType; -import org.apache.carbondata.scan.filter.intf.RowIntf; - -public class NotExpression extends UnaryExpression { - private static final long serialVersionUID = 1L; - - public NotExpression(Expression child) { - super(child); - } - - @Override public ExpressionResult evaluate(RowIntf value) - throws FilterIllegalMemberException, FilterUnsupportedException { - ExpressionResult expResult = child.evaluate(value); - expResult.set(DataType.BOOLEAN, !(expResult.getBoolean())); - switch (expResult.getDataType()) { - case BOOLEAN: - expResult.set(DataType.BOOLEAN, !(expResult.getBoolean())); - break; - default: - throw new FilterUnsupportedException( - "Incompatible datatype for applying NOT Expression Filter"); - } - return expResult; - } - - @Override public ExpressionType getFilterExpressionType() { - return ExpressionType.NOT; - } - - @Override public String getString() { - return "Not(" + child.getString() + ')'; - } -}