File tree Expand file tree Collapse file tree 13 files changed +73
-31
lines changed
gateway/behaviour/tablestore/operations Expand file tree Collapse file tree 13 files changed +73
-31
lines changed Original file line number Diff line number Diff line change @@ -10,7 +10,12 @@ TConclusionStatus TUpsertOptionsOperation::DoDeserialize(NYql::TObjectSettingsIm
10
10
return TConclusionStatus::Fail (" Incorrect value for SCHEME_NEED_ACTUALIZATION: cannot parse as boolean" );
11
11
}
12
12
SchemeNeedActualization = *value;
13
- ExternalGuaranteeExclusivePK = features.Extract <bool >(" EXTERNAL_GUARANTEE_EXCLUSIVE_PK" );
13
+ ScanReaderPolicyName = features.Extract <TString>(" SCAN_READER_POLICY_NAME" );
14
+ if (ScanReaderPolicyName) {
15
+ if (*ScanReaderPolicyName != " PLAIN" && *ScanReaderPolicyName != " SIMPLE" ) {
16
+ return TConclusionStatus::Fail (" SCAN_READER_POLICY_NAME have to be in ['PLAIN', 'SIMPLE']" );
17
+ }
18
+ }
14
19
if (const auto className = features.Extract <TString>(" COMPACTION_PLANNER.CLASS_NAME" )) {
15
20
if (!CompactionPlannerConstructor.Initialize (*className)) {
16
21
return TConclusionStatus::Fail (" incorrect class name for compaction planner:" + *className);
@@ -52,8 +57,8 @@ TConclusionStatus TUpsertOptionsOperation::DoDeserialize(NYql::TObjectSettingsIm
52
57
53
58
void TUpsertOptionsOperation::DoSerializeScheme (NKikimrSchemeOp::TAlterColumnTableSchema& schemaData) const {
54
59
schemaData.MutableOptions ()->SetSchemeNeedActualization (SchemeNeedActualization);
55
- if (ExternalGuaranteeExclusivePK ) {
56
- schemaData.MutableOptions ()->SetExternalGuaranteeExclusivePK (*ExternalGuaranteeExclusivePK );
60
+ if (ScanReaderPolicyName ) {
61
+ schemaData.MutableOptions ()->SetScanReaderPolicyName (*ScanReaderPolicyName );
57
62
}
58
63
if (CompactionPlannerConstructor.HasObject ()) {
59
64
CompactionPlannerConstructor.SerializeToProto (*schemaData.MutableOptions ()->MutableCompactionPlannerConstructor ());
Original file line number Diff line number Diff line change @@ -13,7 +13,7 @@ class TUpsertOptionsOperation: public ITableStoreOperation {
13
13
static inline const auto Registrator = TFactory::TRegistrator<TUpsertOptionsOperation>(GetTypeName());
14
14
private:
15
15
bool SchemeNeedActualization = false ;
16
- std::optional<bool > ExternalGuaranteeExclusivePK ;
16
+ std::optional<TString> ScanReaderPolicyName ;
17
17
NOlap::NStorageOptimizer::TOptimizerPlannerConstructorContainer CompactionPlannerConstructor;
18
18
NOlap::NDataAccessorControl::TMetadataManagerConstructorContainer MetadataManagerConstructor;
19
19
public:
Original file line number Diff line number Diff line change @@ -75,6 +75,33 @@ Y_UNIT_TEST_SUITE(KqpOlapAggregations) {
75
75
Cout << result << Endl;
76
76
CompareYson (result, R"( [[23000u;]])" );
77
77
}
78
+
79
+ {
80
+ auto alterQuery = TStringBuilder () <<
81
+ R"(
82
+ ALTER OBJECT `/Root/olapStore` (TYPE TABLESTORE) SET (ACTION=UPSERT_OPTIONS, `SCAN_READER_POLICY_NAME`=`SIMPLE`)
83
+ )" ;
84
+ auto session = tableClient.CreateSession ().GetValueSync ().GetSession ();
85
+ auto alterResult = session.ExecuteSchemeQuery (alterQuery).GetValueSync ();
86
+ UNIT_ASSERT_VALUES_EQUAL_C (alterResult.GetStatus (), NYdb::EStatus::SUCCESS, alterResult.GetIssues ().ToString ());
87
+ }
88
+
89
+ {
90
+ auto it = tableClient
91
+ .StreamExecuteScanQuery (R"(
92
+ --!syntax_v1
93
+
94
+ SELECT
95
+ COUNT(*)
96
+ FROM `/Root/olapStore/olapTable`
97
+ )" )
98
+ .GetValueSync ();
99
+
100
+ UNIT_ASSERT_C (it.IsSuccess (), it.GetIssues ().ToString ());
101
+ TString result = StreamResultToYson (it);
102
+ Cout << result << Endl;
103
+ CompareYson (result, R"( [[23000u;]])" );
104
+ }
78
105
}
79
106
80
107
Y_UNIT_TEST (AggregationCountPushdown) {
Original file line number Diff line number Diff line change @@ -516,9 +516,9 @@ message TMetadataManagerConstructorContainer {
516
516
517
517
message TColumnTableSchemeOptions {
518
518
optional bool SchemeNeedActualization = 1 [default = false ];
519
- optional bool ExternalGuaranteeExclusivePK = 2 [default = false ];
520
519
optional TCompactionPlannerConstructorContainer CompactionPlannerConstructor = 3 ;
521
520
optional TMetadataManagerConstructorContainer MetadataManagerConstructor = 4 ;
521
+ optional string ScanReaderPolicyName = 5 ;
522
522
}
523
523
524
524
message TColumnTableSchema {
@@ -560,9 +560,9 @@ message TColumnTableSchemaDiff {
560
560
561
561
message TColumnTableRequestedOptions {
562
562
optional bool SchemeNeedActualization = 1 [default = false ];
563
- optional bool ExternalGuaranteeExclusivePK = 2 ;
564
563
optional TCompactionPlannerConstructorContainer CompactionPlannerConstructor = 3 ;
565
564
optional TMetadataManagerConstructorContainer MetadataManagerConstructor = 4 ;
565
+ optional string ScanReaderPolicyName = 5 ;
566
566
}
567
567
568
568
message TAlterColumnTableSchema {
Original file line number Diff line number Diff line change @@ -116,10 +116,6 @@ class TReadMetadataBase {
116
116
return ResultIndexSchema;
117
117
}
118
118
119
- bool HasGuaranteeExclusivePK () const {
120
- return GetIndexInfo ().GetExternalGuaranteeExclusivePK ();
121
- }
122
-
123
119
ISnapshotSchema::TPtr GetLoadSchemaVerified (const TPortionInfo& porition) const ;
124
120
125
121
const std::shared_ptr<NArrow::TSchemaLite>& GetBlobSchema (const ui64 version) const {
Original file line number Diff line number Diff line change @@ -85,7 +85,7 @@ TConclusionStatus TStartMergeTask::DoExecuteImpl() {
85
85
break ;
86
86
}
87
87
}
88
- if ((MergingContext->IsExclusiveInterval () || Context-> GetCommonContext ()-> GetReadMetadata ()-> HasGuaranteeExclusivePK () ) &&
88
+ if ((MergingContext->IsExclusiveInterval ()) &&
89
89
sourcesInMemory) {
90
90
TMemoryProfileGuard mGuard (" SCAN_PROFILE::MERGE::EXCLUSIVE" , IS_DEBUG_LOG_ENABLED (NKikimrServices::TX_COLUMNSHARD_SCAN_MEMORY));
91
91
auto & container = Sources.begin ()->second ->GetStageResult ().GetBatch ();
Original file line number Diff line number Diff line change @@ -70,7 +70,6 @@ void TScanHead::OnIntervalResult(std::shared_ptr<NGroupedMemoryManager::TAllocat
70
70
}
71
71
72
72
TConclusionStatus TScanHead::Start () {
73
- const bool guaranteeExclusivePK = Context->GetCommonContext ()->GetReadMetadata ()->HasGuaranteeExclusivePK ();
74
73
TScanContext context;
75
74
for (auto itPoint = BorderPoints.begin (); itPoint != BorderPoints.end (); ++itPoint) {
76
75
auto & point = itPoint->second ;
@@ -82,8 +81,7 @@ TConclusionStatus TScanHead::Start() {
82
81
}
83
82
const bool isExclusive = context.GetCurrentSources ().size () == 1 ;
84
83
for (auto && i : context.GetCurrentSources ()) {
85
- i.second ->SetExclusiveIntervalOnly (
86
- (isExclusive && i.second ->GetExclusiveIntervalOnly () && !context.GetIsSpecialPoint ()) || guaranteeExclusivePK);
84
+ i.second ->SetExclusiveIntervalOnly ((isExclusive && i.second ->GetExclusiveIntervalOnly () && !context.GetIsSpecialPoint ()));
87
85
}
88
86
89
87
for (auto && i : point.GetFinishSources ()) {
Original file line number Diff line number Diff line change @@ -63,8 +63,22 @@ void TTxScan::Complete(const TActorContext& ctx) {
63
63
read.PathId = request.GetLocalPathId ();
64
64
read.ReadNothing = !Self->TablesManager .HasTable (read.PathId );
65
65
read.TableName = table;
66
+
66
67
const TString defaultReader =
67
- AppDataVerified ().ColumnShardConfig .GetReaderClassName () ? AppDataVerified ().ColumnShardConfig .GetReaderClassName () : " PLAIN" ;
68
+ [&]() {
69
+ const TString defGlobal =
70
+ AppDataVerified ().ColumnShardConfig .GetReaderClassName () ? AppDataVerified ().ColumnShardConfig .GetReaderClassName () : " PLAIN" ;
71
+ if (Self->HasIndex ()) {
72
+ return Self->GetIndexAs <TColumnEngineForLogs>()
73
+ .GetVersionedIndex ()
74
+ .GetLastSchema ()
75
+ ->GetIndexInfo ()
76
+ .GetScanReaderPolicyName ()
77
+ .value_or (defGlobal);
78
+ } else {
79
+ return defGlobal;
80
+ }
81
+ }();
68
82
std::unique_ptr<IScannerConstructor> scannerConstructor = [&]() {
69
83
auto sysViewPolicy = NSysView::NAbstract::ISysViewPolicy::BuildByPath (read.TableName );
70
84
if (!sysViewPolicy) {
Original file line number Diff line number Diff line change @@ -181,7 +181,9 @@ std::shared_ptr<arrow::Schema> TIndexInfo::GetColumnSchema(const ui32 columnId)
181
181
void TIndexInfo::DeserializeOptionsFromProto (const NKikimrSchemeOp::TColumnTableSchemeOptions& optionsProto) {
182
182
TMemoryProfileGuard g (" TIndexInfo::DeserializeFromProto::Options" );
183
183
SchemeNeedActualization = optionsProto.GetSchemeNeedActualization ();
184
- ExternalGuaranteeExclusivePK = optionsProto.GetExternalGuaranteeExclusivePK ();
184
+ if (optionsProto.HasScanReaderPolicyName ()) {
185
+ ScanReaderPolicyName = optionsProto.GetScanReaderPolicyName ();
186
+ }
185
187
if (optionsProto.HasCompactionPlannerConstructor ()) {
186
188
auto container =
187
189
NStorageOptimizer::TOptimizerPlannerConstructorContainer::BuildFromProto (optionsProto.GetCompactionPlannerConstructor());
Original file line number Diff line number Diff line change @@ -104,7 +104,7 @@ struct TIndexInfo: public IIndexInfo {
104
104
bool SchemeNeedActualization = false ;
105
105
std::shared_ptr<NStorageOptimizer::IOptimizerPlannerConstructor> CompactionPlannerConstructor;
106
106
std::shared_ptr<NDataAccessorControl::IManagerConstructor> MetadataManagerConstructor;
107
- bool ExternalGuaranteeExclusivePK = false ;
107
+ std::optional<TString> ScanReaderPolicyName ;
108
108
109
109
ui64 Version = 0 ;
110
110
std::vector<ui32> SchemaColumnIds;
@@ -215,8 +215,8 @@ struct TIndexInfo: public IIndexInfo {
215
215
std::shared_ptr<arrow::Scalar> GetColumnExternalDefaultValueVerified (const ui32 colId) const ;
216
216
std::shared_ptr<arrow::Scalar> GetColumnExternalDefaultValueByIndexVerified (const ui32 colIndex) const ;
217
217
218
- bool GetExternalGuaranteeExclusivePK () const {
219
- return ExternalGuaranteeExclusivePK ;
218
+ const std::optional<TString>& GetScanReaderPolicyName () const {
219
+ return ScanReaderPolicyName ;
220
220
}
221
221
222
222
const TColumnFeatures& GetColumnFeaturesVerified (const ui32 columnId) const {
You can’t perform that action at this time.
0 commit comments