diff --git a/tests/examples/c/schemaless.c b/tests/examples/c/schemaless.c index a254e3b786244cd90ba489dbba0c066eb3769a41..f937d06603baa7d8f01a961a2f0e6ed43e6414d5 100644 --- a/tests/examples/c/schemaless.c +++ b/tests/examples/c/schemaless.c @@ -13,8 +13,8 @@ int numThreads = 8; int numSuperTables = 1; -int numChildTables = 1024; -int numRowsPerChildTable = 16384; +int numChildTables = 16; +int numRowsPerChildTable = 8192; int maxLinesPerBatch = 16384; @@ -92,13 +92,27 @@ int main(int argc, char* argv[]) { time_t ct = time(0); int64_t ts = ct * 1000; - char* lineFormat = "sta%d,t0=true,t1=127i8,t2=32767i16,t3=%di32,t4=9223372036854775807i64,t9=11.12345f32,t10=22.123456789f64,t11=\"binaryTagValue\",t12=L\"ncharTagValue\" c0=true,c1=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=254u8,c6=32770u16,c7=2147483699u32,c8=9223372036854775899u64,c9=11.12345f32,c10=22.123456789f64,c11=\"binaryValue\",c12=L\"ncharValue\" %lldms"; + + //char* sample = "sta%d,t0=true,t1=127i8,t2=32767i16,t3=%di32,t4=9223372036854775807i64,t9=11.12345f32,t10=22.123456789f64,t11=\"binaryTagValue\",t12=L\"ncharTagValue\" c0=true,c1=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=254u8,c6=32770u16,c7=2147483699u32,c8=9223372036854775899u64,c9=11.12345f32,c10=22.123456789f64,c11=\"binaryValue\",c12=L\"ncharValue\" %lldms"; + + char* lineTemplate = calloc(65536, sizeof(char)); + char* lineFormatTable = "sta%d,t0=true,t1=127i8,t2=32767i16,t3=%di32 "; + snprintf(lineTemplate+strlen(lineTemplate), 65535-strlen(lineTemplate), "%s", lineFormatTable); + + for (int i=0; i<800; i++) { + snprintf(lineTemplate+strlen(lineTemplate), 65535-strlen(lineTemplate), "c%d=%df64,", i, i); + } + for (int i = 800; i < 1000; ++i) { + snprintf(lineTemplate+strlen(lineTemplate), 65535-strlen(lineTemplate), "c%d=\"%d\",", i, i); + } + char* lineFormatTs = " %lldms"; + snprintf(lineTemplate+strlen(lineTemplate)-1, 65535-strlen(lineTemplate)+1, "%s", lineFormatTs); { char** linesStb = calloc(numSuperTables, sizeof(char*)); for (int i = 0; i < numSuperTables; i++) { - char* lineStb = calloc(512, 1); - snprintf(lineStb, 512, lineFormat, i, + char* lineStb = calloc(strlen(lineTemplate)+128, 1); + snprintf(lineStb, strlen(lineTemplate)+128, lineTemplate, i, numSuperTables * numChildTables, ts + numSuperTables * numChildTables * numRowsPerChildTable); linesStb[i] = lineStb; @@ -143,8 +157,8 @@ int main(int argc, char* argv[]) { for (int k = 0; k < numRowsPerChildTable; ++k) { int stIdx = i; int ctIdx = numSuperTables*numChildTables + j; - char* line = calloc(512, 1); - snprintf(line, 512, lineFormat, stIdx, ctIdx, ts + 10 * l); + char* line = calloc(strlen(lineTemplate)+128, 1); + snprintf(line, strlen(lineTemplate)+128, lineTemplate, stIdx, ctIdx, ts + 10 * l); int batchNo = l / maxLinesPerBatch; int lineNo = l % maxLinesPerBatch; allBatches[batchNo][lineNo] = line;