Skip to content

Commit

Permalink
to_lower
Browse files Browse the repository at this point in the history
  • Loading branch information
azevaykin committed Jul 22, 2024
1 parent 4f78543 commit ed2d25e
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 2 deletions.
26 changes: 26 additions & 0 deletions ydb/core/kqp/ut/scheme/kqp_scheme_ut.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2760,6 +2760,32 @@ Y_UNIT_TEST_SUITE(KqpScheme) {
}
}


Y_UNIT_TEST(CreateTableWithVectorIndexCaseIncentive) {
NKikimrConfig::TFeatureFlags featureFlags;
featureFlags.SetEnableVectorIndex(true);
auto settings = TKikimrSettings().SetFeatureFlags(featureFlags);
TKikimrRunner kikimr(settings);
auto db = kikimr.GetTableClient();
auto session = db.CreateSession().GetValueSync().GetSession();
{
TString create_index_query = R"(
--!syntax_v1
CREATE TABLE `/Root/TestTable` (
Key Uint64,
Embedding String,
PRIMARY KEY (Key),
INDEX vector_idx
GLOBAL USING vector_KMEANS_tree
ON (Embedding)
WITH (similarity=COSINE, VECTOR_TYPE=float, vector_DIMENSION=1024)
);
)";
auto result = session.ExecuteSchemeQuery(create_index_query).ExtractValueSync();
UNIT_ASSERT_VALUES_EQUAL_C(result.GetStatus(), EStatus::SUCCESS, result.GetIssues().ToString());
}
}

Y_UNIT_TEST(CreateTableWithVectorIndexNoFeatureFlag) {
TKikimrRunner kikimr;
auto db = kikimr.GetTableClient();
Expand Down
4 changes: 2 additions & 2 deletions ydb/library/yql/sql/v1/sql_translation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -739,15 +739,15 @@ std::tuple<bool, T, TString> TSqlTranslation::GetIndexSettingValue(const TRule_i
T value;
// id_or_type
if (node.HasAlt_index_setting_value1()) {
const TString stringValue = IdEx(node.GetAlt_index_setting_value1().GetRule_id_or_type1(), *this).Name;
const TString stringValue = to_lower(IdEx(node.GetAlt_index_setting_value1().GetRule_id_or_type1(), *this).Name);
if (!TryFromString<T>(stringValue, value)) {
return {false, value, stringValue};
}
return {true, value, stringValue};
}
// STRING_VALUE
else if (node.HasAlt_index_setting_value2()) {
const TString stringValue = Token(node.GetAlt_index_setting_value2().GetToken1());
const TString stringValue = to_lower(Token(node.GetAlt_index_setting_value2().GetToken1()));
const auto unescaped = StringContent(Ctx, Ctx.Pos(), stringValue);
if (!unescaped) {
return {false, value, stringValue};
Expand Down

0 comments on commit ed2d25e

Please sign in to comment.