-
Notifications
You must be signed in to change notification settings - Fork 146
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[FSTORE-814] StackOverflowException if you provide statistics columns…
… in the statistics config (#1343)
- Loading branch information
Showing
3 changed files
with
62 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
57 changes: 57 additions & 0 deletions
57
...va/io/hops/hopsworks/persistence/entity/featurestore/statistics/TestStatisticsConfig.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
/* | ||
* This file is part of Hopsworks | ||
* Copyright (C) 2023, Hopsworks AB. All rights reserved | ||
* | ||
* Hopsworks is free software: you can redistribute it and/or modify it under the terms of | ||
* the GNU Affero General Public License as published by the Free Software Foundation, | ||
* either version 3 of the License, or (at your option) any later version. | ||
* | ||
* Hopsworks is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; | ||
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR | ||
* PURPOSE. See the GNU Affero General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Affero General Public License along with this program. | ||
* If not, see <https://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
package io.hops.hopsworks.persistence.entity.featurestore.statistics; | ||
|
||
import org.junit.Assert; | ||
import org.junit.Test; | ||
|
||
import java.util.Arrays; | ||
|
||
public class TestStatisticsConfig { | ||
|
||
// Test for FSTORE-814 | ||
@Test | ||
public void testHashCodeWithColumns() { | ||
StatisticsConfig statisticsConfig = new StatisticsConfig(true, true, true, true); | ||
|
||
StatisticColumn statisticColumn = new StatisticColumn(statisticsConfig, "test"); | ||
statisticColumn.setId(1); | ||
|
||
statisticsConfig.setId(1); | ||
statisticsConfig.setStatisticColumns(Arrays.asList(statisticColumn)); | ||
|
||
// This should not throw an exception | ||
statisticsConfig.hashCode(); | ||
} | ||
|
||
@Test | ||
public void testEqualsWithColumns() { | ||
StatisticsConfig statisticsConfig1 = new StatisticsConfig(true, true, true, true); | ||
StatisticColumn statisticColumn1 = new StatisticColumn(statisticsConfig1, "test"); | ||
statisticColumn1.setId(1); | ||
statisticsConfig1.setId(1); | ||
statisticsConfig1.setStatisticColumns(Arrays.asList(statisticColumn1)); | ||
|
||
StatisticsConfig statisticsConfig2 = new StatisticsConfig(true, true, true, true); | ||
StatisticColumn statisticColumn2 = new StatisticColumn(statisticsConfig2, "test"); | ||
statisticColumn2.setId(1); | ||
statisticsConfig2.setId(1); | ||
statisticsConfig2.setStatisticColumns(Arrays.asList(statisticColumn2)); | ||
|
||
Assert.assertTrue(statisticsConfig1.equals(statisticsConfig2)); | ||
} | ||
} |