Revert "Revert "Fix infinite loop when insert from CSV file on Windows""

This commit is contained in:
Haolin Wang 2024-12-30 19:41:41 +08:00 committed by GitHub
parent 5006deb5ae
commit 977a452ea1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 55 additions and 1 deletions

View File

@ -1403,7 +1403,7 @@ int64_t taosGetLineFile(TdFilePtr pFile, char **__restrict ptrBuf) {
}
(*ptrBuf)[totalBytesRead] = '\0';
ret = totalBytesRead;
ret = (totalBytesRead > 0 ? totalBytesRead : -1); // -1 means EOF
#else
size_t len = 0;
ret = getline(ptrBuf, &len, pFile->fp);

View File

@ -443,6 +443,7 @@
,,y,system-test,./pytest.sh python3 ./test.py -f 1-insert/InsertFuturets.py
,,y,system-test,./pytest.sh python3 ./test.py -f 1-insert/insert_wide_column.py
,,y,system-test,./pytest.sh python3 ./test.py -f 1-insert/insert_column_value.py
,,y,system-test,./pytest.sh python3 ./test.py -f 1-insert/insert_from_csv.py
,,y,system-test,./pytest.sh python3 ./test.py -f 1-insert/rowlength64k_benchmark.py
,,y,system-test,./pytest.sh python3 ./test.py -f 1-insert/rowlength64k.py
,,y,system-test,./pytest.sh python3 ./test.py -f 1-insert/rowlength64k.py -R

View File

@ -0,0 +1,47 @@
import taos
import sys
import datetime
import inspect
import random
from util.dnodes import TDDnode
from util.dnodes import tdDnodes
from util.log import *
from util.sql import *
from util.cases import *
class TDTestCase:
def init(self, conn, logSql, replicaVar=1):
self.replicaVar = int(replicaVar)
tdLog.debug(f"start to excute {__file__}")
tdSql.init(conn.cursor(), True)
self.testcasePath = os.path.split(__file__)[0]
self.testcasePath = self.testcasePath.replace('\\', '//')
self.database = "test_insert_csv_db"
self.table = "test_insert_csv_tbl"
def insert_from_csv(self):
tdSql.execute(f"drop database if exists {self.database}")
tdSql.execute(f"create database {self.database}")
tdSql.execute(f"use {self.database}")
tdSql.execute(f"create table {self.table} (ts timestamp, c1 nchar(16), c2 double, c3 int)")
tdSql.execute(f"insert into {self.table} file '{self.testcasePath}//test_insert_from_csv.csv'")
tdSql.query(f"select count(*) from {self.table}")
tdSql.checkData(0, 0, 5)
def run(self):
tdSql.prepare()
startTime_all = time.time()
self.insert_from_csv()
endTime_all = time.time()
print("total time %ds" % (endTime_all - startTime_all))
def stop(self):
tdSql.close()
tdLog.success("%s successfully executed" % __file__)
tdCases.addWindows(__file__, TDTestCase())
tdCases.addLinux(__file__, TDTestCase())

View File

@ -0,0 +1,5 @@
'2024-12-13 09:30:00.050','ABCDEF68',24.774736842805263,200
'2024-12-13 09:30:00.060','ABCDEF68',24.774736842805263,201
'2024-12-13 09:30:00.080','ABCDEF68',24.774736842805263,202
'2024-12-13 09:30:00.100','ABCDEF68',24.774736842805263,203
'2024-12-13 09:30:00.110','ABCDEF68',24.774736842805263,204
1 '2024-12-13 09:30:00.050' 'ABCDEF68' 24.774736842805263 200
2 '2024-12-13 09:30:00.060' 'ABCDEF68' 24.774736842805263 201
3 '2024-12-13 09:30:00.080' 'ABCDEF68' 24.774736842805263 202
4 '2024-12-13 09:30:00.100' 'ABCDEF68' 24.774736842805263 203
5 '2024-12-13 09:30:00.110' 'ABCDEF68' 24.774736842805263 204

View File

@ -13,6 +13,7 @@ python3 .\test.py -f 0-others\cachemodel.py
@REM python3 .\test.py -f 0-others\fsync.py
python3 .\test.py -f 1-insert\influxdb_line_taosc_insert.py
python3 .\test.py -f 1-insert\insert_from_csv.py
@REM python3 .\test.py -f 1-insert\opentsdb_telnet_line_taosc_insert.py
@REM python3 .\test.py -f 1-insert\opentsdb_json_taosc_insert.py
@REM #python3 .\test.py -f 1-insert\test_stmt_muti_insert_query.py