Uploaded image for project: 'Phoenix'
  1. Phoenix
  2. PHOENIX-1462

Create unit test for COUNT DISTINCT using compression

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 3.0.0, 4.0.0, 4.2.0, 3.2.0
    • None
    • None

    Description

      Create a unit test for PHOENIX-1455 and ensure that it is calling the code to do compression. Something like this:

      @Category(NeedsOwnMiniClusterTest.class)
      public class CountDistinctCompressionIT extends BaseOwnClusterHBaseManagedTimeIT {
              
          @BeforeClass
          public static void doSetup() throws Exception {
              Map<String,String> props = Maps.newHashMapWithExpectedSize(3);
              // Must update config before starting server
                props.put(QueryServices.DISTINCT_VALUE_COMPRESS_THRESHOLD_ATTRIB, Long.toString(1));
              setUpTestDriver(new ReadOnlyProps(props.entrySet().iterator()));
          }
      
          @Test
          public void testDistinctCountOnColumn() throws Exception {
              String tenantId = getOrganizationId();
              initATableValues(tenantId, null, getDefaultSplits(tenantId), null);
      
              String query = "SELECT count(DISTINCT A_STRING) FROM aTable";
      
              Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES);
              Connection conn = DriverManager.getConnection(getUrl(), props);
              try {
                  PreparedStatement statement = conn.prepareStatement(query);
                  ResultSet rs = statement.executeQuery();
                  assertTrue(rs.next());
                  assertEquals(3, rs.getLong(1));
                  assertFalse(rs.next());
              } finally {
                  conn.close();
              }
          }
      

      Attachments

        1. Phoenix-1462.patch
          3 kB
          ramkrishna.s.vasudevan

        Activity

          People

            ram_krish ramkrishna.s.vasudevan
            jamestaylor James R. Taylor
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: