Skip to main content

vertica

  • June 13, 2016
  • 6 replies
  • 24 views

Jack123

Hi, 

I am using the MATCH for row based pattern extraction. I have to collate the output of different patterns that are present in the log file. I followed the example given in the documentation. I have following question:

 

I have two patterns to search uniqely from table suppose "AAAB" and "BABA". I am able to use MATCH to get "AAAB" pattern, now how should I proceed to get "BABA" pattern in the same query. I tried to do seprate query for both the patterns and tried to join the output  but  I was not able to perform it. Could you please provide pointers.

 

Regards,

Jack

 

 

6 replies

eli_revach
Forum|alt.badge.img+2
  • Participating Frequently
  • June 13, 2016

Hi 

Please post your MATCH expression that MATCH  one pattern 

Thanks 


Jack123
  • Author
  • New Participant
  • June 13, 2016

select EquipmentNumber,EventTimeStamp,EventId,AdditionalInfo, event_name()Event_1,pattern_id() as Pattern_1,match_id() as Match_1
from
T1
MATCH (
PARTITION By EquipmentNumber
Order by EventTimeStamp
DEFINE
E1 AS EventId LIKE '%AMBNM%',
E2  As EventId LIKE '%ABNXC%' and REGEXP_LIKE(AdditionalInfo ,'.*Invalid content.*')
PATTERN P as (E1 E1 E2 +?)
ROWS MATCH FIRST EVENT )


Jack123
  • Author
  • New Participant
  • June 13, 2016

I can get the first pattern using above query. How can I get the second pattern and merge both the results? Assuming I have one more pattern from the data with say E1E1 E1 E2 E1. I want independent count of each of these patterns and Merge the results both say the Pattern1 - (25) Times and Pattern2 - (12) times as output


eli_revach
Forum|alt.badge.img+2
  • Participating Frequently
  • June 13, 2016

Hi

You should change the PATTERN part to - >

 

PATTERN P as (E1*  E2* )

 

 

I hope you will find it helpful

 

Thanks 


Jack123
  • Author
  • New Participant
  • June 14, 2016

Hi, 

Thanks for the reply.

 

If I use the pattern mentioned by you. I wont get the distinct count of both the patterns. I want to get the count of two different patterns for the query.  

 

Thanks.


eli_revach
Forum|alt.badge.img+2
  • Participating Frequently
  • June 14, 2016

Hi

I am not sure i understand  , please send output of your query based on my input and what is the one you looking for .

 

Thank