You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@carbondata.apache.org by ch...@apache.org on 2016/08/15 07:08:52 UTC
[07/52] [partial] incubator-carbondata git commit: Renamed packages
to org.apache.carbondata and fixed errors
http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/cd6a4ff3/core/src/main/java/org/carbondata/scan/expression/ExpressionResult.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/carbondata/scan/expression/ExpressionResult.java b/core/src/main/java/org/carbondata/scan/expression/ExpressionResult.java
deleted file mode 100644
index 0ad39f6..0000000
--- a/core/src/main/java/org/carbondata/scan/expression/ExpressionResult.java
+++ /dev/null
@@ -1,472 +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 additiona l 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.carbondata.scan.expression;
-
-import java.math.BigDecimal;
-import java.sql.Timestamp;
-import java.text.ParseException;
-import java.text.SimpleDateFormat;
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.List;
-
-import org.carbondata.core.carbon.metadata.datatype.DataType;
-import org.carbondata.core.constants.CarbonCommonConstants;
-import org.carbondata.core.util.CarbonProperties;
-import org.carbondata.scan.expression.exception.FilterIllegalMemberException;
-
-public class ExpressionResult implements Comparable<ExpressionResult> {
-
- private static final long serialVersionUID = 1L;
- protected DataType dataType;
-
- protected Object value;
-
- private List<ExpressionResult> expressionResults;
-
- public ExpressionResult(DataType dataType, Object value) {
- this.dataType = dataType;
- this.value = value;
- }
-
- public ExpressionResult(List<ExpressionResult> expressionResults) {
- this.expressionResults = expressionResults;
- }
-
- public void set(DataType dataType, Object value) {
- this.dataType = dataType;
- this.value = value;
- this.expressionResults = null;
- }
-
- public DataType getDataType() {
- return dataType;
- }
-
- //CHECKSTYLE:OFF Approval No:Approval-V1R2C10_009
- public Integer getInt() throws FilterIllegalMemberException {
- if (value == null) {
- return null;
- }
- try {
- switch (this.getDataType()) {
- case STRING:
- try {
- return Integer.parseInt(value.toString());
- } catch (NumberFormatException e) {
- throw new FilterIllegalMemberException(e);
- }
- case SHORT:
- return ((Short) value).intValue();
- case INT:
- case DOUBLE:
- if (value instanceof Double) {
- return ((Double) value).intValue();
- }
- return (Integer) value;
- case TIMESTAMP:
- if (value instanceof Timestamp) {
- return (int) (((Timestamp) value).getTime() % 1000);
- } else {
- return (Integer) value;
- }
- default:
- throw new FilterIllegalMemberException(
- "Cannot convert" + this.getDataType().name() + " to integer type value");
- }
-
- } catch (ClassCastException e) {
- throw new FilterIllegalMemberException(
- "Cannot convert" + this.getDataType().name() + " to Integer type value");
- }
- }
-
- public Short getShort() throws FilterIllegalMemberException {
- if (value == null) {
- return null;
- }
- try {
- switch (this.getDataType()) {
- case STRING:
- try {
- return Short.parseShort(value.toString());
- } catch (NumberFormatException e) {
- throw new FilterIllegalMemberException(e);
- }
- case SHORT:
- case INT:
- case DOUBLE:
-
- if (value instanceof Double) {
- return ((Double) value).shortValue();
- } else if (value instanceof Integer) {
- return ((Integer) value).shortValue();
- }
- return (Short) value;
-
- case TIMESTAMP:
-
- if (value instanceof Timestamp) {
- return (short) (((Timestamp) value).getTime() % 1000);
- } else {
- return (Short) value;
- }
-
- default:
- throw new FilterIllegalMemberException(
- "Cannot convert" + this.getDataType().name() + " to integer type value");
- }
-
- } catch (ClassCastException e) {
- throw new FilterIllegalMemberException(
- "Cannot convert" + this.getDataType().name() + " to Integer type value");
- }
- }
-
- public String getString() throws FilterIllegalMemberException {
- if (value == null) {
- return null;
- }
- try {
- switch (this.getDataType()) {
- case TIMESTAMP:
- SimpleDateFormat parser = new SimpleDateFormat(CarbonProperties.getInstance()
- .getProperty(CarbonCommonConstants.CARBON_TIMESTAMP_FORMAT,
- CarbonCommonConstants.CARBON_TIMESTAMP_DEFAULT_FORMAT));
- if (value instanceof Timestamp) {
- return parser.format((Timestamp) value);
- } else {
- return parser.format(new Timestamp((long) value / 1000));
- }
-
- default:
- return value.toString();
- }
- } catch (Exception e) {
- throw new FilterIllegalMemberException(
- "Cannot convert" + this.getDataType().name() + " to String type value");
- }
- }
-
- public Double getDouble() throws FilterIllegalMemberException {
- if (value == null) {
- return null;
- }
- try {
- switch (this.getDataType()) {
- case STRING:
- try {
- return Double.parseDouble(value.toString());
- } catch (NumberFormatException e) {
- throw new FilterIllegalMemberException(e);
- }
- case SHORT:
- return ((Short) value).doubleValue();
- case INT:
- return ((Integer) value).doubleValue();
- case LONG:
- return ((Long) value).doubleValue();
- case DOUBLE:
- return (Double) value;
- case TIMESTAMP:
- if (value instanceof Timestamp) {
- return (double) ((Timestamp) value).getTime() * 1000;
- } else {
- return (Double) (value);
- }
- default:
- throw new FilterIllegalMemberException(
- "Cannot convert" + this.getDataType().name() + " to double type value");
- }
- } catch (ClassCastException e) {
- throw new FilterIllegalMemberException(
- "Cannot convert" + this.getDataType().name() + " to Double type value");
- }
- }
- //CHECKSTYLE:ON
-
- public Long getLong() throws FilterIllegalMemberException {
- if (value == null) {
- return null;
- }
- try {
- switch (this.getDataType()) {
- case STRING:
- try {
- return Long.parseLong(value.toString());
- } catch (NumberFormatException e) {
- throw new FilterIllegalMemberException(e);
- }
- case SHORT:
- return ((Short) value).longValue();
- case INT:
- return (Long) value;
- case LONG:
- return (Long) value;
- case DOUBLE:
- return (Long) value;
- case TIMESTAMP:
- if (value instanceof Timestamp) {
- return 1000 * ((Timestamp) value).getTime();
- } else {
- return (Long) value;
- }
- default:
- throw new FilterIllegalMemberException(
- "Cannot convert" + this.getDataType().name() + " to Long type value");
- }
- } catch (ClassCastException e) {
- throw new FilterIllegalMemberException(
- "Cannot convert" + this.getDataType().name() + " to Long type value");
- }
-
- }
-
- //Add to judge for BigDecimal
- public BigDecimal getDecimal() throws FilterIllegalMemberException {
- if (value == null) {
- return null;
- }
- try {
- switch (this.getDataType()) {
- case STRING:
- try {
- return new BigDecimal(value.toString());
- } catch (NumberFormatException e) {
- throw new FilterIllegalMemberException(e);
- }
- case SHORT:
- return new BigDecimal((short) value);
- case INT:
- return new BigDecimal((int) value);
- case LONG:
- return new BigDecimal((long) value);
- case DOUBLE:
- return new BigDecimal(value.toString());
- case DECIMAL:
- return new BigDecimal(value.toString());
- case TIMESTAMP:
- if (value instanceof Timestamp) {
- return new BigDecimal(1000 * ((Timestamp) value).getTime());
- } else {
- return new BigDecimal((long) value);
- }
- default:
- throw new FilterIllegalMemberException(
- "Cannot convert" + this.getDataType().name() + " to Long type value");
- }
- } catch (ClassCastException e) {
- throw new FilterIllegalMemberException(
- "Cannot convert" + this.getDataType().name() + " to Long type value");
- }
-
- }
-
- public Long getTime() throws FilterIllegalMemberException {
- if (value == null) {
- return null;
- }
- try {
- switch (this.getDataType()) {
- case STRING:
- // Currently the query engine layer only supports yyyy-MM-dd HH:mm:ss date format
- // no matter in which format the data is been stored, so while retrieving the direct
- // surrogate value for filter member first it should be converted in date form as per
- // above format and needs to retrieve time stamp.
- SimpleDateFormat parser =
- new SimpleDateFormat(CarbonCommonConstants.CARBON_TIMESTAMP_DEFAULT_FORMAT);
- Date dateToStr;
- try {
- dateToStr = parser.parse(value.toString());
- return dateToStr.getTime() * 1000;
- } catch (ParseException e) {
- throw new FilterIllegalMemberException(
- "Cannot convert" + this.getDataType().name() + " to Time/Long type value");
- }
- case SHORT:
- return ((Short) value).longValue();
- case INT:
- case LONG:
- return (Long) value;
- case DOUBLE:
- return (Long) value;
- case TIMESTAMP:
- if (value instanceof Timestamp) {
- return ((Timestamp) value).getTime() * 1000;
- } else {
- return (Long) value;
- }
- default:
- throw new FilterIllegalMemberException(
- "Cannot convert" + this.getDataType().name() + " to Time/Long type value");
- }
- } catch (ClassCastException e) {
- throw new FilterIllegalMemberException(
- "Cannot convert" + this.getDataType().name() + " to Time/Long type value");
- }
-
- }
-
- public Boolean getBoolean() throws FilterIllegalMemberException {
- if (value == null) {
- return null;
- }
- try {
- switch (this.getDataType()) {
- case STRING:
- try {
- return Boolean.parseBoolean(value.toString());
- } catch (NumberFormatException e) {
- throw new FilterIllegalMemberException(e);
- }
-
- case BOOLEAN:
- return Boolean.parseBoolean(value.toString());
-
- default:
- throw new FilterIllegalMemberException(
- "Cannot convert" + this.getDataType().name() + " to boolean type value");
- }
- } catch (ClassCastException e) {
- throw new FilterIllegalMemberException(
- "Cannot convert" + this.getDataType().name() + " to Boolean type value");
- }
- }
-
- public List<ExpressionResult> getList() {
- if (null == expressionResults) {
- List<ExpressionResult> a = new ArrayList<ExpressionResult>(20);
- a.add(new ExpressionResult(dataType, value));
- return a;
- } else {
- return expressionResults;
- }
- }
-
- public List<String> getListAsString() throws FilterIllegalMemberException {
- List<String> evaluateResultListFinal = new ArrayList<String>(20);
- List<ExpressionResult> evaluateResultList = getList();
- for (ExpressionResult result : evaluateResultList) {
- if (result.getString() == null) {
- evaluateResultListFinal.add(CarbonCommonConstants.MEMBER_DEFAULT_VAL);
- continue;
- }
- evaluateResultListFinal.add(result.getString());
- }
- return evaluateResultListFinal;
- }
-
- @Override public int hashCode() {
- final int prime = 31;
- int result = 1;
- if (null != expressionResults) {
- result = prime * result + expressionResults.hashCode();
- } else if (null != value) {
- result = prime * result + value.toString().hashCode();
- } else {
- result = prime * result + "".hashCode();
- }
-
- return result;
- }
-
- @Override public boolean equals(Object obj) {
- if (!(obj instanceof ExpressionResult)) {
- return false;
- }
- if (this == obj) {
- return true;
- }
- if (getClass() != obj.getClass()) {
- return false;
- }
- ExpressionResult objToCompare = (ExpressionResult) obj;
- boolean result = false;
- if (this.value == objToCompare.value) {
- return true;
- }
- try {
- switch (this.getDataType()) {
- case STRING:
- result = this.getString().equals(objToCompare.getString());
- break;
- case SHORT:
- result = this.getShort().equals(objToCompare.getShort());
- break;
- case INT:
- result = this.getInt().equals(objToCompare.getInt());
- break;
- case LONG:
- case TIMESTAMP:
- result = this.getLong().equals(objToCompare.getLong());
- break;
- case DOUBLE:
- result = this.getDouble().equals(objToCompare.getDouble());
- break;
- case DECIMAL:
- result = this.getDecimal().equals(objToCompare.getDecimal());
- break;
- default:
- break;
- }
- } catch (FilterIllegalMemberException ex) {
- return false;
- }
-
- return result;
- }
-
- public boolean isNull() {
- return value == null;
- }
-
- @Override public int compareTo(ExpressionResult o) {
- try {
- switch (o.dataType) {
- case SHORT:
- case INT:
- case LONG:
- case DOUBLE:
- Double d1 = this.getDouble();
- Double d2 = o.getDouble();
- return d1.compareTo(d2);
- case DECIMAL:
- java.math.BigDecimal val1 = this.getDecimal();
- java.math.BigDecimal val2 = o.getDecimal();
- return val1.compareTo(val2);
- case TIMESTAMP:
- SimpleDateFormat parser = new SimpleDateFormat(CarbonProperties.getInstance()
- .getProperty(CarbonCommonConstants.CARBON_TIMESTAMP_FORMAT,
- CarbonCommonConstants.CARBON_TIMESTAMP_DEFAULT_FORMAT));
- Date date1 = null;
- Date date2 = null;
- date1 = parser.parse(this.getString());
- date2 = parser.parse(o.getString());
- return date1.compareTo(date2);
- case STRING:
- default:
- return this.getString().compareTo(o.getString());
- }
- } catch (Exception e) {
- return -1;
- }
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/cd6a4ff3/core/src/main/java/org/carbondata/scan/expression/LeafExpression.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/carbondata/scan/expression/LeafExpression.java b/core/src/main/java/org/carbondata/scan/expression/LeafExpression.java
deleted file mode 100644
index 2392910..0000000
--- a/core/src/main/java/org/carbondata/scan/expression/LeafExpression.java
+++ /dev/null
@@ -1,24 +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.carbondata.scan.expression;
-
-public abstract class LeafExpression extends Expression {
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/cd6a4ff3/core/src/main/java/org/carbondata/scan/expression/LiteralExpression.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/carbondata/scan/expression/LiteralExpression.java b/core/src/main/java/org/carbondata/scan/expression/LiteralExpression.java
deleted file mode 100644
index cd48c4c..0000000
--- a/core/src/main/java/org/carbondata/scan/expression/LiteralExpression.java
+++ /dev/null
@@ -1,69 +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.carbondata.scan.expression;
-
-import org.carbondata.core.carbon.metadata.datatype.DataType;
-import org.carbondata.scan.filter.intf.ExpressionType;
-import org.carbondata.scan.filter.intf.RowIntf;
-
-public class LiteralExpression extends LeafExpression {
-
- /**
- *
- */
- private static final long serialVersionUID = 1L;
- private Object value;
- private DataType dataType;
-
- public LiteralExpression(Object value, DataType dataType) {
- this.value = value;
- this.dataType = dataType;
- }
-
- @Override public ExpressionResult evaluate(RowIntf value) {
- ExpressionResult expressionResult = new ExpressionResult(dataType, this.value);
- return expressionResult;
- }
-
- public ExpressionResult getExpressionResult() {
- ExpressionResult expressionResult = new ExpressionResult(dataType, this.value);
- return expressionResult;
- }
-
- @Override public ExpressionType getFilterExpressionType() {
- // TODO Auto-generated method stub
- return ExpressionType.LITERAL;
- }
-
- @Override public String getString() {
- // TODO Auto-generated method stub
- return "LiteralExpression(" + value + ')';
- }
-
- /**
- * getLiteralExpDataType.
- *
- * @return
- */
- public DataType getLiteralExpDataType() {
- return dataType;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/cd6a4ff3/core/src/main/java/org/carbondata/scan/expression/UnaryExpression.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/carbondata/scan/expression/UnaryExpression.java b/core/src/main/java/org/carbondata/scan/expression/UnaryExpression.java
deleted file mode 100644
index 0449b66..0000000
--- a/core/src/main/java/org/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.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/cd6a4ff3/core/src/main/java/org/carbondata/scan/expression/UnknownExpression.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/carbondata/scan/expression/UnknownExpression.java b/core/src/main/java/org/carbondata/scan/expression/UnknownExpression.java
deleted file mode 100644
index 42624b1..0000000
--- a/core/src/main/java/org/carbondata/scan/expression/UnknownExpression.java
+++ /dev/null
@@ -1,28 +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.carbondata.scan.expression;
-
-import java.util.List;
-
-public abstract class UnknownExpression extends Expression {
-
- public abstract List<ColumnExpression> getAllColumnList();
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/cd6a4ff3/core/src/main/java/org/carbondata/scan/expression/arithmetic/AddExpression.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/carbondata/scan/expression/arithmetic/AddExpression.java b/core/src/main/java/org/carbondata/scan/expression/arithmetic/AddExpression.java
deleted file mode 100644
index 589e2c3..0000000
--- a/core/src/main/java/org/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.carbondata.scan.expression.arithmetic;
-
-import org.carbondata.core.carbon.metadata.datatype.DataType;
-import org.carbondata.scan.expression.Expression;
-import org.carbondata.scan.expression.ExpressionResult;
-import org.carbondata.scan.expression.exception.FilterIllegalMemberException;
-import org.carbondata.scan.expression.exception.FilterUnsupportedException;
-import org.carbondata.scan.filter.intf.ExpressionType;
-import org.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().getPresedenceOrder() < addExprRightRes.getDataType()
- .getPresedenceOrder()) {
- 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/cd6a4ff3/core/src/main/java/org/carbondata/scan/expression/arithmetic/BinaryArithmeticExpression.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/carbondata/scan/expression/arithmetic/BinaryArithmeticExpression.java b/core/src/main/java/org/carbondata/scan/expression/arithmetic/BinaryArithmeticExpression.java
deleted file mode 100644
index 9c109f7..0000000
--- a/core/src/main/java/org/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.carbondata.scan.expression.arithmetic;
-
-import org.carbondata.scan.expression.BinaryExpression;
-import org.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/cd6a4ff3/core/src/main/java/org/carbondata/scan/expression/arithmetic/DivideExpression.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/carbondata/scan/expression/arithmetic/DivideExpression.java b/core/src/main/java/org/carbondata/scan/expression/arithmetic/DivideExpression.java
deleted file mode 100644
index e41bee4..0000000
--- a/core/src/main/java/org/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.carbondata.scan.expression.arithmetic;
-
-import org.carbondata.core.carbon.metadata.datatype.DataType;
-import org.carbondata.scan.expression.Expression;
-import org.carbondata.scan.expression.ExpressionResult;
-import org.carbondata.scan.expression.exception.FilterIllegalMemberException;
-import org.carbondata.scan.expression.exception.FilterUnsupportedException;
-import org.carbondata.scan.filter.intf.ExpressionType;
-import org.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().getPresedenceOrder() < divideExprRightRes.getDataType()
- .getPresedenceOrder()) {
- 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/cd6a4ff3/core/src/main/java/org/carbondata/scan/expression/arithmetic/MultiplyExpression.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/carbondata/scan/expression/arithmetic/MultiplyExpression.java b/core/src/main/java/org/carbondata/scan/expression/arithmetic/MultiplyExpression.java
deleted file mode 100644
index 7c790d8..0000000
--- a/core/src/main/java/org/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.carbondata.scan.expression.arithmetic;
-
-import org.carbondata.core.carbon.metadata.datatype.DataType;
-import org.carbondata.scan.expression.Expression;
-import org.carbondata.scan.expression.ExpressionResult;
-import org.carbondata.scan.expression.exception.FilterIllegalMemberException;
-import org.carbondata.scan.expression.exception.FilterUnsupportedException;
-import org.carbondata.scan.filter.intf.ExpressionType;
-import org.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().getPresedenceOrder() < multiplyExprRightRes
- .getDataType().getPresedenceOrder()) {
- 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/cd6a4ff3/core/src/main/java/org/carbondata/scan/expression/arithmetic/SubstractExpression.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/carbondata/scan/expression/arithmetic/SubstractExpression.java b/core/src/main/java/org/carbondata/scan/expression/arithmetic/SubstractExpression.java
deleted file mode 100644
index 682b725..0000000
--- a/core/src/main/java/org/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.carbondata.scan.expression.arithmetic;
-
-import org.carbondata.core.carbon.metadata.datatype.DataType;
-import org.carbondata.scan.expression.Expression;
-import org.carbondata.scan.expression.ExpressionResult;
-import org.carbondata.scan.expression.exception.FilterIllegalMemberException;
-import org.carbondata.scan.expression.exception.FilterUnsupportedException;
-import org.carbondata.scan.filter.intf.ExpressionType;
-import org.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().getPresedenceOrder() < subtractExprRightRes
- .getDataType().getPresedenceOrder()) {
- 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/cd6a4ff3/core/src/main/java/org/carbondata/scan/expression/conditional/BinaryConditionalExpression.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/carbondata/scan/expression/conditional/BinaryConditionalExpression.java b/core/src/main/java/org/carbondata/scan/expression/conditional/BinaryConditionalExpression.java
deleted file mode 100644
index 0c74ebf..0000000
--- a/core/src/main/java/org/carbondata/scan/expression/conditional/BinaryConditionalExpression.java
+++ /dev/null
@@ -1,37 +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.carbondata.scan.expression.conditional;
-
-import org.carbondata.scan.expression.Expression;
-import org.carbondata.scan.expression.logical.BinaryLogicalExpression;
-
-public abstract class BinaryConditionalExpression extends BinaryLogicalExpression
- implements ConditionalExpression {
-
- /**
- *
- */
- private static final long serialVersionUID = 1L;
-
- public BinaryConditionalExpression(Expression left, Expression right) {
- super(left, right);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/cd6a4ff3/core/src/main/java/org/carbondata/scan/expression/conditional/ConditionalExpression.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/carbondata/scan/expression/conditional/ConditionalExpression.java b/core/src/main/java/org/carbondata/scan/expression/conditional/ConditionalExpression.java
deleted file mode 100644
index d9ed78f..0000000
--- a/core/src/main/java/org/carbondata/scan/expression/conditional/ConditionalExpression.java
+++ /dev/null
@@ -1,43 +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.carbondata.scan.expression.conditional;
-
-import java.util.List;
-
-import org.carbondata.scan.expression.ColumnExpression;
-import org.carbondata.scan.expression.ExpressionResult;
-
-public interface ConditionalExpression {
-
- // Will get the column informations involved in the expressions by
- // traversing the tree
- List<ColumnExpression> getColumnList();
-
- boolean isSingleDimension();
-
- List<ExpressionResult> getLiterals();
-
- /**
- * will return the flag of direct dictionary column
- *
- * @return
- */
- boolean isDirectDictionaryColumns();
-}
http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/cd6a4ff3/core/src/main/java/org/carbondata/scan/expression/conditional/EqualToExpression.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/carbondata/scan/expression/conditional/EqualToExpression.java b/core/src/main/java/org/carbondata/scan/expression/conditional/EqualToExpression.java
deleted file mode 100644
index 30b1916..0000000
--- a/core/src/main/java/org/carbondata/scan/expression/conditional/EqualToExpression.java
+++ /dev/null
@@ -1,108 +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.carbondata.scan.expression.conditional;
-
-import org.carbondata.core.carbon.metadata.datatype.DataType;
-import org.carbondata.scan.expression.Expression;
-import org.carbondata.scan.expression.ExpressionResult;
-import org.carbondata.scan.expression.exception.FilterIllegalMemberException;
-import org.carbondata.scan.expression.exception.FilterUnsupportedException;
-import org.carbondata.scan.filter.intf.ExpressionType;
-import org.carbondata.scan.filter.intf.RowIntf;
-
-public class EqualToExpression extends BinaryConditionalExpression {
-
- private static final long serialVersionUID = 1L;
- private boolean isNull;
-
- public EqualToExpression(Expression left, Expression right) {
- super(left, right);
- }
-
- public EqualToExpression(Expression left, Expression right, boolean isNull) {
- super(left, right);
- this.isNull = isNull;
- }
-
- @Override public ExpressionResult evaluate(RowIntf value)
- throws FilterUnsupportedException, FilterIllegalMemberException {
- ExpressionResult elRes = left.evaluate(value);
- ExpressionResult erRes = right.evaluate(value);
-
- boolean result = false;
-
- ExpressionResult val1 = elRes;
- ExpressionResult val2 = erRes;
-
- if (elRes.isNull() || erRes.isNull()) {
- if (isNull) {
- elRes.set(DataType.BOOLEAN, elRes.isNull() == erRes.isNull());
- } else {
- elRes.set(DataType.BOOLEAN, false);
- }
- return elRes;
- }
- //default implementation if the data types are different for the resultsets
- if (elRes.getDataType() != erRes.getDataType()) {
- if (elRes.getDataType().getPresedenceOrder() < erRes.getDataType().getPresedenceOrder()) {
- val2 = elRes;
- val1 = erRes;
- }
- }
-
- switch (val1.getDataType()) {
- case STRING:
- result = val1.getString().equals(val2.getString());
- break;
- case SHORT:
- result = val1.getShort().equals(val2.getShort());
- break;
- case INT:
- result = val1.getInt().equals(val2.getInt());
- break;
- case DOUBLE:
- result = val1.getDouble().equals(val2.getDouble());
- break;
- case TIMESTAMP:
- result = val1.getTime().equals(val2.getTime());
- break;
- case LONG:
- result = val1.getLong().equals(val2.getLong());
- break;
- case DECIMAL:
- result = val1.getDecimal().compareTo(val2.getDecimal()) == 0;
- break;
- default:
- throw new FilterUnsupportedException(
- "DataType: " + val1.getDataType() + " not supported for the filter expression");
- }
- val1.set(DataType.BOOLEAN, result);
- return val1;
- }
-
- @Override public ExpressionType getFilterExpressionType() {
- return ExpressionType.EQUALS;
- }
-
- @Override public String getString() {
- return "EqualTo(" + left.getString() + ',' + right.getString() + ')';
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/cd6a4ff3/core/src/main/java/org/carbondata/scan/expression/conditional/GreaterThanEqualToExpression.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/carbondata/scan/expression/conditional/GreaterThanEqualToExpression.java b/core/src/main/java/org/carbondata/scan/expression/conditional/GreaterThanEqualToExpression.java
deleted file mode 100644
index ef562f0..0000000
--- a/core/src/main/java/org/carbondata/scan/expression/conditional/GreaterThanEqualToExpression.java
+++ /dev/null
@@ -1,90 +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.carbondata.scan.expression.conditional;
-
-import org.carbondata.core.carbon.metadata.datatype.DataType;
-import org.carbondata.scan.expression.Expression;
-import org.carbondata.scan.expression.ExpressionResult;
-import org.carbondata.scan.expression.exception.FilterIllegalMemberException;
-import org.carbondata.scan.expression.exception.FilterUnsupportedException;
-import org.carbondata.scan.filter.intf.ExpressionType;
-import org.carbondata.scan.filter.intf.RowIntf;
-
-public class GreaterThanEqualToExpression extends BinaryConditionalExpression {
- private static final long serialVersionUID = 4185317066280688984L;
-
- public GreaterThanEqualToExpression(Expression left, Expression right) {
- super(left, right);
- }
-
- public ExpressionResult evaluate(RowIntf value)
- throws FilterUnsupportedException, FilterIllegalMemberException {
- ExpressionResult elRes = left.evaluate(value);
- ExpressionResult erRes = right.evaluate(value);
- ExpressionResult exprResVal1 = elRes;
- if (elRes.isNull() || erRes.isNull()) {
- elRes.set(DataType.BOOLEAN, false);
- return elRes;
- }
- if (elRes.getDataType() != erRes.getDataType()) {
- if (elRes.getDataType().getPresedenceOrder() < erRes.getDataType().getPresedenceOrder()) {
- exprResVal1 = erRes;
- }
-
- }
- boolean result = false;
- switch (exprResVal1.getDataType()) {
- case STRING:
- result = elRes.getString().compareTo(erRes.getString()) >= 0;
- break;
- case SHORT:
- result = elRes.getShort() >= (erRes.getShort());
- break;
- case INT:
- result = elRes.getInt() >= (erRes.getInt());
- break;
- case DOUBLE:
- result = elRes.getDouble() >= (erRes.getDouble());
- break;
- case TIMESTAMP:
- result = elRes.getTime() >= (erRes.getTime());
- break;
- case LONG:
- result = elRes.getLong() >= (erRes.getLong());
- break;
- case DECIMAL:
- result = elRes.getDecimal().compareTo(erRes.getDecimal()) >= 0;
- break;
- default:
- throw new FilterUnsupportedException(
- "DataType: " + exprResVal1.getDataType() + " not supported for the filter expression");
- }
- exprResVal1.set(DataType.BOOLEAN, result);
- return exprResVal1;
- }
-
- @Override public ExpressionType getFilterExpressionType() {
- return ExpressionType.GREATERTHAN_EQUALTO;
- }
-
- @Override public String getString() {
- return "GreaterThanEqualTo(" + left.getString() + ',' + right.getString() + ')';
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/cd6a4ff3/core/src/main/java/org/carbondata/scan/expression/conditional/GreaterThanExpression.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/carbondata/scan/expression/conditional/GreaterThanExpression.java b/core/src/main/java/org/carbondata/scan/expression/conditional/GreaterThanExpression.java
deleted file mode 100644
index ff2ff92..0000000
--- a/core/src/main/java/org/carbondata/scan/expression/conditional/GreaterThanExpression.java
+++ /dev/null
@@ -1,93 +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.carbondata.scan.expression.conditional;
-
-import org.carbondata.core.carbon.metadata.datatype.DataType;
-import org.carbondata.scan.expression.Expression;
-import org.carbondata.scan.expression.ExpressionResult;
-import org.carbondata.scan.expression.exception.FilterIllegalMemberException;
-import org.carbondata.scan.expression.exception.FilterUnsupportedException;
-import org.carbondata.scan.filter.intf.ExpressionType;
-import org.carbondata.scan.filter.intf.RowIntf;
-
-
-public class GreaterThanExpression extends BinaryConditionalExpression {
- private static final long serialVersionUID = -5319109756575539219L;
-
- public GreaterThanExpression(Expression left, Expression right) {
- super(left, right);
- }
-
- @Override public ExpressionResult evaluate(RowIntf value)
- throws FilterUnsupportedException, FilterIllegalMemberException {
- ExpressionResult exprLeftRes = left.evaluate(value);
- ExpressionResult exprRightRes = right.evaluate(value);
- ExpressionResult val1 = exprLeftRes;
- if (exprLeftRes.isNull() || exprRightRes.isNull()) {
- exprLeftRes.set(DataType.BOOLEAN, false);
- return exprLeftRes;
- }
- if (exprLeftRes.getDataType() != exprRightRes.getDataType()) {
- if (exprLeftRes.getDataType().getPresedenceOrder() < exprRightRes.getDataType()
- .getPresedenceOrder()) {
- val1 = exprRightRes;
- }
-
- }
- boolean result = false;
- switch (val1.getDataType()) {
- case STRING:
- result = exprLeftRes.getString().compareTo(exprRightRes.getString()) > 0;
- break;
- case DOUBLE:
- result = exprLeftRes.getDouble() > (exprRightRes.getDouble());
- break;
- case SHORT:
- result = exprLeftRes.getShort() > (exprRightRes.getShort());
- break;
- case INT:
- result = exprLeftRes.getInt() > (exprRightRes.getInt());
- break;
- case TIMESTAMP:
- result = exprLeftRes.getTime() > (exprRightRes.getTime());
- break;
- case LONG:
- result = exprLeftRes.getLong() > (exprRightRes.getLong());
- break;
- case DECIMAL:
- result = exprLeftRes.getDecimal().compareTo(exprRightRes.getDecimal()) > 0;
- break;
- default:
- throw new FilterUnsupportedException(
- "DataType: " + val1.getDataType() + " not supported for the filter expression");
- }
- val1.set(DataType.BOOLEAN, result);
- return val1;
- }
-
- @Override public ExpressionType getFilterExpressionType() {
- return ExpressionType.GREATERTHAN;
- }
-
- @Override public String getString() {
- return "GreaterThan(" + left.getString() + ',' + right.getString() + ')';
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/cd6a4ff3/core/src/main/java/org/carbondata/scan/expression/conditional/InExpression.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/carbondata/scan/expression/conditional/InExpression.java b/core/src/main/java/org/carbondata/scan/expression/conditional/InExpression.java
deleted file mode 100644
index d821825..0000000
--- a/core/src/main/java/org/carbondata/scan/expression/conditional/InExpression.java
+++ /dev/null
@@ -1,98 +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.carbondata.scan.expression.conditional;
-
-import java.util.HashSet;
-import java.util.Set;
-
-import org.carbondata.core.carbon.metadata.datatype.DataType;
-import org.carbondata.scan.expression.Expression;
-import org.carbondata.scan.expression.ExpressionResult;
-import org.carbondata.scan.expression.exception.FilterIllegalMemberException;
-import org.carbondata.scan.expression.exception.FilterUnsupportedException;
-import org.carbondata.scan.filter.intf.ExpressionType;
-import org.carbondata.scan.filter.intf.RowIntf;
-
-public class InExpression extends BinaryConditionalExpression {
- private static final long serialVersionUID = -3149927446694175489L;
-
- protected transient Set<ExpressionResult> setOfExprResult;
-
- public InExpression(Expression left, Expression right) {
- super(left, right);
- }
-
- @Override public ExpressionResult evaluate(RowIntf value)
- throws FilterUnsupportedException, FilterIllegalMemberException {
- ExpressionResult leftRsult = left.evaluate(value);
-
- if (setOfExprResult == null) {
- ExpressionResult rightRsult = right.evaluate(value);
- ExpressionResult val = null;
- setOfExprResult = new HashSet<ExpressionResult>(10);
- for (ExpressionResult expressionResVal : rightRsult.getList()) {
- if (expressionResVal.getDataType().getPresedenceOrder() < leftRsult.getDataType()
- .getPresedenceOrder()) {
- val = leftRsult;
- } else {
- val = expressionResVal;
- }
- switch (val.getDataType()) {
- case STRING:
- val = new ExpressionResult(val.getDataType(), expressionResVal.getString());
- break;
- case SHORT:
- val = new ExpressionResult(val.getDataType(), expressionResVal.getShort());
- break;
- case INT:
- val = new ExpressionResult(val.getDataType(), expressionResVal.getInt());
- break;
- case DOUBLE:
- val = new ExpressionResult(val.getDataType(), expressionResVal.getDouble());
- break;
- case LONG:
- val = new ExpressionResult(val.getDataType(), expressionResVal.getLong());
- break;
- case TIMESTAMP:
- val = new ExpressionResult(val.getDataType(), expressionResVal.getTime());
- break;
- case DECIMAL:
- val = new ExpressionResult(val.getDataType(), expressionResVal.getDecimal());
- break;
- default:
- throw new FilterUnsupportedException(
- "DataType: " + val.getDataType() + " not supported for the filter expression");
- }
- setOfExprResult.add(val);
- }
- }
- leftRsult.set(DataType.BOOLEAN, setOfExprResult.contains(leftRsult));
- return leftRsult;
- }
-
- @Override public ExpressionType getFilterExpressionType() {
- return ExpressionType.IN;
- }
-
- @Override public String getString() {
- return "IN(" + left.getString() + ',' + right.getString() + ')';
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/cd6a4ff3/core/src/main/java/org/carbondata/scan/expression/conditional/LessThanEqualToExpression.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/carbondata/scan/expression/conditional/LessThanEqualToExpression.java b/core/src/main/java/org/carbondata/scan/expression/conditional/LessThanEqualToExpression.java
deleted file mode 100644
index 500531e..0000000
--- a/core/src/main/java/org/carbondata/scan/expression/conditional/LessThanEqualToExpression.java
+++ /dev/null
@@ -1,92 +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.carbondata.scan.expression.conditional;
-
-import org.carbondata.core.carbon.metadata.datatype.DataType;
-import org.carbondata.scan.expression.Expression;
-import org.carbondata.scan.expression.ExpressionResult;
-import org.carbondata.scan.expression.exception.FilterIllegalMemberException;
-import org.carbondata.scan.expression.exception.FilterUnsupportedException;
-import org.carbondata.scan.filter.intf.ExpressionType;
-import org.carbondata.scan.filter.intf.RowIntf;
-
-public class LessThanEqualToExpression extends BinaryConditionalExpression {
- private static final long serialVersionUID = 1L;
-
- public LessThanEqualToExpression(Expression left, Expression right) {
- super(left, right);
- }
-
- public ExpressionResult evaluate(RowIntf value)
- throws FilterUnsupportedException, FilterIllegalMemberException {
- ExpressionResult elRes = left.evaluate(value);
- ExpressionResult erRes = right.evaluate(value);
- ExpressionResult exprResValue1 = elRes;
- if (elRes.isNull() || erRes.isNull()) {
- elRes.set(DataType.BOOLEAN, false);
- return elRes;
- }
- if (elRes.getDataType() != erRes.getDataType()) {
- if (elRes.getDataType().getPresedenceOrder() < erRes.getDataType().getPresedenceOrder()) {
- exprResValue1 = erRes;
- }
-
- }
- boolean result = false;
- switch (exprResValue1.getDataType()) {
- case STRING:
- result = elRes.getString().compareTo(erRes.getString()) <= 0;
- break;
- case SHORT:
- result = elRes.getShort() <= (erRes.getShort());
- break;
- case INT:
- result = elRes.getInt() <= (erRes.getInt());
- break;
- case DOUBLE:
- result = elRes.getDouble() <= (erRes.getDouble());
- break;
- case TIMESTAMP:
- result = elRes.getTime() <= (erRes.getTime());
- break;
- case LONG:
- result = elRes.getLong() <= (erRes.getLong());
- break;
- case DECIMAL:
- result = elRes.getDecimal().compareTo(erRes.getDecimal()) <= 0;
- break;
- default:
- throw new FilterUnsupportedException("DataType: " + exprResValue1.getDataType()
- + " not supported for the filter expression");
- }
- exprResValue1.set(DataType.BOOLEAN, result);
- return exprResValue1;
- }
-
- @Override public ExpressionType getFilterExpressionType() {
- // TODO Auto-generated method stub
- return ExpressionType.LESSTHAN_EQUALTO;
- }
-
- @Override public String getString() {
- return "LessThanEqualTo(" + left.getString() + ',' + right.getString() + ')';
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/cd6a4ff3/core/src/main/java/org/carbondata/scan/expression/conditional/LessThanExpression.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/carbondata/scan/expression/conditional/LessThanExpression.java b/core/src/main/java/org/carbondata/scan/expression/conditional/LessThanExpression.java
deleted file mode 100644
index 74d80ed..0000000
--- a/core/src/main/java/org/carbondata/scan/expression/conditional/LessThanExpression.java
+++ /dev/null
@@ -1,95 +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.carbondata.scan.expression.conditional;
-
-import org.carbondata.core.carbon.metadata.datatype.DataType;
-import org.carbondata.scan.expression.Expression;
-import org.carbondata.scan.expression.ExpressionResult;
-import org.carbondata.scan.expression.exception.FilterIllegalMemberException;
-import org.carbondata.scan.expression.exception.FilterUnsupportedException;
-import org.carbondata.scan.filter.intf.ExpressionType;
-import org.carbondata.scan.filter.intf.RowIntf;
-
-public class LessThanExpression extends BinaryConditionalExpression {
-
- private static final long serialVersionUID = 6343040416663699924L;
-
- public LessThanExpression(Expression left, Expression right) {
- super(left, right);
- }
-
- public ExpressionResult evaluate(RowIntf value)
- throws FilterUnsupportedException, FilterIllegalMemberException {
- ExpressionResult erRes = right.evaluate(value);
- ExpressionResult elRes = left.evaluate(value);
-
- ExpressionResult val1 = elRes;
-
- boolean result = false;
-
- if (elRes.isNull() || erRes.isNull()) {
- elRes.set(DataType.BOOLEAN, false);
- return elRes;
- }
- if (elRes.getDataType() != erRes.getDataType()) {
- if (elRes.getDataType().getPresedenceOrder() < erRes.getDataType().getPresedenceOrder()) {
- val1 = erRes;
- }
-
- }
- switch (val1.getDataType()) {
- case STRING:
- result = elRes.getString().compareTo(erRes.getString()) < 0;
- break;
- case SHORT:
- result = elRes.getShort() < (erRes.getShort());
- break;
- case INT:
- result = elRes.getInt() < (erRes.getInt());
- break;
- case DOUBLE:
- result = elRes.getDouble() < (erRes.getDouble());
- break;
- case TIMESTAMP:
- result = elRes.getTime() < (erRes.getTime());
- break;
- case LONG:
- result = elRes.getLong() < (erRes.getLong());
- break;
- case DECIMAL:
- result = elRes.getDecimal().compareTo(erRes.getDecimal()) < 0;
- break;
- default:
- throw new FilterUnsupportedException(
- "DataType: " + val1.getDataType() + " not supported for the filter expression");
- }
- val1.set(DataType.BOOLEAN, result);
- return val1;
- }
-
- @Override public ExpressionType getFilterExpressionType() {
- return ExpressionType.LESSTHAN;
- }
-
- @Override public String getString() {
- return "LessThan(" + left.getString() + ',' + right.getString() + ')';
- }
-
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/cd6a4ff3/core/src/main/java/org/carbondata/scan/expression/conditional/ListExpression.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/carbondata/scan/expression/conditional/ListExpression.java b/core/src/main/java/org/carbondata/scan/expression/conditional/ListExpression.java
deleted file mode 100644
index b04b2b1..0000000
--- a/core/src/main/java/org/carbondata/scan/expression/conditional/ListExpression.java
+++ /dev/null
@@ -1,62 +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.carbondata.scan.expression.conditional;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.carbondata.scan.expression.Expression;
-import org.carbondata.scan.expression.ExpressionResult;
-import org.carbondata.scan.expression.exception.FilterIllegalMemberException;
-import org.carbondata.scan.expression.exception.FilterUnsupportedException;
-import org.carbondata.scan.filter.intf.ExpressionType;
-import org.carbondata.scan.filter.intf.RowIntf;
-
-public class ListExpression extends Expression {
- private static final long serialVersionUID = 1L;
-
- public ListExpression(List<Expression> children) {
- this.children = children;
- }
-
- @Override public ExpressionResult evaluate(RowIntf value) throws FilterUnsupportedException {
- List<ExpressionResult> listOfExprRes = new ArrayList<ExpressionResult>(10);
-
- for (Expression expr : children) {
- try {
- listOfExprRes.add(expr.evaluate(value));
- } catch (FilterIllegalMemberException e) {
- continue;
- }
- }
- return new ExpressionResult(listOfExprRes);
- }
-
- @Override public ExpressionType getFilterExpressionType() {
- // TODO Auto-generated method stub
- return ExpressionType.LIST;
- }
-
- @Override public String getString() {
- // TODO Auto-generated method stub
- return null;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/cd6a4ff3/core/src/main/java/org/carbondata/scan/expression/conditional/NotEqualsExpression.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/carbondata/scan/expression/conditional/NotEqualsExpression.java b/core/src/main/java/org/carbondata/scan/expression/conditional/NotEqualsExpression.java
deleted file mode 100644
index 7d70ae3..0000000
--- a/core/src/main/java/org/carbondata/scan/expression/conditional/NotEqualsExpression.java
+++ /dev/null
@@ -1,104 +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.carbondata.scan.expression.conditional;
-
-import org.carbondata.core.carbon.metadata.datatype.DataType;
-import org.carbondata.scan.expression.Expression;
-import org.carbondata.scan.expression.ExpressionResult;
-import org.carbondata.scan.expression.exception.FilterIllegalMemberException;
-import org.carbondata.scan.expression.exception.FilterUnsupportedException;
-import org.carbondata.scan.filter.intf.ExpressionType;
-import org.carbondata.scan.filter.intf.RowIntf;
-
-public class NotEqualsExpression extends BinaryConditionalExpression {
-
- private static final long serialVersionUID = 8684006025540863973L;
- private boolean isNotNull = false;
- public NotEqualsExpression(Expression left, Expression right, boolean isNotNull) {
- super(left, right);
- this.isNotNull = isNotNull;
- }
-
- public NotEqualsExpression(Expression left, Expression right) {
- super(left, right);
- }
-
- @Override public ExpressionResult evaluate(RowIntf value)
- throws FilterUnsupportedException, FilterIllegalMemberException {
- ExpressionResult elRes = left.evaluate(value);
- ExpressionResult erRes = right.evaluate(value);
-
- boolean result = false;
- ExpressionResult val1 = elRes;
- ExpressionResult val2 = erRes;
- if (elRes.isNull() || erRes.isNull()) {
- if (isNotNull) {
- elRes.set(DataType.BOOLEAN, elRes.isNull() != erRes.isNull());
- } else {
- elRes.set(DataType.BOOLEAN, false);
- }
- return elRes;
- }
- //default implementation if the data types are different for the resultsets
- if (elRes.getDataType() != erRes.getDataType()) {
- // result = elRes.getString().equals(erRes.getString());
- if (elRes.getDataType().getPresedenceOrder() < erRes.getDataType().getPresedenceOrder()) {
- val1 = erRes;
- val2 = elRes;
- }
- }
- switch (val1.getDataType()) {
- case STRING:
- result = !val1.getString().equals(val2.getString());
- break;
- case SHORT:
- result = val1.getShort().shortValue() != val2.getShort().shortValue();
- break;
- case INT:
- result = val1.getInt().intValue() != val2.getInt().intValue();
- break;
- case DOUBLE:
- result = val1.getDouble().doubleValue() != val2.getDouble().doubleValue();
- break;
- case TIMESTAMP:
- result = val1.getTime().longValue() != val2.getTime().longValue();
- break;
- case LONG:
- result = elRes.getLong().longValue() != (erRes.getLong()).longValue();
- break;
- case DECIMAL:
- result = elRes.getDecimal().compareTo(erRes.getDecimal()) != 0;
- break;
- default:
- throw new FilterUnsupportedException(
- "DataType: " + val1.getDataType() + " not supported for the filter expression");
- }
- val1.set(DataType.BOOLEAN, result);
- return val1;
- }
-
- @Override public ExpressionType getFilterExpressionType() {
- return ExpressionType.NOT_EQUALS;
- }
-
- @Override public String getString() {
- return "NotEquals(" + left.getString() + ',' + right.getString() + ')';
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/cd6a4ff3/core/src/main/java/org/carbondata/scan/expression/conditional/NotInExpression.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/carbondata/scan/expression/conditional/NotInExpression.java b/core/src/main/java/org/carbondata/scan/expression/conditional/NotInExpression.java
deleted file mode 100644
index 0c0868b..0000000
--- a/core/src/main/java/org/carbondata/scan/expression/conditional/NotInExpression.java
+++ /dev/null
@@ -1,97 +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.carbondata.scan.expression.conditional;
-
-import java.util.HashSet;
-import java.util.Set;
-
-import org.carbondata.core.carbon.metadata.datatype.DataType;
-import org.carbondata.scan.expression.Expression;
-import org.carbondata.scan.expression.ExpressionResult;
-import org.carbondata.scan.expression.exception.FilterIllegalMemberException;
-import org.carbondata.scan.expression.exception.FilterUnsupportedException;
-import org.carbondata.scan.filter.intf.ExpressionType;
-import org.carbondata.scan.filter.intf.RowIntf;
-
-public class NotInExpression extends BinaryConditionalExpression {
- private static final long serialVersionUID = -6835841923752118034L;
- protected transient Set<ExpressionResult> setOfExprResult;
-
- public NotInExpression(Expression left, Expression right) {
- super(left, right);
- }
-
- @Override public ExpressionResult evaluate(RowIntf value)
- throws FilterUnsupportedException, FilterIllegalMemberException {
- ExpressionResult leftRsult = left.evaluate(value);
- if (setOfExprResult == null) {
- ExpressionResult val = null;
- ExpressionResult rightRsult = right.evaluate(value);
- setOfExprResult = new HashSet<ExpressionResult>(10);
- for (ExpressionResult exprResVal : rightRsult.getList()) {
- if (exprResVal.getDataType().getPresedenceOrder() < leftRsult.getDataType()
- .getPresedenceOrder()) {
- val = leftRsult;
- } else {
- val = exprResVal;
- }
- switch (val.getDataType()) {
- case STRING:
- val = new ExpressionResult(val.getDataType(), exprResVal.getString());
- break;
- case SHORT:
- val = new ExpressionResult(val.getDataType(), exprResVal.getShort());
- break;
- case INT:
- val = new ExpressionResult(val.getDataType(), exprResVal.getInt());
- break;
- case DOUBLE:
- val = new ExpressionResult(val.getDataType(), exprResVal.getDouble());
- break;
- case TIMESTAMP:
- val = new ExpressionResult(val.getDataType(), exprResVal.getTime());
- break;
- case LONG:
- val = new ExpressionResult(val.getDataType(), exprResVal.getLong());
- break;
- case DECIMAL:
- val = new ExpressionResult(val.getDataType(), exprResVal.getDecimal());
- break;
- default:
- throw new FilterUnsupportedException(
- "DataType: " + val.getDataType() + " not supported for the filter expression");
- }
- setOfExprResult.add(val);
- }
- }
- leftRsult.set(DataType.BOOLEAN, !setOfExprResult.contains(leftRsult));
-
- return leftRsult;
- }
-
- @Override public ExpressionType getFilterExpressionType() {
- return ExpressionType.NOT_IN;
- }
-
- @Override public String getString() {
- return "NOT IN(" + left.getString() + ',' + right.getString() + ')';
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/cd6a4ff3/core/src/main/java/org/carbondata/scan/expression/exception/FilterIllegalMemberException.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/carbondata/scan/expression/exception/FilterIllegalMemberException.java b/core/src/main/java/org/carbondata/scan/expression/exception/FilterIllegalMemberException.java
deleted file mode 100644
index 7130113..0000000
--- a/core/src/main/java/org/carbondata/scan/expression/exception/FilterIllegalMemberException.java
+++ /dev/null
@@ -1,98 +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.carbondata.scan.expression.exception;
-
-import java.util.Locale;
-
-/**
- * FilterIllegalMemberException class representing exception which can cause while evaluating
- * filter members needs to be gracefully handled without propagating to outer layer so that
- * the execution should not get interrupted.
- */
-public class FilterIllegalMemberException extends Exception {
-
- /**
- * default serial version ID.
- */
- private static final long serialVersionUID = 1L;
-
- /**
- * The Error message.
- */
- private String msg = "";
-
- /**
- * Constructor
- *
- * @param errorCode The error code for this exception.
- * @param msg The error message for this exception.
- */
- public FilterIllegalMemberException(String msg) {
- super(msg);
- this.msg = msg;
- }
-
- /**
- * Constructor
- *
- * @param errorCode The error code for this exception.
- * @param msg The error message for this exception.
- */
- public FilterIllegalMemberException(String msg, Throwable t) {
- super(msg, t);
- this.msg = msg;
- }
-
- /**
- * Constructor
- *
- * @param errorCode The error code for this exception.
- * @param msg The error message for this exception.
- */
- public FilterIllegalMemberException(Throwable t) {
- super(t);
- }
-
- /**
- * This method is used to get the localized message.
- *
- * @param locale - A Locale object represents a specific geographical,
- * political, or cultural region.
- * @return - Localized error message.
- */
- public String getLocalizedMessage(Locale locale) {
- return "";
- }
-
- /**
- * getLocalizedMessage
- */
- @Override public String getLocalizedMessage() {
- return super.getLocalizedMessage();
- }
-
- /**
- * getMessage
- */
- public String getMessage() {
- return this.msg;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/cd6a4ff3/core/src/main/java/org/carbondata/scan/expression/exception/FilterUnsupportedException.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/carbondata/scan/expression/exception/FilterUnsupportedException.java b/core/src/main/java/org/carbondata/scan/expression/exception/FilterUnsupportedException.java
deleted file mode 100644
index dbc406e..0000000
--- a/core/src/main/java/org/carbondata/scan/expression/exception/FilterUnsupportedException.java
+++ /dev/null
@@ -1,92 +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.carbondata.scan.expression.exception;
-
-import java.util.Locale;
-
-public class FilterUnsupportedException extends Exception {
-
- /**
- * default serial version ID.
- */
- private static final long serialVersionUID = 1L;
-
- /**
- * The Error message.
- */
- private String msg = "";
-
- /**
- * Constructor
- *
- * @param errorCode The error code for this exception.
- * @param msg The error message for this exception.
- */
- public FilterUnsupportedException(String msg) {
- super(msg);
- this.msg = msg;
- }
-
- /**
- * Constructor
- *
- * @param errorCode The error code for this exception.
- * @param msg The error message for this exception.
- */
- public FilterUnsupportedException(String msg, Throwable t) {
- super(msg, t);
- this.msg = msg;
- }
-
- /**
- * Constructor
- *
- * @param errorCode The error code for this exception.
- * @param msg The error message for this exception.
- */
- public FilterUnsupportedException(Throwable t) {
- super(t);
- }
-
- /**
- * This method is used to get the localized message.
- *
- * @param locale - A Locale object represents a specific geographical,
- * political, or cultural region.
- * @return - Localized error message.
- */
- public String getLocalizedMessage(Locale locale) {
- return "";
- }
-
- /**
- * getLocalizedMessage
- */
- @Override public String getLocalizedMessage() {
- return super.getLocalizedMessage();
- }
-
- /**
- * getMessage
- */
- public String getMessage() {
- return this.msg;
- }
-}