[refactor](planner): refactor and replace use NIO (#11645)
* [refactor](planner): refactor equals code in Catalog dir.
This commit is contained in:
@ -27,9 +27,8 @@ import org.junit.Test;
|
||||
|
||||
import java.io.DataInputStream;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileOutputStream;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
|
||||
public class ColumnTest {
|
||||
|
||||
@ -49,9 +48,8 @@ public class ColumnTest {
|
||||
@Test
|
||||
public void testSerialization() throws Exception {
|
||||
// 1. Write objects to file
|
||||
File file = new File("./columnTest");
|
||||
file.createNewFile();
|
||||
DataOutputStream dos = new DataOutputStream(new FileOutputStream(file));
|
||||
Path path = Files.createTempFile("columnTest", "tmp");
|
||||
DataOutputStream dos = new DataOutputStream(Files.newOutputStream(path));
|
||||
|
||||
Column column1 = new Column("user",
|
||||
ScalarType.createChar(20), false, AggregateType.SUM, "", "");
|
||||
@ -73,7 +71,7 @@ public class ColumnTest {
|
||||
dos.close();
|
||||
|
||||
// 2. Read objects from file
|
||||
DataInputStream dis = new DataInputStream(new FileInputStream(file));
|
||||
DataInputStream dis = new DataInputStream(Files.newInputStream(path));
|
||||
Column rColumn1 = Column.read(dis);
|
||||
Assert.assertEquals("user", rColumn1.getName());
|
||||
Assert.assertEquals(PrimitiveType.CHAR, rColumn1.getDataType());
|
||||
@ -92,18 +90,17 @@ public class ColumnTest {
|
||||
Assert.assertEquals("20", rColumn2.getDefaultValue());
|
||||
|
||||
Column rColumn3 = Column.read(dis);
|
||||
Assert.assertTrue(rColumn3.equals(column3));
|
||||
Assert.assertEquals(rColumn3, column3);
|
||||
|
||||
Column rColumn4 = Column.read(dis);
|
||||
Assert.assertTrue(rColumn4.equals(column4));
|
||||
Assert.assertEquals(rColumn4, column4);
|
||||
|
||||
Assert.assertEquals(rColumn2.toString(), column2.toString());
|
||||
Assert.assertTrue(column1.equals(column1));
|
||||
Assert.assertFalse(column1.equals(this));
|
||||
Assert.assertEquals(column1, column1);
|
||||
|
||||
// 4. delete files
|
||||
dis.close();
|
||||
file.delete();
|
||||
Files.delete(path);
|
||||
}
|
||||
|
||||
@Test(expected = DdlException.class)
|
||||
|
||||
@ -27,6 +27,7 @@ import org.apache.doris.persist.CreateTableInfo;
|
||||
import org.apache.doris.persist.EditLog;
|
||||
import org.apache.doris.thrift.TStorageType;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.collect.Lists;
|
||||
import mockit.Expectations;
|
||||
import mockit.Mocked;
|
||||
@ -36,10 +37,8 @@ import org.junit.Test;
|
||||
|
||||
import java.io.DataInputStream;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileOutputStream;
|
||||
import java.util.ArrayList;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
@ -165,7 +164,7 @@ public class DatabaseTest {
|
||||
Partition partition = new Partition(20000L, "baseTable", baseIndex, new RandomDistributionInfo(10));
|
||||
List<Column> baseSchema = new LinkedList<Column>();
|
||||
OlapTable table = new OlapTable(2000, "baseTable", baseSchema, KeysType.AGG_KEYS,
|
||||
new SinglePartitionInfo(), new RandomDistributionInfo(10));
|
||||
new SinglePartitionInfo(), new RandomDistributionInfo(10));
|
||||
table.addPartition(partition);
|
||||
|
||||
// create
|
||||
@ -197,9 +196,8 @@ public class DatabaseTest {
|
||||
@Test
|
||||
public void testSerialization() throws Exception {
|
||||
// 1. Write objects to file
|
||||
File file = new File("./database");
|
||||
file.createNewFile();
|
||||
DataOutputStream dos = new DataOutputStream(new FileOutputStream(file));
|
||||
final Path path = Files.createTempFile("database", "tmp");
|
||||
DataOutputStream dos = new DataOutputStream(Files.newOutputStream(path));
|
||||
|
||||
// db1
|
||||
Database db1 = new Database();
|
||||
@ -207,37 +205,33 @@ public class DatabaseTest {
|
||||
|
||||
// db2
|
||||
Database db2 = new Database(2, "db2");
|
||||
List<Column> columns = new ArrayList<Column>();
|
||||
Column column2 = new Column("column2",
|
||||
ScalarType.createType(PrimitiveType.TINYINT), false, AggregateType.MIN, "", "");
|
||||
columns.add(column2);
|
||||
columns.add(new Column("column3",
|
||||
ScalarType.createType(PrimitiveType.SMALLINT), false, AggregateType.SUM, "", ""));
|
||||
columns.add(new Column("column4",
|
||||
ScalarType.createType(PrimitiveType.INT), false, AggregateType.REPLACE, "", ""));
|
||||
columns.add(new Column("column5",
|
||||
ScalarType.createType(PrimitiveType.BIGINT), false, AggregateType.REPLACE, "", ""));
|
||||
columns.add(new Column("column6",
|
||||
ScalarType.createType(PrimitiveType.FLOAT), false, AggregateType.REPLACE, "", ""));
|
||||
columns.add(new Column("column7",
|
||||
ScalarType.createType(PrimitiveType.DOUBLE), false, AggregateType.REPLACE, "", ""));
|
||||
columns.add(new Column("column8", ScalarType.createChar(10), true, null, "", ""));
|
||||
columns.add(new Column("column9", ScalarType.createVarchar(10), true, null, "", ""));
|
||||
columns.add(new Column("column10", ScalarType.createType(PrimitiveType.DATE), true, null, "", ""));
|
||||
columns.add(new Column("column11", ScalarType.createType(PrimitiveType.DATETIME), true, null, "", ""));
|
||||
|
||||
ImmutableList<Column> columns = ImmutableList.<Column>builder()
|
||||
.add(column2)
|
||||
.add(new Column("column3", ScalarType.createType(PrimitiveType.SMALLINT), false, AggregateType.SUM, "", ""))
|
||||
.add(new Column("column4", ScalarType.createType(PrimitiveType.INT), false, AggregateType.REPLACE, "", ""))
|
||||
.add(new Column("column5", ScalarType.createType(PrimitiveType.BIGINT), false, AggregateType.REPLACE, "", ""))
|
||||
.add(new Column("column6", ScalarType.createType(PrimitiveType.FLOAT), false, AggregateType.REPLACE, "", ""))
|
||||
.add(new Column("column7", ScalarType.createType(PrimitiveType.DOUBLE), false, AggregateType.REPLACE, "", ""))
|
||||
.add(new Column("column8", ScalarType.createChar(10), true, null, "", ""))
|
||||
.add(new Column("column9", ScalarType.createVarchar(10), true, null, "", ""))
|
||||
.add(new Column("column10", ScalarType.createType(PrimitiveType.DATE), true, null, "", ""))
|
||||
.add(new Column("column11", ScalarType.createType(PrimitiveType.DATETIME), true, null, "", ""))
|
||||
.build();
|
||||
|
||||
MaterializedIndex index = new MaterializedIndex(1, IndexState.NORMAL);
|
||||
Partition partition = new Partition(20000L, "table", index, new RandomDistributionInfo(10));
|
||||
OlapTable table = new OlapTable(1000, "table", columns, KeysType.AGG_KEYS,
|
||||
new SinglePartitionInfo(), new RandomDistributionInfo(10));
|
||||
new SinglePartitionInfo(), new RandomDistributionInfo(10));
|
||||
short shortKeyColumnCount = 1;
|
||||
table.setIndexMeta(1000, "group1", columns, 1, 1, shortKeyColumnCount, TStorageType.COLUMN, KeysType.AGG_KEYS);
|
||||
|
||||
List<Column> column = Lists.newArrayList();
|
||||
column.add(column2);
|
||||
table.setIndexMeta(new Long(1), "test", column, 1, 1, shortKeyColumnCount,
|
||||
List<Column> column = Lists.newArrayList(column2);
|
||||
table.setIndexMeta(1L, "test", column, 1, 1, shortKeyColumnCount,
|
||||
TStorageType.COLUMN, KeysType.AGG_KEYS);
|
||||
table.setIndexMeta(new Long(1), "test", column, 1, 1, shortKeyColumnCount, TStorageType.COLUMN, KeysType.AGG_KEYS);
|
||||
table.setIndexMeta(1L, "test", column, 1, 1, shortKeyColumnCount, TStorageType.COLUMN, KeysType.AGG_KEYS);
|
||||
Deencapsulation.setField(table, "baseIndexId", 1);
|
||||
table.addPartition(partition);
|
||||
db2.createTable(table);
|
||||
@ -247,18 +241,18 @@ public class DatabaseTest {
|
||||
dos.close();
|
||||
|
||||
// 2. Read objects from file
|
||||
DataInputStream dis = new DataInputStream(new FileInputStream(file));
|
||||
DataInputStream dis = new DataInputStream(Files.newInputStream(path));
|
||||
|
||||
Database rDb1 = new Database();
|
||||
rDb1.readFields(dis);
|
||||
Assert.assertTrue(rDb1.equals(db1));
|
||||
Assert.assertEquals(rDb1, db1);
|
||||
|
||||
Database rDb2 = new Database();
|
||||
rDb2.readFields(dis);
|
||||
Assert.assertTrue(rDb2.equals(db2));
|
||||
Assert.assertEquals(rDb2, db2);
|
||||
|
||||
// 3. delete files
|
||||
dis.close();
|
||||
file.delete();
|
||||
Files.delete(path);
|
||||
}
|
||||
}
|
||||
|
||||
@ -21,26 +21,17 @@ package org.apache.doris.catalog;
|
||||
import org.apache.doris.common.FeMetaVersion;
|
||||
import org.apache.doris.meta.MetaContext;
|
||||
|
||||
import org.junit.After;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.io.DataInputStream;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.util.HashMap;
|
||||
|
||||
public class TablePropertyTest {
|
||||
private static String fileName = "./TablePropertyTest";
|
||||
|
||||
@After
|
||||
public void tearDown() {
|
||||
File file = new File(fileName);
|
||||
file.delete();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testNormal() throws IOException {
|
||||
@ -48,9 +39,8 @@ public class TablePropertyTest {
|
||||
metaContext.setMetaVersion(FeMetaVersion.VERSION_CURRENT);
|
||||
metaContext.setThreadLocalInfo();
|
||||
// 1. Write objects to file
|
||||
File file = new File(fileName);
|
||||
file.createNewFile();
|
||||
DataOutputStream out = new DataOutputStream(new FileOutputStream(file));
|
||||
final Path path = Files.createTempFile("TablePropertyTest", "tmp");
|
||||
DataOutputStream out = new DataOutputStream(Files.newOutputStream(path));
|
||||
|
||||
HashMap<String, String> properties = new HashMap<>();
|
||||
properties.put(DynamicPartitionProperty.ENABLE, "true");
|
||||
@ -67,7 +57,7 @@ public class TablePropertyTest {
|
||||
out.close();
|
||||
|
||||
// 2. Read objects from file
|
||||
DataInputStream in = new DataInputStream(new FileInputStream(file));
|
||||
DataInputStream in = new DataInputStream(Files.newInputStream(path));
|
||||
TableProperty readTableProperty = TableProperty.read(in);
|
||||
DynamicPartitionProperty readDynamicPartitionProperty = readTableProperty.getDynamicPartitionProperty();
|
||||
DynamicPartitionProperty dynamicPartitionProperty = new DynamicPartitionProperty(properties);
|
||||
@ -79,6 +69,8 @@ public class TablePropertyTest {
|
||||
Assert.assertEquals(readDynamicPartitionProperty.getEnd(), dynamicPartitionProperty.getEnd());
|
||||
Assert.assertEquals(readDynamicPartitionProperty.getTimeUnit(), dynamicPartitionProperty.getTimeUnit());
|
||||
Assert.assertEquals(ReplicaAllocation.DEFAULT_ALLOCATION, readTableProperty.getReplicaAllocation());
|
||||
|
||||
in.close();
|
||||
Files.delete(path);
|
||||
}
|
||||
}
|
||||
|
||||
@ -33,10 +33,8 @@ import org.junit.Test;
|
||||
|
||||
import java.io.DataInputStream;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileOutputStream;
|
||||
import java.util.ArrayList;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
@ -129,28 +127,23 @@ public class TableTest {
|
||||
@Test
|
||||
public void testSerialization() throws Exception {
|
||||
// 1. Write objects to file
|
||||
File file = new File("./tableFamilyGroup");
|
||||
file.createNewFile();
|
||||
DataOutputStream dos = new DataOutputStream(new FileOutputStream(file));
|
||||
final Path path = Files.createTempFile("tableFamilyGroup", "tmp");
|
||||
DataOutputStream dos = new DataOutputStream(Files.newOutputStream(path));
|
||||
|
||||
List<Column> columns = new ArrayList<Column>();
|
||||
Column column2 = new Column("column2",
|
||||
ScalarType.createType(PrimitiveType.TINYINT), false, AggregateType.MIN, "", "");
|
||||
columns.add(column2);
|
||||
columns.add(new Column("column3",
|
||||
ScalarType.createType(PrimitiveType.SMALLINT), false, AggregateType.SUM, "", ""));
|
||||
columns.add(new Column("column4",
|
||||
ScalarType.createType(PrimitiveType.INT), false, AggregateType.REPLACE, "", ""));
|
||||
columns.add(new Column("column5",
|
||||
ScalarType.createType(PrimitiveType.BIGINT), false, AggregateType.REPLACE, "", ""));
|
||||
columns.add(new Column("column6",
|
||||
ScalarType.createType(PrimitiveType.FLOAT), false, AggregateType.REPLACE, "", ""));
|
||||
columns.add(new Column("column7",
|
||||
ScalarType.createType(PrimitiveType.DOUBLE), false, AggregateType.REPLACE, "", ""));
|
||||
columns.add(new Column("column8", ScalarType.createChar(10), true, null, "", ""));
|
||||
columns.add(new Column("column9", ScalarType.createVarchar(10), true, null, "", ""));
|
||||
columns.add(new Column("column10", ScalarType.createType(PrimitiveType.DATE), true, null, "", ""));
|
||||
columns.add(new Column("column11", ScalarType.createType(PrimitiveType.DATETIME), true, null, "", ""));
|
||||
ImmutableList<Column> columns = ImmutableList.<Column>builder()
|
||||
.add(column2)
|
||||
.add(new Column("column3", ScalarType.createType(PrimitiveType.SMALLINT), false, AggregateType.SUM, "", ""))
|
||||
.add(new Column("column4", ScalarType.createType(PrimitiveType.INT), false, AggregateType.REPLACE, "", ""))
|
||||
.add(new Column("column5", ScalarType.createType(PrimitiveType.BIGINT), false, AggregateType.REPLACE, "", ""))
|
||||
.add(new Column("column6", ScalarType.createType(PrimitiveType.FLOAT), false, AggregateType.REPLACE, "", ""))
|
||||
.add(new Column("column7", ScalarType.createType(PrimitiveType.DOUBLE), false, AggregateType.REPLACE, "", ""))
|
||||
.add(new Column("column8", ScalarType.createChar(10), true, null, "", ""))
|
||||
.add(new Column("column9", ScalarType.createVarchar(10), true, null, "", ""))
|
||||
.add(new Column("column10", ScalarType.createType(PrimitiveType.DATE), true, null, "", ""))
|
||||
.add(new Column("column11", ScalarType.createType(PrimitiveType.DATETIME), true, null, "", ""))
|
||||
.build();
|
||||
|
||||
OlapTable table1 = new OlapTable(1000L, "group1", columns, KeysType.AGG_KEYS,
|
||||
new SinglePartitionInfo(), new RandomDistributionInfo(10));
|
||||
@ -167,7 +160,7 @@ public class TableTest {
|
||||
dos.close();
|
||||
|
||||
// 2. Read objects from file
|
||||
DataInputStream dis = new DataInputStream(new FileInputStream(file));
|
||||
DataInputStream dis = new DataInputStream(Files.newInputStream(path));
|
||||
|
||||
Table rFamily1 = Table.read(dis);
|
||||
Assert.assertTrue(table1.equals(rFamily1));
|
||||
@ -176,6 +169,6 @@ public class TableTest {
|
||||
|
||||
// 3. delete files
|
||||
dis.close();
|
||||
file.delete();
|
||||
Files.delete(path);
|
||||
}
|
||||
}
|
||||
|
||||
@ -31,9 +31,8 @@ import org.junit.Test;
|
||||
|
||||
import java.io.DataInputStream;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileOutputStream;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
|
||||
public class TabletTest {
|
||||
|
||||
@ -116,23 +115,21 @@ public class TabletTest {
|
||||
|
||||
@Test
|
||||
public void testSerialization() throws Exception {
|
||||
File file = new File("./olapTabletTest");
|
||||
file.createNewFile();
|
||||
DataOutputStream dos = new DataOutputStream(new FileOutputStream(file));
|
||||
final Path path = Files.createTempFile("olapTabletTest", "tmp");
|
||||
DataOutputStream dos = new DataOutputStream(Files.newOutputStream(path));
|
||||
tablet.write(dos);
|
||||
dos.flush();
|
||||
dos.close();
|
||||
|
||||
// 2. Read a object from file
|
||||
DataInputStream dis = new DataInputStream(new FileInputStream(file));
|
||||
DataInputStream dis = new DataInputStream(Files.newInputStream(path));
|
||||
Tablet rTablet1 = Tablet.read(dis);
|
||||
Assert.assertEquals(1, rTablet1.getId());
|
||||
Assert.assertEquals(3, rTablet1.getReplicas().size());
|
||||
Assert.assertEquals(rTablet1.getReplicas().get(0).getVersion(), rTablet1.getReplicas().get(1).getVersion());
|
||||
|
||||
Assert.assertTrue(rTablet1.equals(tablet));
|
||||
Assert.assertTrue(rTablet1.equals(rTablet1));
|
||||
Assert.assertFalse(rTablet1.equals(this));
|
||||
Assert.assertEquals(rTablet1, tablet);
|
||||
Assert.assertEquals(rTablet1, rTablet1);
|
||||
|
||||
Tablet tablet2 = new Tablet(1);
|
||||
Replica replica1 = new Replica(1L, 1L, 100L, 0, 200000L, 0, 3000L, ReplicaState.NORMAL, 0, 0);
|
||||
@ -140,18 +137,18 @@ public class TabletTest {
|
||||
Replica replica3 = new Replica(3L, 3L, 100L, 0, 200000L, 0, 3000L, ReplicaState.NORMAL, 0, 0);
|
||||
tablet2.addReplica(replica1);
|
||||
tablet2.addReplica(replica2);
|
||||
Assert.assertFalse(tablet2.equals(tablet));
|
||||
Assert.assertNotEquals(tablet2, tablet);
|
||||
tablet2.addReplica(replica3);
|
||||
Assert.assertTrue(tablet2.equals(tablet));
|
||||
Assert.assertEquals(tablet2, tablet);
|
||||
|
||||
Tablet tablet3 = new Tablet(1);
|
||||
tablet3.addReplica(replica1);
|
||||
tablet3.addReplica(replica2);
|
||||
tablet3.addReplica(new Replica(4L, 4L, 100L, 0, 200000L, 0, 3000L, ReplicaState.NORMAL, 0, 0));
|
||||
Assert.assertFalse(tablet3.equals(tablet));
|
||||
Assert.assertNotEquals(tablet3, tablet);
|
||||
|
||||
dis.close();
|
||||
file.delete();
|
||||
Files.delete(path);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -34,6 +34,7 @@ import org.apache.doris.common.FeConstants;
|
||||
import org.apache.doris.common.jmockit.Deencapsulation;
|
||||
import org.apache.doris.thrift.TStorageType;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.collect.Lists;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Before;
|
||||
@ -41,10 +42,8 @@ import org.junit.Test;
|
||||
|
||||
import java.io.DataInputStream;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileOutputStream;
|
||||
import java.util.ArrayList;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.util.List;
|
||||
|
||||
public class CreateTableInfoTest {
|
||||
@ -64,28 +63,23 @@ public class CreateTableInfoTest {
|
||||
@Test
|
||||
public void testSerialization() throws Exception {
|
||||
// 1. Write objects to file
|
||||
File file = new File("./createTableInfo");
|
||||
file.createNewFile();
|
||||
DataOutputStream dos = new DataOutputStream(new FileOutputStream(file));
|
||||
final Path path = Files.createTempFile("createTableInfo", "tmp");
|
||||
DataOutputStream dos = new DataOutputStream(Files.newOutputStream(path));
|
||||
|
||||
List<Column> columns = new ArrayList<Column>();
|
||||
Column column2 = new Column("column2",
|
||||
ScalarType.createType(PrimitiveType.TINYINT), false, AggregateType.MIN, "", "");
|
||||
columns.add(column2);
|
||||
columns.add(new Column("column3",
|
||||
ScalarType.createType(PrimitiveType.SMALLINT), false, AggregateType.SUM, "", ""));
|
||||
columns.add(new Column("column4",
|
||||
ScalarType.createType(PrimitiveType.INT), false, AggregateType.REPLACE, "", ""));
|
||||
columns.add(new Column("column5",
|
||||
ScalarType.createType(PrimitiveType.BIGINT), false, AggregateType.REPLACE, "", ""));
|
||||
columns.add(new Column("column6",
|
||||
ScalarType.createType(PrimitiveType.FLOAT), false, AggregateType.REPLACE, "", ""));
|
||||
columns.add(new Column("column7",
|
||||
ScalarType.createType(PrimitiveType.DOUBLE), false, AggregateType.REPLACE, "", ""));
|
||||
columns.add(new Column("column8", ScalarType.createChar(10), true, null, "", ""));
|
||||
columns.add(new Column("column9", ScalarType.createVarchar(10), true, null, "", ""));
|
||||
columns.add(new Column("column10", ScalarType.createType(PrimitiveType.DATE), true, null, "", ""));
|
||||
columns.add(new Column("column11", ScalarType.createType(PrimitiveType.DATETIME), true, null, "", ""));
|
||||
ImmutableList<Column> columns = ImmutableList.<Column>builder()
|
||||
.add(column2)
|
||||
.add(new Column("column3", ScalarType.createType(PrimitiveType.SMALLINT), false, AggregateType.SUM, "", ""))
|
||||
.add(new Column("column4", ScalarType.createType(PrimitiveType.INT), false, AggregateType.REPLACE, "", ""))
|
||||
.add(new Column("column5", ScalarType.createType(PrimitiveType.BIGINT), false, AggregateType.REPLACE, "", ""))
|
||||
.add(new Column("column6", ScalarType.createType(PrimitiveType.FLOAT), false, AggregateType.REPLACE, "", ""))
|
||||
.add(new Column("column7", ScalarType.createType(PrimitiveType.DOUBLE), false, AggregateType.REPLACE, "", ""))
|
||||
.add(new Column("column8", ScalarType.createChar(10), true, null, "", ""))
|
||||
.add(new Column("column9", ScalarType.createVarchar(10), true, null, "", ""))
|
||||
.add(new Column("column10", ScalarType.createType(PrimitiveType.DATE), true, null, "", ""))
|
||||
.add(new Column("column11", ScalarType.createType(PrimitiveType.DATETIME), true, null, "", ""))
|
||||
.build();
|
||||
|
||||
MaterializedIndex index = new MaterializedIndex(1, IndexState.NORMAL);
|
||||
RandomDistributionInfo distributionInfo = new RandomDistributionInfo(10);
|
||||
@ -97,7 +91,7 @@ public class CreateTableInfoTest {
|
||||
|
||||
List<Column> column = Lists.newArrayList();
|
||||
column.add(column2);
|
||||
table.setIndexMeta(new Long(1), "test", column, 1, 1, shortKeyColumnCount,
|
||||
table.setIndexMeta(1L, "test", column, 1, 1, shortKeyColumnCount,
|
||||
TStorageType.COLUMN, KeysType.AGG_KEYS);
|
||||
Deencapsulation.setField(table, "baseIndexId", 1000);
|
||||
table.addPartition(partition);
|
||||
@ -108,7 +102,7 @@ public class CreateTableInfoTest {
|
||||
dos.close();
|
||||
|
||||
// 2. Read objects from file
|
||||
DataInputStream dis = new DataInputStream(new FileInputStream(file));
|
||||
DataInputStream dis = new DataInputStream(Files.newInputStream(path));
|
||||
|
||||
CreateTableInfo rInfo1 = CreateTableInfo.read(dis);
|
||||
Assert.assertTrue(rInfo1.getTable().equals(table));
|
||||
@ -117,6 +111,6 @@ public class CreateTableInfoTest {
|
||||
|
||||
// 3. delete files
|
||||
dis.close();
|
||||
file.delete();
|
||||
Files.delete(path);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user