Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 48 additions & 0 deletions .github/workflows/pre-commit-format.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Formatting

on:
workflow_dispatch:
pull_request:
branches:
- '**'
merge_group:
branches: [ main ]
schedule:
- cron: "0 0 * * *"

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
formatting-checks:
runs-on: ubuntu-20.04

steps:
- uses: actions/checkout@v4

- name: Setup dotnet
uses: actions/setup-dotnet@v4
with:
dotnet-version: '9.0.x'

- name: Setup Python environment (for pre-commit)
uses: actions/setup-python@v5
with:
python-version: '3.10'

- name: Clean dotnet temporary folder
run: |
sudo rm -rf /tmp/.dotnet

- name: Install pre-commit and dependencies
run: |
pip install pre-commit
pre-commit install-hooks

- name: Run pre-commit checks
env:
TMPDIR: ${{ runner.temp }}
DOTNET_CLI_HOME: ${{ runner.temp }}
run: |
pre-commit run --all-files
1 change: 1 addition & 0 deletions .licenserc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,6 @@ header:
- 'Apache.IoTDB.sln'
- '.gitignore'
- '.dockerignore'
- '.pre-commit-config.yaml'

comment: on-failure
33 changes: 33 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@


repos:
- repo: local
hooks:
- id: dotnet-format
name: dotnet format
entry: dotnet format --include
language: system
pass_filenames: true
files: '\.(cs|vb|fs|sln|csproj|fsproj)$'

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-added-large-files
- id: check-yaml
- id: check-json
- id: check-xml

- repo: https://github.com/codespell-project/codespell
rev: v2.2.6
hooks:
- id: codespell
args: ["--ignore-words-list=fo,teh,ba"]

exclude: |
(?x)^(
src/Apache\.IoTDB/Rpc/|
.*\.md$
)
1 change: 0 additions & 1 deletion Apache-IoTDB-Client-CSharp-UserCase/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -118,4 +118,3 @@ static async Task Main(string[] args)
}

}

2 changes: 0 additions & 2 deletions Apache.IoTDB.sln
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "docs", "docs", "{DEAC57D3-4
docs\time_profile_zh.pdf = docs\time_profile_zh.pdf
EndProjectSection
EndProject
Project("{E53339B2-1760-4266-BCC7-CA923CBCF16C}") = "docker-compose", "docker-compose.dcproj", "{4D457769-80CB-401F-9155-C3125C04FACD}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Apache.IoTDB.Data", "src\Apache.IoTDB.Data\Apache.IoTDB.Data.csproj", "{4308656F-D174-49A6-ACE4-15894B017D55}"
EndProject
Global
Expand Down
2 changes: 1 addition & 1 deletion docker-compose-2c2d.yml
Original file line number Diff line number Diff line change
Expand Up @@ -130,4 +130,4 @@ services:
dockerfile: samples/Apache.IoTDB.Samples/Dockerfile
command: ["--multi", "localhost:6667", "localhost:6668"]
# command: ["sleep", "infinity"]
network_mode: host
network_mode: host
6 changes: 3 additions & 3 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ services:
networks:
iotdb-network:
ipv4_address: 172.18.0.2

iotdb:
image: apache/iotdb:2.0.1-beta-datanode
restart: always
Expand All @@ -38,7 +38,7 @@ services:
- dn_rpc_address=iotdb
- dn_internal_address=iotdb
- dn_seed_config_node=iotdb-confignode-1:22277

iotdb-confignode-1:
image: apache/iotdb:2.0.1-beta-confignode
restart: always
Expand All @@ -58,6 +58,6 @@ services:
- cn_seed_config_node=iotdb-confignode-1:22277


networks:
networks:
iotdb-network:
external: true
2 changes: 1 addition & 1 deletion launchSettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@
}
}
}
}
}
2 changes: 1 addition & 1 deletion samples/Apache.IoTDB.Samples/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,4 @@ RUN dotnet publish "Apache.IoTDB.Samples.csproj" -c Release -o /app/publish
FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "Apache.IoTDB.Samples.dll"]
ENTRYPOINT ["dotnet", "Apache.IoTDB.Samples.dll"]
60 changes: 30 additions & 30 deletions samples/Apache.IoTDB.Samples/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,48 +35,48 @@ public static async Task Main(string[] args)
() => "localhost",
description: "Use single endpoint (e.g. --single localhost)");

var multiOption = new Option<List<string>>(
"--multi",
description: "Use multiple endpoints (e.g. --multi localhost:6667 localhost:6668)")
{
AllowMultipleArgumentsPerToken = true
};
var multiOption = new Option<List<string>>(
"--multi",
description: "Use multiple endpoints (e.g. --multi localhost:6667 localhost:6668)")
{
AllowMultipleArgumentsPerToken = true
};

var rootCommand = new RootCommand
var rootCommand = new RootCommand
{
singleOption,
multiOption
};

rootCommand.SetHandler(async (string single, List<string> multi) =>
{
var utilsTest = new UtilsTest();
utilsTest.TestParseEndPoint();
rootCommand.SetHandler(async (string single, List<string> multi) =>
{
var utilsTest = new UtilsTest();
utilsTest.TestParseEndPoint();

SessionPoolTest sessionPoolTest;
SessionPoolTest sessionPoolTest;

if (!string.IsNullOrEmpty(single) && (multi == null || multi.Count == 0))
{
sessionPoolTest = new SessionPoolTest(single);
}
else if (multi != null && multi.Count != 0)
{
sessionPoolTest = new SessionPoolTest(multi);
}
else
{
Console.WriteLine("Please specify either --single or --multi endpoints.");
return;
}
if (!string.IsNullOrEmpty(single) && (multi == null || multi.Count == 0))
{
sessionPoolTest = new SessionPoolTest(single);
}
else if (multi != null && multi.Count != 0)
{
sessionPoolTest = new SessionPoolTest(multi);
}
else
{
Console.WriteLine("Please specify either --single or --multi endpoints.");
return;
}

await sessionPoolTest.Test();
await sessionPoolTest.Test();

var tableSessionPoolTest = new TableSessionPoolTest(sessionPoolTest);
await tableSessionPoolTest.Test();
var tableSessionPoolTest = new TableSessionPoolTest(sessionPoolTest);
await tableSessionPoolTest.Test();

}, singleOption, multiOption);
}, singleOption, multiOption);

await rootCommand.InvokeAsync(args);
await rootCommand.InvokeAsync(args);
}

public static void OpenDebugMode(this SessionPool session)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@
"commandName": "Docker"
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -496,4 +496,4 @@ public async Task TestInsertAlignedStringRecordsOfOneDevice()
Console.WriteLine("TestInsertAlignedStringRecordsOfOneDevice Passed!");
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -192,4 +192,4 @@ public async Task TestInsertAlignedTablets()
Console.WriteLine("TestInsertAlignedTablets Passed!");
}
}
}
}
8 changes: 4 additions & 4 deletions samples/Apache.IoTDB.Samples/SessionPoolTest.Record.cs
Original file line number Diff line number Diff line change
Expand Up @@ -305,12 +305,12 @@ public async Task TestInsertRecords()
row = res.Next();
break;
}

Console.WriteLine($"{testDatabaseName}.{testDevice}.{row.Measurements[0]} {testMeasurements[3]}");
System.Diagnostics.Debug.Assert($"{testDatabaseName}.{testDevice}.{testMeasurements[3]}" == row.Measurements[0]);
System.Diagnostics.Debug.Assert($"{testDatabaseName}.{testDevice}.{testMeasurements[1]}" == row.Measurements[1]);
System.Diagnostics.Debug.Assert($"{testDatabaseName}.{testDevice}.{testMeasurements[2]}" == row.Measurements[2]);

status = await session_pool.DeleteDatabaseAsync(testDatabaseName);
System.Diagnostics.Debug.Assert(status == 0);
await session_pool.Close();
Expand Down Expand Up @@ -641,7 +641,7 @@ public async Task TestInsertRecordsWithAllType()
var rowRecord2 = new RowRecord(2, values2, measurements, dataTypes);
var rowRecord3 = new RowRecord(3, values3, measurements, dataTypes);

var device_id = new List<string> { string.Format("{0}.{1}", testDatabaseName, testDevice),string.Format("{0}.{1}", testDatabaseName, testDevice),string.Format("{0}.{1}", testDatabaseName, testDevice) };
var device_id = new List<string> { string.Format("{0}.{1}", testDatabaseName, testDevice), string.Format("{0}.{1}", testDatabaseName, testDevice), string.Format("{0}.{1}", testDatabaseName, testDevice) };
var rowRecords = new List<RowRecord> { rowRecord1, rowRecord2, rowRecord3 };

status = await session_pool.InsertRecordsAsync(device_id, rowRecords);
Expand All @@ -664,4 +664,4 @@ public async Task TestInsertRecordsWithAllType()
Console.WriteLine("TestInsertRecordsWithAllType Passed!");
}
}
}
}
2 changes: 1 addition & 1 deletion samples/Apache.IoTDB.Samples/SessionPoolTest.Tablet.cs
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ public async Task TestInsertTabletWithAllType()
TSDataType.BLOB,
TSDataType.STRING
};
var timestamps = new List<long> {1, 2};
var timestamps = new List<long> { 1, 2 };
var tablet = new Tablet(device_id, measurements, datatypes, values, timestamps);
status = await session_pool.InsertTabletAsync(tablet);
System.Diagnostics.Debug.Assert(status == 0);
Expand Down
2 changes: 1 addition & 1 deletion samples/Apache.IoTDB.Samples/SessionPoolTest.Template.cs
Original file line number Diff line number Diff line change
Expand Up @@ -101,4 +101,4 @@ public async Task TestSetAndUnsetSchemaTemplate()
}
}

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -351,4 +351,4 @@ public async Task TestTestInsertTablets()
}

}
}
}
2 changes: 1 addition & 1 deletion samples/Apache.IoTDB.Samples/SessionPoolTest.TimeSeries.cs
Original file line number Diff line number Diff line change
Expand Up @@ -194,4 +194,4 @@ await session_pool.CreateTimeSeries(
}
}

}
}
13 changes: 8 additions & 5 deletions samples/Apache.IoTDB.Samples/SessionPoolTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,8 @@ public SessionPoolTest(List<string> _nodeUrls)
}
public async Task Test()
{
if(nodeUrls.Count == 1){
if (nodeUrls.Count == 1)
{
await TestOpenWithNodeUrls();

await TestOpenWith2NodeUrls();
Expand Down Expand Up @@ -147,7 +148,8 @@ public async Task Test()

await TestNonSqlBy_ADO();
}
else {
else
{
await TestMultiNodeDataFetch();
}
}
Expand Down Expand Up @@ -580,7 +582,8 @@ public async Task TestLastDataQuery()
Console.WriteLine("LastDataQuery Passed");
}

public async Task TestMultiNodeDataFetch(){
public async Task TestMultiNodeDataFetch()
{
System.Diagnostics.Debug.Assert(nodeUrls.Count > 1, "nodeUrls.Count should be greater than 1 in MultiNode Test");
var session_pool = new SessionPool.Builder()
.SetUsername(username)
Expand All @@ -596,7 +599,7 @@ public async Task TestMultiNodeDataFetch(){
var data_type_lst = new List<TSDataType> { TSDataType.BOOLEAN, TSDataType.FLOAT };
var encoding_lst = new List<TSEncoding> { TSEncoding.PLAIN, TSEncoding.PLAIN };
var compressor_lst = new List<Compressor> { Compressor.SNAPPY, Compressor.SNAPPY };
var ts_path_lst = new List<string>() {
var ts_path_lst = new List<string>() {
string.Format("{0}.{1}.{2}", testDatabaseName, testDevice, testMeasurements[0]),
string.Format("{0}.{1}.{2}", testDatabaseName, testDevice, testMeasurements[1])
};
Expand Down Expand Up @@ -631,4 +634,4 @@ public async Task TestMultiNodeDataFetch(){
Console.WriteLine("MultiNodeDataFetch Passed");
}
}
}
}
Loading
Loading