Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
apache
Iotdb
提交
064523e2
I
Iotdb
项目概览
apache
/
Iotdb
12 个月 前同步成功
通知
25
Star
3344
Fork
916
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
I
Iotdb
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
064523e2
编写于
8月 26, 2019
作者:
Q
qiaojialin
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
rename FileSchema to Schema
上级
6ce1f413
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
26 addition
and
26 deletion
+26
-26
docs/Documentation/UserGuide/8-TsFile/2-Usage.md
docs/Documentation/UserGuide/8-TsFile/2-Usage.md
+8
-8
hadoop/src/main/java/org/apache/iotdb/tsfile/hadoop/TSFRecordWriter.java
.../java/org/apache/iotdb/tsfile/hadoop/TSFRecordWriter.java
+3
-3
server/src/main/java/org/apache/iotdb/db/engine/storagegroup/StorageGroupProcessor.java
...e/iotdb/db/engine/storagegroup/StorageGroupProcessor.java
+2
-2
server/src/main/java/org/apache/iotdb/db/utils/SchemaUtils.java
.../src/main/java/org/apache/iotdb/db/utils/SchemaUtils.java
+6
-6
server/src/test/java/org/apache/iotdb/db/engine/storagegroup/TsFileProcessorTest.java
...che/iotdb/db/engine/storagegroup/TsFileProcessorTest.java
+5
-5
tsfile/src/test/java/org/apache/iotdb/tsfile/write/ReadPageInMemTest.java
...java/org/apache/iotdb/tsfile/write/ReadPageInMemTest.java
+2
-2
未找到文件。
docs/Documentation/UserGuide/8-TsFile/2-Usage.md
浏览文件 @
064523e2
...
...
@@ -85,12 +85,12 @@ A TsFile can be generated by following three steps and the complete code will be
```
*
With pre-defined schema
```
public TsFileWriter(File file,
File
Schema schema) throws IOException
public TsFileWriter(File file, Schema schema) throws IOException
```
This one is for using the HDFS file system.
`TsFileOutput`
can be an instance of class
`HDFSOutput`
.
```
public TsFileWriter(TsFileOutput output,
File
Schema schema) throws IOException
public TsFileWriter(TsFileOutput output, Schema schema) throws IOException
```
**Parameters:**
...
...
@@ -100,15 +100,15 @@ A TsFile can be generated by following three steps and the complete code will be
* Second, add measurements
Or you can make an instance of class `
File
Schema` first and pass this to the constructor of class `TsFileWriter`
Or you can make an instance of class `Schema` first and pass this to the constructor of class `TsFileWriter`
The class `
File
Schema` contains a map whose key is the name of one measurement schema, and the value is the schema itself.
The class `Schema` contains a map whose key is the name of one measurement schema, and the value is the schema itself.
Here are the interfaces:
```
// Create an empty
File
Schema or from an existing map
public
File
Schema()
public
File
Schema(Map
<String
,
MeasurementSchema
>
measurements)
// Create an empty Schema or from an existing map
public Schema()
public Schema(Map
<String
,
MeasurementSchema
>
measurements)
// Use this two interfaces to add measurements
public void registerMeasurement(MeasurementSchema descriptor)
...
...
@@ -275,7 +275,7 @@ public class TsFileWriteWithRowBatch {
f.delete();
}
FileSchema schema = new File
Schema();
Schema schema = new
Schema();
// the number of rows to include in the row batch
int rowNum = 1000000;
...
...
hadoop/src/main/java/org/apache/iotdb/tsfile/hadoop/TSFRecordWriter.java
浏览文件 @
064523e2
...
...
@@ -30,7 +30,7 @@ import org.apache.iotdb.tsfile.hadoop.io.HDFSOutputStream;
import
org.apache.iotdb.tsfile.timeseries.basis.TsFile
;
import
org.apache.iotdb.tsfile.write.exception.InvalidJsonSchemaException
;
import
org.apache.iotdb.tsfile.write.exception.WriteProcessException
;
import
org.apache.iotdb.tsfile.write.schema.
File
Schema
;
import
org.apache.iotdb.tsfile.write.schema.Schema
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
...
...
@@ -42,9 +42,9 @@ public class TSFRecordWriter extends RecordWriter<NullWritable, TSRow> {
public
TSFRecordWriter
(
Path
path
,
JSONObject
schema
)
throws
InterruptedException
,
IOException
{
// construct the internalrecordwriter
File
Schema
fileSchema
=
null
;
Schema
fileSchema
=
null
;
try
{
fileSchema
=
new
File
Schema
(
schema
);
fileSchema
=
new
Schema
(
schema
);
}
catch
(
InvalidJsonSchemaException
e
)
{
throw
new
InterruptedException
(
String
.
format
(
"Construct the tsfile schema failed"
),
e
);
}
...
...
server/src/main/java/org/apache/iotdb/db/engine/storagegroup/StorageGroupProcessor.java
浏览文件 @
064523e2
...
...
@@ -164,7 +164,7 @@ public class StorageGroupProcessor {
this
.
storageGroupName
=
storageGroupName
;
// construct the file schema
this
.
schema
=
construct
File
Schema
(
storageGroupName
);
this
.
schema
=
constructSchema
(
storageGroupName
);
try
{
File
storageGroupSysDir
=
new
File
(
systemInfoDir
,
storageGroupName
);
...
...
@@ -249,7 +249,7 @@ public class StorageGroupProcessor {
}
}
private
Schema
construct
File
Schema
(
String
storageGroupName
)
{
private
Schema
constructSchema
(
String
storageGroupName
)
{
List
<
MeasurementSchema
>
columnSchemaList
;
columnSchemaList
=
MManager
.
getInstance
().
getSchemaForStorageGroup
(
storageGroupName
);
...
...
server/src/main/java/org/apache/iotdb/db/utils/
File
SchemaUtils.java
→
server/src/main/java/org/apache/iotdb/db/utils/SchemaUtils.java
浏览文件 @
064523e2
...
...
@@ -25,9 +25,9 @@ import org.apache.iotdb.tsfile.write.schema.Schema;
import
org.apache.iotdb.tsfile.write.schema.MeasurementSchema
;
public
class
File
SchemaUtils
{
public
class
SchemaUtils
{
private
File
SchemaUtils
(){}
private
SchemaUtils
(){}
/**
* Construct the Schema of the FileNode named processorName.
...
...
@@ -35,19 +35,19 @@ public class FileSchemaUtils {
* @return the schema of the FileNode named processorName.
* @throws WriteProcessException when the fileSchema cannot be created.
*/
public
static
Schema
construct
File
Schema
(
String
processorName
)
{
public
static
Schema
constructSchema
(
String
processorName
)
{
List
<
MeasurementSchema
>
columnSchemaList
;
columnSchemaList
=
MManager
.
getInstance
().
getSchemaForStorageGroup
(
processorName
);
return
get
File
SchemaFromColumnSchema
(
columnSchemaList
);
return
getSchemaFromColumnSchema
(
columnSchemaList
);
}
/**
* get
File
SchemaFromColumnSchema construct a Schema using the schema of the columns and the
* getSchemaFromColumnSchema construct a Schema using the schema of the columns and the
* device type.
* @param schemaList the schema of the columns in this file.
* @return a Schema contains the provided schemas.
*/
public
static
Schema
get
File
SchemaFromColumnSchema
(
List
<
MeasurementSchema
>
schemaList
)
{
public
static
Schema
getSchemaFromColumnSchema
(
List
<
MeasurementSchema
>
schemaList
)
{
Schema
schema
=
new
Schema
();
for
(
MeasurementSchema
measurementSchema
:
schemaList
)
{
schema
.
registerMeasurement
(
measurementSchema
);
...
...
server/src/test/java/org/apache/iotdb/db/engine/storagegroup/TsFileProcessorTest.java
浏览文件 @
064523e2
...
...
@@ -36,7 +36,7 @@ import org.apache.iotdb.db.exception.TsFileProcessorException;
import
org.apache.iotdb.db.qp.physical.crud.InsertPlan
;
import
org.apache.iotdb.db.query.context.QueryContext
;
import
org.apache.iotdb.db.utils.EnvironmentUtils
;
import
org.apache.iotdb.db.utils.
File
SchemaUtils
;
import
org.apache.iotdb.db.utils.SchemaUtils
;
import
org.apache.iotdb.db.utils.TimeValuePair
;
import
org.apache.iotdb.tsfile.exception.write.WriteProcessException
;
import
org.apache.iotdb.tsfile.file.metadata.ChunkGroupMetaData
;
...
...
@@ -77,7 +77,7 @@ public class TsFileProcessorTest {
public
void
testWriteAndFlush
()
throws
WriteProcessException
,
IOException
,
TsFileProcessorException
{
processor
=
new
TsFileProcessor
(
storageGroup
,
new
File
(
filePath
),
FileSchemaUtils
.
constructFile
Schema
(
deviceId
),
SysTimeVersionController
.
INSTANCE
,
x
->
{
SchemaUtils
.
construct
Schema
(
deviceId
),
SysTimeVersionController
.
INSTANCE
,
x
->
{
},
()
->
true
,
true
);
...
...
@@ -124,7 +124,7 @@ public class TsFileProcessorTest {
public
void
testWriteAndRestoreMetadata
()
throws
IOException
{
processor
=
new
TsFileProcessor
(
storageGroup
,
new
File
(
filePath
),
FileSchemaUtils
.
constructFile
Schema
(
deviceId
),
SysTimeVersionController
.
INSTANCE
,
x
->
{
SchemaUtils
.
construct
Schema
(
deviceId
),
SysTimeVersionController
.
INSTANCE
,
x
->
{
},
()
->
true
,
true
);
...
...
@@ -191,7 +191,7 @@ public class TsFileProcessorTest {
public
void
testMultiFlush
()
throws
WriteProcessException
,
IOException
,
TsFileProcessorException
{
processor
=
new
TsFileProcessor
(
storageGroup
,
new
File
(
filePath
),
FileSchemaUtils
.
constructFile
Schema
(
deviceId
),
SysTimeVersionController
.
INSTANCE
,
x
->
{
SchemaUtils
.
construct
Schema
(
deviceId
),
SysTimeVersionController
.
INSTANCE
,
x
->
{
},
()
->
true
,
true
);
...
...
@@ -227,7 +227,7 @@ public class TsFileProcessorTest {
public
void
testWriteAndClose
()
throws
WriteProcessException
,
IOException
{
processor
=
new
TsFileProcessor
(
storageGroup
,
new
File
(
filePath
),
FileSchemaUtils
.
constructFile
Schema
(
deviceId
),
SysTimeVersionController
.
INSTANCE
,
SchemaUtils
.
construct
Schema
(
deviceId
),
SysTimeVersionController
.
INSTANCE
,
unsealedTsFileProcessor
->
{
TsFileResource
resource
=
unsealedTsFileProcessor
.
getTsFileResource
();
synchronized
(
resource
)
{
...
...
tsfile/src/test/java/org/apache/iotdb/tsfile/write/ReadPageInMemTest.java
浏览文件 @
064523e2
...
...
@@ -49,7 +49,7 @@ public class ReadPageInMemTest {
private
int
pageCheckSizeThreshold
;
private
int
defaultMaxStringLength
;
private
static
Schema
get
File
Schema
()
{
private
static
Schema
getSchema
()
{
Schema
schema
=
new
Schema
();
TSFileConfig
conf
=
TSFileDescriptor
.
getInstance
().
getConfig
();
schema
.
registerMeasurement
(
new
MeasurementSchema
(
"s1"
,
TSDataType
.
INT32
,
TSEncoding
.
valueOf
(
conf
.
valueEncoder
)));
...
...
@@ -70,7 +70,7 @@ public class ReadPageInMemTest {
conf
.
pageCheckSizeThreshold
=
1
;
defaultMaxStringLength
=
conf
.
maxStringLength
;
conf
.
maxStringLength
=
2
;
schema
=
get
File
Schema
();
schema
=
getSchema
();
innerWriter
=
new
TsFileWriter
(
new
File
(
filePath
),
schema
,
conf
);
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录