@@ -192,4 +192,45 @@ public void testTableWithMultipleWildcards() {
192192 );
193193 });
194194 }
195+
196+ @ Test
197+ @ DisabledIfSystemProperty (
198+ named = "skipSparkTest" ,
199+ matches = "true"
200+ )
201+ public void testTableWithOnlyWildcard () {
202+ streamingTestUtil .performDPLTest ("index=index_A | table *" , testFile , ds -> {
203+ final StructType expectedSchema = new StructType (new StructField [] {
204+ new StructField ("_time" , DataTypes .TimestampType , true , new MetadataBuilder ().build ()),
205+ new StructField ("id" , DataTypes .LongType , true , new MetadataBuilder ().build ()),
206+ new StructField ("_raw" , DataTypes .StringType , true , new MetadataBuilder ().build ()),
207+ new StructField ("index" , DataTypes .StringType , true , new MetadataBuilder ().build ()),
208+ new StructField ("sourcetype" , DataTypes .StringType , true , new MetadataBuilder ().build ()),
209+ new StructField ("host" , DataTypes .StringType , true , new MetadataBuilder ().build ()),
210+ new StructField ("source" , DataTypes .StringType , true , new MetadataBuilder ().build ()),
211+ new StructField ("partition" , DataTypes .StringType , true , new MetadataBuilder ().build ()),
212+ new StructField ("offset" , DataTypes .LongType , true , new MetadataBuilder ().build ())
213+ });
214+ Assertions
215+ .assertEquals (
216+ expectedSchema , ds .schema (),
217+ "Batch handler dataset contained an unexpected column arrangement !"
218+ );
219+ });
220+ }
221+
222+ @ Test
223+ @ DisabledIfSystemProperty (
224+ named = "skipSparkTest" ,
225+ matches = "true"
226+ )
227+ public void testTableWithoutFieldNames () {
228+ String q = "index=index_A | table" ;
229+ String e = "table command is missing field names, it requires at least one valid field name." ;
230+ IllegalStateException exception = this .streamingTestUtil
231+ .performThrowingDPLTest (IllegalStateException .class , q , this .testFile , res -> {
232+ });
233+
234+ Assertions .assertEquals (e , exception .getMessage ());
235+ }
195236}
0 commit comments