Uploaded image for project: 'Calcite'
  1. Calcite
  2. CALCITE-3587

RexBuilder may lose decimal fraction for creating literal with DECIMAL type

VotersWatch issueWatchersLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 1.22.0
    • Component/s: None

      Description

      this test

      // RexBuilderTest
      @Test public void testDecimal() {
      final RelDataTypeFactory typeFactory =
      new SqlTypeFactoryImpl(RelDataTypeSystem.DEFAULT);
      final RelDataType type = typeFactory.createSqlType(SqlTypeName.DECIMAL, 4, 2);
      final RexBuilder builder = new RexBuilder(typeFactory);
      final RexLiteral literal = (RexLiteral) builder.makeLiteral(12.3, type, false);
      Comparable value = literal.getValue();
      assertThat(value.toString(), is("12.3"));
      }
      

      fails with message

      java.lang.AssertionError: 
      Expected: is "12.3"
           but: was "12"
      Expected :12.3
      Actual   :12
      

        Attachments

          Activity

            People

            • Assignee:
              yanlin-Lynn Wang Yanlin
              Reporter:
              yanlin-Lynn Wang Yanlin

              Dates

              • Created:
                Updated:
                Resolved:

                Time Tracking

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0h
                0h
                Logged:
                Time Spent - 50m
                50m

                  Issue deployment