Search in sources :

Example 66 with RexLiteral

use of org.apache.calcite.rex.RexLiteral in project hazelcast by hazelcast.

the class RexToExpressionTest method test_date.

@Test
public void test_date() {
    RexLiteral literal = literal(new DateString("2021-09-17"), new DateString("2021-09-18"), SqlTypeName.DATE);
    Range<?> converted = convert(literal);
    assertThat(converted).isEqualToComparingFieldByField(range(LocalDate.of(2021, 9, 17), LocalDate.of(2021, 9, 18)));
}
Also used : RexLiteral(org.apache.calcite.rex.RexLiteral) DateString(org.apache.calcite.util.DateString) Test(org.junit.Test)

Example 67 with RexLiteral

use of org.apache.calcite.rex.RexLiteral in project hazelcast by hazelcast.

the class RexToExpressionTest method test_real.

@Test
public void test_real() {
    RexLiteral literal = literal(new BigDecimal(1), new BigDecimal(2), SqlTypeName.REAL);
    Range<?> converted = convert(literal);
    assertThat(converted).isEqualToComparingFieldByField(range(1F, 2F));
}
Also used : RexLiteral(org.apache.calcite.rex.RexLiteral) BigDecimal(java.math.BigDecimal) Test(org.junit.Test)

Example 68 with RexLiteral

use of org.apache.calcite.rex.RexLiteral in project hazelcast by hazelcast.

the class RexToExpressionTest method test_int.

@Test
public void test_int() {
    RexLiteral literal = literal(new BigDecimal(1), new BigDecimal(2), SqlTypeName.INTEGER);
    Range<?> converted = convert(literal);
    assertThat(converted).isEqualToComparingFieldByField(range(1, 2));
}
Also used : RexLiteral(org.apache.calcite.rex.RexLiteral) BigDecimal(java.math.BigDecimal) Test(org.junit.Test)

Example 69 with RexLiteral

use of org.apache.calcite.rex.RexLiteral in project hazelcast by hazelcast.

the class RexToExpressionTest method test_double.

@Test
public void test_double() {
    RexLiteral literal = literal(new BigDecimal(1), new BigDecimal(2), SqlTypeName.DOUBLE);
    Range<?> converted = convert(literal);
    assertThat(converted).isEqualToComparingFieldByField(range(1D, 2D));
}
Also used : RexLiteral(org.apache.calcite.rex.RexLiteral) BigDecimal(java.math.BigDecimal) Test(org.junit.Test)

Example 70 with RexLiteral

use of org.apache.calcite.rex.RexLiteral in project hazelcast by hazelcast.

the class RexToExpressionTest method test_decimal.

@Test
public void test_decimal() {
    RexLiteral literal = literal(new BigDecimal(1), new BigDecimal(2), SqlTypeName.DECIMAL);
    Range<?> converted = convert(literal);
    assertThat(converted).isEqualToComparingFieldByField(range(new BigDecimal(1), new BigDecimal(2)));
}
Also used : RexLiteral(org.apache.calcite.rex.RexLiteral) BigDecimal(java.math.BigDecimal) Test(org.junit.Test)

Aggregations

RexLiteral (org.apache.calcite.rex.RexLiteral)150 RexNode (org.apache.calcite.rex.RexNode)92 ArrayList (java.util.ArrayList)51 RelDataType (org.apache.calcite.rel.type.RelDataType)45 RexCall (org.apache.calcite.rex.RexCall)45 Test (org.junit.Test)32 BigDecimal (java.math.BigDecimal)28 RexInputRef (org.apache.calcite.rex.RexInputRef)26 RelNode (org.apache.calcite.rel.RelNode)22 ImmutableList (com.google.common.collect.ImmutableList)18 RelDataTypeField (org.apache.calcite.rel.type.RelDataTypeField)17 List (java.util.List)16 Map (java.util.Map)16 RexBuilder (org.apache.calcite.rex.RexBuilder)16 AggregateCall (org.apache.calcite.rel.core.AggregateCall)15 ImmutableBitSet (org.apache.calcite.util.ImmutableBitSet)12 RexLiteral (org.apache.beam.vendor.calcite.v1_28_0.org.apache.calcite.rex.RexLiteral)11 NlsString (org.apache.calcite.util.NlsString)11 HashMap (java.util.HashMap)10 RexNode (org.apache.beam.vendor.calcite.v1_28_0.org.apache.calcite.rex.RexNode)10