use of org.apache.carbondata.core.scan.expression.Expression in project carbondata by apache.
the class FilterUtilTest method testCheckIfRightExpressionRequireEvaluationWithExpressionIsInstanceOfLiteralExpression.
@Test
public void testCheckIfRightExpressionRequireEvaluationWithExpressionIsInstanceOfLiteralExpression() {
Expression expression = new LiteralExpression("test", DataType.STRING);
boolean result = FilterUtil.checkIfRightExpressionRequireEvaluation(expression);
assertFalse(result);
}
use of org.apache.carbondata.core.scan.expression.Expression in project carbondata by apache.
the class FilterUtilTest method testCheckIfExpressionContainsColumn.
@Test
public void testCheckIfExpressionContainsColumn() {
String columnName = "IMEI";
Expression expression = new ColumnExpression(columnName, DataType.STRING);
boolean result = FilterUtil.checkIfExpressionContainsColumn(expression);
assertTrue(result);
}
use of org.apache.carbondata.core.scan.expression.Expression in project carbondata by apache.
the class FilterUtilTest method testGetFilterListForAllMembersRS.
@Test
public void testGetFilterListForAllMembersRS() throws Exception {
Expression expression = new ColumnExpression("IMEI", DataType.STRING);
ColumnExpression columnExpression = new ColumnExpression("IMEI", DataType.STRING);
String defaultValues = "test";
int defaultSurrogate = 1;
boolean isIncludeFilter = true;
int ordinal = 1;
ColumnSchema dimColumn = new ColumnSchema();
dimColumn.setColumnar(true);
dimColumn.setColumnName("IMEI");
dimColumn.setColumnUniqueId(UUID.randomUUID().toString());
dimColumn.setDataType(DataType.STRING);
dimColumn.setDimensionColumn(true);
final CarbonColumn carbonColumn = new CarbonColumn(dimColumn, ordinal, -1);
new MockUp<ColumnExpression>() {
@Mock
public CarbonColumn getCarbonColumn() {
return carbonColumn;
}
};
new MockUp<RowImpl>() {
@Mock
public Object getVal(int index) {
return "test";
}
};
assertTrue(FilterUtil.getFilterListForAllMembersRS(expression, columnExpression, defaultValues, defaultSurrogate, isIncludeFilter) instanceof DimColumnFilterInfo);
}
use of org.apache.carbondata.core.scan.expression.Expression in project carbondata by apache.
the class FilterUtilTest method testCheckIfRightExpressionRequireEvaluation.
@Test
public void testCheckIfRightExpressionRequireEvaluation() {
Expression expression = new ColumnExpression("test", DataType.STRING);
boolean result = FilterUtil.checkIfRightExpressionRequireEvaluation(expression);
assertTrue(result);
}
use of org.apache.carbondata.core.scan.expression.Expression in project carbondata by apache.
the class FilterUtilTest method testGetFilterListForAllMembersRSWithDefaultValuesEqualsToNull.
@Test
public void testGetFilterListForAllMembersRSWithDefaultValuesEqualsToNull() throws Exception {
Expression expression = new ColumnExpression("IMEI", DataType.STRING);
ColumnExpression columnExpression = new ColumnExpression("IMEI", DataType.STRING);
String defaultValues = CarbonCommonConstants.MEMBER_DEFAULT_VAL;
int defaultSurrogate = 1;
boolean isIncludeFilter = true;
int ordinal = 1;
ColumnSchema dimColumn = new ColumnSchema();
dimColumn.setColumnar(true);
dimColumn.setColumnName("IMEI");
dimColumn.setColumnUniqueId(UUID.randomUUID().toString());
dimColumn.setDataType(DataType.STRING);
dimColumn.setDimensionColumn(true);
final CarbonColumn carbonColumn = new CarbonColumn(dimColumn, ordinal, -1);
new MockUp<ColumnExpression>() {
@Mock
public CarbonColumn getCarbonColumn() {
return carbonColumn;
}
};
new MockUp<RowImpl>() {
@Mock
public Object getVal(int index) {
return "test";
}
};
assertTrue(FilterUtil.getFilterListForAllMembersRS(expression, columnExpression, defaultValues, defaultSurrogate, isIncludeFilter) instanceof DimColumnFilterInfo);
}
Aggregations