Skip to content

Commit 7a0870a

Browse files
aydogduberkayaydogduberkay
authored andcommitted
add optimization level
1 parent fc217ea commit 7a0870a

149 files changed

Lines changed: 968 additions & 603 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

meta/src/meta/grammar.y

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1314,6 +1314,7 @@ def default_configure() -> transactions.Configure:
13141314
return transactions.Configure(
13151315
semantics_version=0,
13161316
ivm_config=ivm_config,
1317+
optimization_level=transactions.OptimizationLevel.OPTIMIZATION_LEVEL_DEFAULT,
13171318
)
13181319

13191320
def construct_configure(config_dict: Sequence[Tuple[String, logic.Value]]) -> transactions.Configure:
@@ -1332,9 +1333,24 @@ def construct_configure(config_dict: Sequence[Tuple[String, logic.Value]]) -> tr
13321333
maintenance_level = transactions.MaintenanceLevel.MAINTENANCE_LEVEL_OFF
13331334
ivm_config: transactions.IVMConfig = transactions.IVMConfig(level=maintenance_level)
13341335
semantics_version: int = _extract_value_int64(builtin.dict_get(config, "semantics_version"), 0)
1336+
1337+
optimization_level_val: Optional[logic.Value] = builtin.dict_get(config, "optimization_level")
1338+
optimization_level: transactions.OptimizationLevel = transactions.OptimizationLevel.OPTIMIZATION_LEVEL_DEFAULT
1339+
if (optimization_level_val is not None
1340+
and builtin.has_proto_field(optimization_level_val, 'string_value')):
1341+
if optimization_level_val.string_value == "default":
1342+
optimization_level = transactions.OptimizationLevel.OPTIMIZATION_LEVEL_DEFAULT
1343+
elif optimization_level_val.string_value == "conservative":
1344+
optimization_level = transactions.OptimizationLevel.OPTIMIZATION_LEVEL_CONSERVATIVE
1345+
elif optimization_level_val.string_value == "aggressive":
1346+
optimization_level = transactions.OptimizationLevel.OPTIMIZATION_LEVEL_AGGRESSIVE
1347+
else:
1348+
optimization_level = transactions.OptimizationLevel.OPTIMIZATION_LEVEL_DEFAULT
1349+
13351350
return transactions.Configure(
13361351
semantics_version=semantics_version,
13371352
ivm_config=ivm_config,
1353+
optimization_level=optimization_level,
13381354
)
13391355

13401356
def construct_export_csv_config(
@@ -1414,6 +1430,12 @@ def deconstruct_configure(msg: transactions.Configure) -> List[Tuple[String, log
14141430
builtin.list_push(result, builtin.tuple("ivm.maintenance_level", _make_value_string("all")))
14151431
elif msg.ivm_config.level == transactions.MaintenanceLevel.MAINTENANCE_LEVEL_OFF:
14161432
builtin.list_push(result, builtin.tuple("ivm.maintenance_level", _make_value_string("off")))
1433+
if msg.optimization_level == transactions.OptimizationLevel.OPTIMIZATION_LEVEL_DEFAULT:
1434+
builtin.list_push(result, builtin.tuple("optimization_level", _make_value_string("default")))
1435+
elif msg.optimization_level == transactions.OptimizationLevel.OPTIMIZATION_LEVEL_CONSERVATIVE:
1436+
builtin.list_push(result, builtin.tuple("optimization_level", _make_value_string("conservative")))
1437+
elif msg.optimization_level == transactions.OptimizationLevel.OPTIMIZATION_LEVEL_AGGRESSIVE:
1438+
builtin.list_push(result, builtin.tuple("optimization_level", _make_value_string("aggressive")))
14171439
builtin.list_push(result, builtin.tuple("semantics_version", _make_value_int64(msg.semantics_version)))
14181440
return builtin.list_sort(result)
14191441

proto/relationalai/lqp/v1/transactions.proto

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ message Transaction {
1616
message Configure {
1717
int64 semantics_version = 1;
1818
IVMConfig ivm_config = 2;
19+
OptimizationLevel optimization_level = 3;
1920
}
2021

2122
message IVMConfig {
@@ -29,6 +30,13 @@ enum MaintenanceLevel {
2930
MAINTENANCE_LEVEL_ALL = 3;
3031
}
3132

33+
enum OptimizationLevel {
34+
OPTIMIZATION_LEVEL_UNSPECIFIED = 0;
35+
OPTIMIZATION_LEVEL_DEFAULT = 1;
36+
OPTIMIZATION_LEVEL_CONSERVATIVE = 2;
37+
OPTIMIZATION_LEVEL_AGGRESSIVE = 3;
38+
}
39+
3240
message Sync {
3341
repeated FragmentId fragments = 1;
3442
}

sdks/go/src/lqp/v1/transactions.pb.go

Lines changed: 339 additions & 261 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

sdks/go/src/parser.go

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -775,7 +775,7 @@ func (p *Parser) construct_betree_info(key_types []*pb.Type, value_types []*pb.T
775775
func (p *Parser) default_configure() *pb.Configure {
776776
_t1856 := &pb.IVMConfig{Level: pb.MaintenanceLevel_MAINTENANCE_LEVEL_OFF}
777777
ivm_config := _t1856
778-
_t1857 := &pb.Configure{SemanticsVersion: 0, IvmConfig: ivm_config}
778+
_t1857 := &pb.Configure{SemanticsVersion: 0, IvmConfig: ivm_config, OptimizationLevel: pb.OptimizationLevel_OPTIMIZATION_LEVEL_DEFAULT}
779779
return _t1857
780780
}
781781

@@ -802,7 +802,24 @@ func (p *Parser) construct_configure(config_dict [][]interface{}) *pb.Configure
802802
ivm_config := _t1858
803803
_t1859 := p._extract_value_int64(dictGetValue(config, "semantics_version"), 0)
804804
semantics_version := _t1859
805-
_t1860 := &pb.Configure{SemanticsVersion: semantics_version, IvmConfig: ivm_config}
805+
optimization_level_val := dictGetValue(config, "optimization_level")
806+
optimization_level := pb.OptimizationLevel_OPTIMIZATION_LEVEL_DEFAULT
807+
if (optimization_level_val != nil && hasProtoField(optimization_level_val, "string_value")) {
808+
if optimization_level_val.GetStringValue() == "default" {
809+
optimization_level = pb.OptimizationLevel_OPTIMIZATION_LEVEL_DEFAULT
810+
} else {
811+
if optimization_level_val.GetStringValue() == "conservative" {
812+
optimization_level = pb.OptimizationLevel_OPTIMIZATION_LEVEL_CONSERVATIVE
813+
} else {
814+
if optimization_level_val.GetStringValue() == "aggressive" {
815+
optimization_level = pb.OptimizationLevel_OPTIMIZATION_LEVEL_AGGRESSIVE
816+
} else {
817+
optimization_level = pb.OptimizationLevel_OPTIMIZATION_LEVEL_DEFAULT
818+
}
819+
}
820+
}
821+
}
822+
_t1860 := &pb.Configure{SemanticsVersion: semantics_version, IvmConfig: ivm_config, OptimizationLevel: optimization_level}
806823
return _t1860
807824
}
808825

sdks/go/src/pretty.go

Lines changed: 97 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -363,106 +363,120 @@ func (p *PrettyPrinter) deconstruct_configure(msg *pb.Configure) [][]interface{}
363363
}
364364
}
365365
}
366-
_t1468 := p._make_value_int64(msg.GetSemanticsVersion())
367-
result = append(result, []interface{}{"semantics_version", _t1468})
366+
if msg.GetOptimizationLevel() == pb.OptimizationLevel_OPTIMIZATION_LEVEL_DEFAULT {
367+
_t1468 := p._make_value_string("default")
368+
result = append(result, []interface{}{"optimization_level", _t1468})
369+
} else {
370+
if msg.GetOptimizationLevel() == pb.OptimizationLevel_OPTIMIZATION_LEVEL_CONSERVATIVE {
371+
_t1469 := p._make_value_string("conservative")
372+
result = append(result, []interface{}{"optimization_level", _t1469})
373+
} else {
374+
if msg.GetOptimizationLevel() == pb.OptimizationLevel_OPTIMIZATION_LEVEL_AGGRESSIVE {
375+
_t1470 := p._make_value_string("aggressive")
376+
result = append(result, []interface{}{"optimization_level", _t1470})
377+
}
378+
}
379+
}
380+
_t1471 := p._make_value_int64(msg.GetSemanticsVersion())
381+
result = append(result, []interface{}{"semantics_version", _t1471})
368382
return listSort(result)
369383
}
370384

371385
func (p *PrettyPrinter) deconstruct_csv_config(msg *pb.CSVConfig) [][]interface{} {
372386
result := [][]interface{}{}
373-
_t1469 := p._make_value_int32(msg.GetHeaderRow())
374-
result = append(result, []interface{}{"csv_header_row", _t1469})
375-
_t1470 := p._make_value_int64(msg.GetSkip())
376-
result = append(result, []interface{}{"csv_skip", _t1470})
387+
_t1472 := p._make_value_int32(msg.GetHeaderRow())
388+
result = append(result, []interface{}{"csv_header_row", _t1472})
389+
_t1473 := p._make_value_int64(msg.GetSkip())
390+
result = append(result, []interface{}{"csv_skip", _t1473})
377391
if msg.GetNewLine() != "" {
378-
_t1471 := p._make_value_string(msg.GetNewLine())
379-
result = append(result, []interface{}{"csv_new_line", _t1471})
380-
}
381-
_t1472 := p._make_value_string(msg.GetDelimiter())
382-
result = append(result, []interface{}{"csv_delimiter", _t1472})
383-
_t1473 := p._make_value_string(msg.GetQuotechar())
384-
result = append(result, []interface{}{"csv_quotechar", _t1473})
385-
_t1474 := p._make_value_string(msg.GetEscapechar())
386-
result = append(result, []interface{}{"csv_escapechar", _t1474})
392+
_t1474 := p._make_value_string(msg.GetNewLine())
393+
result = append(result, []interface{}{"csv_new_line", _t1474})
394+
}
395+
_t1475 := p._make_value_string(msg.GetDelimiter())
396+
result = append(result, []interface{}{"csv_delimiter", _t1475})
397+
_t1476 := p._make_value_string(msg.GetQuotechar())
398+
result = append(result, []interface{}{"csv_quotechar", _t1476})
399+
_t1477 := p._make_value_string(msg.GetEscapechar())
400+
result = append(result, []interface{}{"csv_escapechar", _t1477})
387401
if msg.GetComment() != "" {
388-
_t1475 := p._make_value_string(msg.GetComment())
389-
result = append(result, []interface{}{"csv_comment", _t1475})
402+
_t1478 := p._make_value_string(msg.GetComment())
403+
result = append(result, []interface{}{"csv_comment", _t1478})
390404
}
391405
for _, missing_string := range msg.GetMissingStrings() {
392-
_t1476 := p._make_value_string(missing_string)
393-
result = append(result, []interface{}{"csv_missing_strings", _t1476})
394-
}
395-
_t1477 := p._make_value_string(msg.GetDecimalSeparator())
396-
result = append(result, []interface{}{"csv_decimal_separator", _t1477})
397-
_t1478 := p._make_value_string(msg.GetEncoding())
398-
result = append(result, []interface{}{"csv_encoding", _t1478})
399-
_t1479 := p._make_value_string(msg.GetCompression())
400-
result = append(result, []interface{}{"csv_compression", _t1479})
406+
_t1479 := p._make_value_string(missing_string)
407+
result = append(result, []interface{}{"csv_missing_strings", _t1479})
408+
}
409+
_t1480 := p._make_value_string(msg.GetDecimalSeparator())
410+
result = append(result, []interface{}{"csv_decimal_separator", _t1480})
411+
_t1481 := p._make_value_string(msg.GetEncoding())
412+
result = append(result, []interface{}{"csv_encoding", _t1481})
413+
_t1482 := p._make_value_string(msg.GetCompression())
414+
result = append(result, []interface{}{"csv_compression", _t1482})
401415
if msg.GetPartitionSizeMb() != 0 {
402-
_t1480 := p._make_value_int64(msg.GetPartitionSizeMb())
403-
result = append(result, []interface{}{"csv_partition_size_mb", _t1480})
416+
_t1483 := p._make_value_int64(msg.GetPartitionSizeMb())
417+
result = append(result, []interface{}{"csv_partition_size_mb", _t1483})
404418
}
405419
return listSort(result)
406420
}
407421

408422
func (p *PrettyPrinter) deconstruct_betree_info_config(msg *pb.BeTreeInfo) [][]interface{} {
409423
result := [][]interface{}{}
410-
_t1481 := p._make_value_float64(msg.GetStorageConfig().GetEpsilon())
411-
result = append(result, []interface{}{"betree_config_epsilon", _t1481})
412-
_t1482 := p._make_value_int64(msg.GetStorageConfig().GetMaxPivots())
413-
result = append(result, []interface{}{"betree_config_max_pivots", _t1482})
414-
_t1483 := p._make_value_int64(msg.GetStorageConfig().GetMaxDeltas())
415-
result = append(result, []interface{}{"betree_config_max_deltas", _t1483})
416-
_t1484 := p._make_value_int64(msg.GetStorageConfig().GetMaxLeaf())
417-
result = append(result, []interface{}{"betree_config_max_leaf", _t1484})
424+
_t1484 := p._make_value_float64(msg.GetStorageConfig().GetEpsilon())
425+
result = append(result, []interface{}{"betree_config_epsilon", _t1484})
426+
_t1485 := p._make_value_int64(msg.GetStorageConfig().GetMaxPivots())
427+
result = append(result, []interface{}{"betree_config_max_pivots", _t1485})
428+
_t1486 := p._make_value_int64(msg.GetStorageConfig().GetMaxDeltas())
429+
result = append(result, []interface{}{"betree_config_max_deltas", _t1486})
430+
_t1487 := p._make_value_int64(msg.GetStorageConfig().GetMaxLeaf())
431+
result = append(result, []interface{}{"betree_config_max_leaf", _t1487})
418432
if hasProtoField(msg.GetRelationLocator(), "root_pageid") {
419433
if msg.GetRelationLocator().GetRootPageid() != nil {
420-
_t1485 := p._make_value_uint128(msg.GetRelationLocator().GetRootPageid())
421-
result = append(result, []interface{}{"betree_locator_root_pageid", _t1485})
434+
_t1488 := p._make_value_uint128(msg.GetRelationLocator().GetRootPageid())
435+
result = append(result, []interface{}{"betree_locator_root_pageid", _t1488})
422436
}
423437
}
424438
if hasProtoField(msg.GetRelationLocator(), "inline_data") {
425439
if msg.GetRelationLocator().GetInlineData() != nil {
426-
_t1486 := p._make_value_string(string(msg.GetRelationLocator().GetInlineData()))
427-
result = append(result, []interface{}{"betree_locator_inline_data", _t1486})
440+
_t1489 := p._make_value_string(string(msg.GetRelationLocator().GetInlineData()))
441+
result = append(result, []interface{}{"betree_locator_inline_data", _t1489})
428442
}
429443
}
430-
_t1487 := p._make_value_int64(msg.GetRelationLocator().GetElementCount())
431-
result = append(result, []interface{}{"betree_locator_element_count", _t1487})
432-
_t1488 := p._make_value_int64(msg.GetRelationLocator().GetTreeHeight())
433-
result = append(result, []interface{}{"betree_locator_tree_height", _t1488})
444+
_t1490 := p._make_value_int64(msg.GetRelationLocator().GetElementCount())
445+
result = append(result, []interface{}{"betree_locator_element_count", _t1490})
446+
_t1491 := p._make_value_int64(msg.GetRelationLocator().GetTreeHeight())
447+
result = append(result, []interface{}{"betree_locator_tree_height", _t1491})
434448
return listSort(result)
435449
}
436450

437451
func (p *PrettyPrinter) deconstruct_export_csv_config(msg *pb.ExportCSVConfig) [][]interface{} {
438452
result := [][]interface{}{}
439453
if msg.PartitionSize != nil {
440-
_t1489 := p._make_value_int64(*msg.PartitionSize)
441-
result = append(result, []interface{}{"partition_size", _t1489})
454+
_t1492 := p._make_value_int64(*msg.PartitionSize)
455+
result = append(result, []interface{}{"partition_size", _t1492})
442456
}
443457
if msg.Compression != nil {
444-
_t1490 := p._make_value_string(*msg.Compression)
445-
result = append(result, []interface{}{"compression", _t1490})
458+
_t1493 := p._make_value_string(*msg.Compression)
459+
result = append(result, []interface{}{"compression", _t1493})
446460
}
447461
if msg.SyntaxHeaderRow != nil {
448-
_t1491 := p._make_value_boolean(*msg.SyntaxHeaderRow)
449-
result = append(result, []interface{}{"syntax_header_row", _t1491})
462+
_t1494 := p._make_value_boolean(*msg.SyntaxHeaderRow)
463+
result = append(result, []interface{}{"syntax_header_row", _t1494})
450464
}
451465
if msg.SyntaxMissingString != nil {
452-
_t1492 := p._make_value_string(*msg.SyntaxMissingString)
453-
result = append(result, []interface{}{"syntax_missing_string", _t1492})
466+
_t1495 := p._make_value_string(*msg.SyntaxMissingString)
467+
result = append(result, []interface{}{"syntax_missing_string", _t1495})
454468
}
455469
if msg.SyntaxDelim != nil {
456-
_t1493 := p._make_value_string(*msg.SyntaxDelim)
457-
result = append(result, []interface{}{"syntax_delim", _t1493})
470+
_t1496 := p._make_value_string(*msg.SyntaxDelim)
471+
result = append(result, []interface{}{"syntax_delim", _t1496})
458472
}
459473
if msg.SyntaxQuotechar != nil {
460-
_t1494 := p._make_value_string(*msg.SyntaxQuotechar)
461-
result = append(result, []interface{}{"syntax_quotechar", _t1494})
474+
_t1497 := p._make_value_string(*msg.SyntaxQuotechar)
475+
result = append(result, []interface{}{"syntax_quotechar", _t1497})
462476
}
463477
if msg.SyntaxEscapechar != nil {
464-
_t1495 := p._make_value_string(*msg.SyntaxEscapechar)
465-
result = append(result, []interface{}{"syntax_escapechar", _t1495})
478+
_t1498 := p._make_value_string(*msg.SyntaxEscapechar)
479+
result = append(result, []interface{}{"syntax_escapechar", _t1498})
466480
}
467481
return listSort(result)
468482
}
@@ -474,11 +488,11 @@ func (p *PrettyPrinter) deconstruct_relation_id_string(msg *pb.RelationId) strin
474488

475489
func (p *PrettyPrinter) deconstruct_relation_id_uint128(msg *pb.RelationId) *pb.UInt128Value {
476490
name := p.relationIdToString(msg)
477-
var _t1496 interface{}
491+
var _t1499 interface{}
478492
if name == nil {
479493
return p.relationIdToUint128(msg)
480494
}
481-
_ = _t1496
495+
_ = _t1499
482496
return nil
483497
}
484498

@@ -4194,8 +4208,8 @@ func (p *PrettyPrinter) pretty_debug_info(msg *pb.DebugInfo) interface{} {
41944208
for _idx, _rid := range msg.GetIds() {
41954209
p.newline()
41964210
p.write("(")
4197-
_t1497 := &pb.UInt128Value{Low: _rid.GetIdLow(), High: _rid.GetIdHigh()}
4198-
p.pprintDispatch(_t1497)
4211+
_t1500 := &pb.UInt128Value{Low: _rid.GetIdLow(), High: _rid.GetIdHigh()}
4212+
p.pprintDispatch(_t1500)
41994213
p.write(" ")
42004214
p.write(p.formatStringValue(msg.GetOrigNames()[_idx]))
42014215
p.write(")")
@@ -4353,6 +4367,25 @@ func (p *PrettyPrinter) pretty_maintenance_level(x pb.MaintenanceLevel) interfac
43534367
return nil
43544368
}
43554369

4370+
func (p *PrettyPrinter) pretty_optimization_level(x pb.OptimizationLevel) interface{} {
4371+
if x == pb.OptimizationLevel_OPTIMIZATION_LEVEL_UNSPECIFIED {
4372+
p.write("unspecified")
4373+
} else {
4374+
if x == pb.OptimizationLevel_OPTIMIZATION_LEVEL_DEFAULT {
4375+
p.write("default")
4376+
} else {
4377+
if x == pb.OptimizationLevel_OPTIMIZATION_LEVEL_CONSERVATIVE {
4378+
p.write("conservative")
4379+
} else {
4380+
if x == pb.OptimizationLevel_OPTIMIZATION_LEVEL_AGGRESSIVE {
4381+
p.write("aggressive")
4382+
}
4383+
}
4384+
}
4385+
}
4386+
return nil
4387+
}
4388+
43564389
// --- Dispatch function ---
43574390
func (p *PrettyPrinter) pprintDispatch(msg interface{}) {
43584391
switch m := msg.(type) {
@@ -4578,6 +4611,8 @@ func (p *PrettyPrinter) pprintDispatch(msg interface{}) {
45784611
p.pretty_ivm_config(m)
45794612
case pb.MaintenanceLevel:
45804613
p.pretty_maintenance_level(m)
4614+
case pb.OptimizationLevel:
4615+
p.pretty_optimization_level(m)
45814616
default:
45824617
panic(fmt.Sprintf("no pretty printer for %T", msg))
45834618
}

0 commit comments

Comments
 (0)