Browse Source

exclude field-len columns from streamed dump

field-len columns is automatic columns injected when index has
index_field_lengths=1 setting. They should not be returned in result of
SELECT /*!40001 SQL_NO_CACHE */...
Also they should not be returned in 'show fields from...' statement.

Related to #2265
Aleksey N. Vinogradov 1 year ago
parent
commit
fbfcac2cf9
4 changed files with 22 additions and 0 deletions
  1. 3 0
      src/searchd.cpp
  2. 4 0
      src/sphinxsort.cpp
  3. 0 0
      test/test_272/model.bin
  4. 15 0
      test/test_272/test.xml

+ 3 - 0
src/searchd.cpp

@@ -12361,6 +12361,9 @@ void ShowFields ( VectorLike& dOut, const CSphSchema& tSchema )
 		if ( sphIsInternalAttr ( tAttr ) )
 			continue;
 
+		if ( tAttr.m_eAttrType==SPH_ATTR_TOKENCOUNT )
+			continue;
+
 		if ( tSchema.GetField ( tAttr.m_sName.cstr() ) )
 			continue; // already described it as a field property
 

+ 4 - 0
src/sphinxsort.cpp

@@ -680,6 +680,8 @@ void SendSqlSchema ( const ISphSchema& tSchema, RowBuffer_i* pRows, const VecTra
 			pRows->HeadColumn ( "id", ESphAttr2MysqlColumnStreamed ( SPH_ATTR_UINT64 ) );
 			continue;
 		}
+		if ( tCol.m_eAttrType==SPH_ATTR_TOKENCOUNT )
+			continue;
 		pRows->HeadColumn ( tCol.m_sName.cstr(), ESphAttr2MysqlColumnStreamed ( tCol.m_eAttrType ) );
 	}
 
@@ -696,6 +698,8 @@ void SendSqlMatch ( const ISphSchema& tSchema, RowBuffer_i* pRows, CSphMatch& tM
 		const CSphColumnInfo& dAttr = tSchema.GetAttr ( dOrder[i] );
 		if ( sphIsInternalAttr ( dAttr ) )
 			continue;
+		if ( dAttr.m_eAttrType==SPH_ATTR_TOKENCOUNT )
+			continue;
 
 		CSphAttrLocator tLoc = dAttr.m_tLocator;
 		ESphAttr eAttrType = dAttr.m_eAttrType;

File diff suppressed because it is too large
+ 0 - 0
test/test_272/model.bin


+ 15 - 0
test/test_272/test.xml

@@ -22,6 +22,15 @@ index indexrt
 	stored_fields = text
 }
 
+index check
+{
+	type			= rt
+	path 			= <data_path/>/check
+	rt_field		= text
+	stored_fields = text
+	index_field_lengths = 1
+}
+
 </Config>
 
 <queries>
@@ -32,6 +41,7 @@ index indexrt
 	insert into indexrt values (5,'text five',2),(6,'text six',3);
 	flush ramchunk indexrt;
 	insert into indexrt values (7,'text seven',3),(8,'text eight',3);
+	insert into check values (7,'text seven'),(8,'text eight');
 
 <!-- stuff from mysqldump in usual mode -->
 /*!40100 SET @@SQL_MODE='' */;
@@ -91,6 +101,11 @@ SET SESSION character_set_results = 'binary';
 SELECT COLUMN_NAME,                       JSON_EXTRACT(HISTOGRAM, '$."number-of-buckets-specified"')                FROM information_schema.COLUMN_STATISTICS                WHERE SCHEMA_NAME = 'manticore' AND TABLE_NAME = 'indexrt';
 
 
+show create table `check`;
+show fields from `check`;
+SELECT /*!40001 SQL_NO_CACHE */ * FROM `check`;
+SELECT * FROM `check`;
+
 </sphinxql>
 </queries>
 

Some files were not shown because too many files changed in this diff