Skip to content
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion src/queuecreator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1130,7 +1130,14 @@ bool QueueCreator_c::ParseQueryItem ( const CSphQueryItem & tItem )
{
CSphQueryItem tUuidItem = tItem;
tUuidItem.m_sExpr = sphGetUuidDocidName();
if ( tUuidItem.m_sAlias.IsEmpty() || tUuidItem.m_sAlias==sphGetDocidName() )
bool bNeedsDocid = m_tQuery.m_eQueryType==QUERY_SQL && m_tQuery.m_dItems.any_of ( [&] ( const CSphQueryItem & tQueryItem )
{
const CSphColumnInfo * pField = m_tSettings.m_tSchema.GetField ( tQueryItem.m_sExpr.cstr() );
return tQueryItem.m_sExpr=="*" || ( pField && ( pField->m_uFieldFlags & CSphColumnInfo::FIELD_STORED ) );
} );
if ( bNeedsDocid )
tUuidItem.m_sAlias = sphGetUuidDocidName();
else if ( tUuidItem.m_sAlias.IsEmpty() || tUuidItem.m_sAlias==sphGetDocidName() )
Comment thread
sanikolaev marked this conversation as resolved.
Outdated
tUuidItem.m_sAlias = sphGetDocidName();
return ParseResolvedQueryItem ( tUuidItem );
}
Expand Down
1 change: 1 addition & 0 deletions test/test_506/model.bin
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
a:1:{i:0;a:6:{i:0;a:2:{s:8:"sphinxql";s:73:"CREATE TABLE uuid_stored_text ( id uuid, merchant_id string, title text )";s:14:"total_affected";i:0;}i:1;a:2:{s:8:"sphinxql";s:77:"CREATE TABLE bigint_stored_text ( id bigint, merchant_id string, title text )";s:14:"total_affected";i:0;}i:2;a:2:{s:8:"sphinxql";s:136:"REPLACE INTO uuid_stored_text ( id, merchant_id, title ) VALUES ( '550e8400-e29b-41d4-a716-846655440001', 'merchant-1', 'Widget Alpha' )";s:14:"total_affected";i:1;}i:3;a:2:{s:8:"sphinxql";s:101:"REPLACE INTO bigint_stored_text ( id, merchant_id, title ) VALUES ( 1, 'merchant-1', 'Widget Alpha' )";s:14:"total_affected";i:1;}i:4;a:3:{s:8:"sphinxql";s:73:"SELECT id, merchant_id, title FROM uuid_stored_text WHERE MATCH('Widget')";s:10:"total_rows";i:1;s:4:"rows";a:1:{i:0;a:3:{s:2:"id";s:36:"550e8400-e29b-41d4-a716-846655440001";s:11:"merchant_id";s:10:"merchant-1";s:5:"title";s:12:"Widget Alpha";}}}i:5;a:3:{s:8:"sphinxql";s:75:"SELECT id, merchant_id, title FROM bigint_stored_text WHERE MATCH('Widget')";s:10:"total_rows";i:1;s:4:"rows";a:1:{i:0;a:3:{s:2:"id";s:1:"1";s:11:"merchant_id";s:10:"merchant-1";s:5:"title";s:12:"Widget Alpha";}}}}}
30 changes: 30 additions & 0 deletions test/test_506/test.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?xml version="1.0" encoding="utf-8"?>
<test>
<name>UUID id SQL projection preserves stored text fields</name>

<requires>
<force-rt/>
</requires>
<skip_indexer/>
<skip_db/>

<config>
searchd
{
<searchd_settings/>
data_dir = <data_path path="data0"/>
binlog_path =
}
</config>

<queries>
<sphinxql>
CREATE TABLE uuid_stored_text ( id uuid, merchant_id string, title text );
CREATE TABLE bigint_stored_text ( id bigint, merchant_id string, title text );
REPLACE INTO uuid_stored_text ( id, merchant_id, title ) VALUES ( '550e8400-e29b-41d4-a716-846655440001', 'merchant-1', 'Widget Alpha' );
REPLACE INTO bigint_stored_text ( id, merchant_id, title ) VALUES ( 1, 'merchant-1', 'Widget Alpha' );
SELECT id, merchant_id, title FROM uuid_stored_text WHERE MATCH('Widget');
SELECT id, merchant_id, title FROM bigint_stored_text WHERE MATCH('Widget');
</sphinxql>
</queries>
</test>
2 changes: 1 addition & 1 deletion test/test_518/test.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
searchd
{
<searchd_settings/>
data_dir = <data_path/>
data_dir = <data_path path="data0"/>
auto_optimize = 0
}
</config>
Expand Down
2 changes: 1 addition & 1 deletion test/test_520/test.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
searchd
{
<searchd_settings/>
data_dir = <data_path/>
data_dir = <data_path path="data0"/>
secondary_indexes = 0
}
</config>
Expand Down