Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added faster alternative to InVirtualSet() #874

Open
wants to merge 51 commits into
base: main
Choose a base branch
from

Conversation

soham-bentley
Copy link
Contributor

@soham-bentley soham-bentley commented Sep 30, 2024

@soham-bentley soham-bentley marked this pull request as ready for review October 25, 2024 05:40
@soham-bentley
Copy link
Contributor Author

/azp run imodel-native

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@soham-bentley
Copy link
Contributor Author

/azp run imodel-native

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

Copy link

mergify bot commented Nov 5, 2024

This pull request is now in conflicts. Could you fix it @soham-bentley? 🙏
To fixup this pull request, you can check out it locally. See documentation: https://help.github.com/articles/checking-out-pull-requests-locally/

@soham-bentley soham-bentley marked this pull request as draft January 6, 2025 14:56
@soham-bentley soham-bentley marked this pull request as ready for review January 15, 2025 09:25
@soham-bentley
Copy link
Contributor Author

soham-bentley commented Jan 15, 2025

/azp run imodel-native

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

//=======================================================================================
enum StatementState
{
// The first four values are in accordance with sqlite3.c
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this enum structure and these associated comments okay?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Phew, this is uncharted terrain for me, but I see the native values for VDBE*State are only the first four of these. NOT_PREPARED is not part of the values.
Given that they may add additional values, and the next one would be assigned = 4, this seems dangerous.
It seems much more robust to me to only expose the states which they use and always call "IsPrepared()" before that. That seems to be the intended design.

Your abstraction makes it more convenient to use, but in this case, modifying the API as little as possible seems better.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree with Rob

}
{
ECSqlStatement stmt;
ASSERT_EQ(ECSqlStatus::Success, stmt.Prepare(m_ecdb, "SELECT ECClassId FROM ECVLib.IdSet('[1,2,3,4,5]'), meta.ECClassDef where ECClassId = id group by ECClassId"));
Copy link
Contributor Author

@soham-bentley soham-bentley Jan 16, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These are the query plan tests. How do these query plans look? @khanaffan

@soham-bentley soham-bentley requested a review from rschili January 16, 2025 08:45
@soham-bentley soham-bentley requested a review from rschili January 20, 2025 12:15
@@ -684,7 +684,7 @@ void ECSqlExpPreparer::RemovePropertyRefs(ECSqlPrepareContext& ctx, ClassRefExp
if (propertyNameExp->IsPropertyRef())
continue;
if (propertyNameExp->IsVirtualProperty())
break;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This "break" statement was stopping properties to be added and causing a malfunction in case of JOINS with virtual tables
Is there any specific reason why this was "break" and not "continue" ? @khanaffan @ColinKerr @rschili

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i do not think its a feature, its a bug :)

Comment on lines +211 to +238
DbResult IdSetModule::IdSetTable::IdSetCursor::FilterJSONBasedOnType(BeJsConst& val) {
if(val.isNull())
{
return BE_SQLITE_ERROR;
}
else if(val.isNumeric())
{
uint64_t id = val.GetUInt64();
if(id == 0)
return BE_SQLITE_ERROR;
m_idSet.insert(id);
}
else if(val.isString())
{
uint64_t id;
BentleyStatus status = BeStringUtilities::ParseUInt64(id, val.ToUtf8CP());
if(status != BentleyStatus::SUCCESS)
return BE_SQLITE_ERROR;
if(id == 0)
return BE_SQLITE_ERROR;
m_idSet.insert(id);
}
else
return BE_SQLITE_ERROR;
return BE_SQLITE_OK;
}

//---------------------------------------------------------------------------------------
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR has inconsistent bracket style. Even within one method you are switching style. Please use a consistent style, the style used by the rest of the C++ code is preferred

@ColinKerr
Copy link
Member

Have we gotten feedback on this new syntax? If not I suggest that we put this behind the experimental flag so we can release and get feedback before we lock in on it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants