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

GRIFFIN-164 GRIFFIN-186 GRIFFIN-187: Profiling Re-factor + Regex/Empty String Support #381

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,25 @@ case class LikeExpr(head: Expr, is: Boolean, value: Expr) extends LogicalExpr {
}
}

case class RLikeExpr(head: Expr, is: Boolean, value: Expr) extends LogicalExpr {

addChildren(head :: value :: Nil)

def desc: String = {
val notStr = if (is) "" else " NOT"
s"${head.desc}${notStr} RLIKE ${value.desc}"
}
def coalesceDesc: String = {
val notStr = if (is) "" else " NOT"
s"${head.coalesceDesc}${notStr} RLIKE ${value.coalesceDesc}"
}

override def map(func: (Expr) => Expr): RLikeExpr = {
RLikeExpr(func(head), is, func(value))
}
}


case class IsNullExpr(head: Expr, is: Boolean) extends LogicalExpr {

addChild(head)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ trait BasicParser extends JavaTokenParsers with Serializable {
* <between-expr> ::= <math-expr> [<not>]? <between> (<math-expr> <and> <math-expr> | <range-expr>)
* <range-expr> ::= "(" [<math-expr>]? [, <math-expr>]+ ")"
* <like-expr> ::= <math-expr> [<not>]? <like> <math-expr>
* <rlike-expr> ::= <math-expr> [<not>]? <rlike> <math-expr>
* <is-null-expr> ::= <math-expr> <is> [<not>]? <null>
* <is-nan-expr> ::= <math-expr> <is> [<not>]? <nan>
*
Expand Down Expand Up @@ -131,6 +132,7 @@ trait BasicParser extends JavaTokenParsers with Serializable {
val AND_ONLY: Parser[String] = """(?i)and\s""".r
val IS: Parser[String] = """(?i)is\s""".r
val LIKE: Parser[String] = """(?i)like\s""".r
val RLIKE: Parser[String] = """(?i)rlike\s""".r
val COMPARE: Parser[String] = "=" | "!=" | "<>" | "<=" | ">=" | "<" | ">"
val LOGICAL_UNARY: Parser[String] = NOT
val LOGICAL_BINARIES: Seq[Parser[String]] = Seq((COMPARE), (AND), (OR))
Expand Down Expand Up @@ -276,6 +278,7 @@ trait BasicParser extends JavaTokenParsers with Serializable {
* <between-expr> ::= <math-expr> [<not>]? <between> (<math-expr> <and> <math-expr> | <range-expr>)
* <range-expr> ::= "(" [<math-expr>]? [, <math-expr>]+ ")"
* <like-expr> ::= <math-expr> [<not>]? <like> <math-expr>
* <rlike-expr> ::= <math-expr> [<not>]? <rlike> <math-expr>
* <is-null-expr> ::= <math-expr> <is> [<not>]? <null>
* <is-nan-expr> ::= <math-expr> <is> [<not>]? <nan>
*
Expand All @@ -296,14 +299,17 @@ trait BasicParser extends JavaTokenParsers with Serializable {
def likeExpr: Parser[LogicalExpr] = mathExpression ~ opt(NOT) ~ LIKE ~ mathExpression ^^ {
case head ~ notOpt ~ _ ~ value => LikeExpr(head, notOpt.isEmpty, value)
}
def rlikeExpr: Parser[LogicalExpr] = mathExpression ~ opt(NOT) ~ RLIKE ~ mathExpression ^^ {
case head ~ notOpt ~ _ ~ value => RLikeExpr(head, notOpt.isEmpty, value)
}
def isNullExpr: Parser[LogicalExpr] = mathExpression ~ IS ~ opt(NOT) ~ NULL ^^ {
case head ~ _ ~ notOpt ~ _ => IsNullExpr(head, notOpt.isEmpty)
}
def isNanExpr: Parser[LogicalExpr] = mathExpression ~ IS ~ opt(NOT) ~ NAN ^^ {
case head ~ _ ~ notOpt ~ _ => IsNanExpr(head, notOpt.isEmpty)
}

def logicalFactor: Parser[LogicalExpr] = (inExpr | betweenExpr | likeExpr | isNullExpr | isNanExpr | mathExpression) ^^ {
def logicalFactor: Parser[LogicalExpr] = (inExpr | betweenExpr | likeExpr | rlikeExpr | isNullExpr | isNanExpr | mathExpression) ^^ {
LogicalFactorExpr(_, false, None)
} | LBR ~ logicalExpression ~ RBR ~ opt(asAlias) ^^ {
case _ ~ expr ~ _ ~ aliasOpt => LogicalFactorExpr(expr, true, aliasOpt)
Expand Down
10 changes: 10 additions & 0 deletions ui/angular/src/app/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,11 @@ import { DataassetComponent } from './dataasset/dataasset.component';
import { BatchComponent } from './job/create-job/batch/batch.component';
import { AcComponent} from './measure/create-measure/ac/ac.component';
import { PrComponent } from './measure/create-measure/pr/pr.component';
import { PrStep1Component } from './measure/create-measure/pr/step1/step1.component';
import { PrStep2Component } from './measure/create-measure/pr/step2/step2.component';
import { PrStep3Component } from './measure/create-measure/pr/step3/step3.component';
import { PrStep4Component } from './measure/create-measure/pr/step4/step4.component';
import { PrConfirmModal } from './measure/create-measure/pr/confirmModal/confirmModal.component';
import { PubComponent } from './measure/create-measure/pub/pub.component';
import { LoginComponent } from './login/login.component';
import { AngularMultiSelectModule } from 'angular2-multiselect-dropdown/angular2-multiselect-dropdown';
Expand Down Expand Up @@ -151,6 +156,11 @@ const appRoutes: Routes = [
BatchComponent,
AcComponent,
PrComponent,
PrStep1Component,
PrStep2Component,
PrStep3Component,
PrStep4Component,
PrConfirmModal,
PubComponent,
LoginComponent,
RuleComponent,
Expand Down
12 changes: 11 additions & 1 deletion ui/angular/src/app/measure/create-measure/ac/ac.component.css
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,16 @@ under the License.
@import url('../../../../../node_modules/angular2-toaster/toaster.css');
@import url('../../measure.component.css');

div.formStep {
min-height: 65vh;
margin-left: 30px;
margin-right: 30px;
}

h5.over-title {
margin-left: 30px;
}

div.tree div.tree-children::before,
div.tree::before {
content: "";
Expand Down Expand Up @@ -117,4 +127,4 @@ div.tree>treenode>div::before {

div.tree>treenode>div>.node-wrapper>treenodeexpander>.toggle-children-wrapper {
left: 22px
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,7 @@ KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
*/

label.control-label {
margin-top: 7px;
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
</div>
</div>
</div>
<div class="col-md-12 col-lg-12 col-sm-12">
<div class="col-md-12 col-lg-12 col-sm-12" style="margin-top:10px;">
<div class="form-group">
<label class="col-md-2 col-lg-2 col-sm-2 control-label" title="Your minimum partition size">
Partition Size:
Expand All @@ -41,7 +41,7 @@
</div>
</div>
</div>
<div class="col-md-12 col-lg-12 col-sm-12">
<div class="col-md-12 col-lg-12 col-sm-12" style="margin-top:10px;">
<div class="form-group">
<label class="col-md-2 col-lg-2 col-sm-2 control-label">
Time Zone:
Expand All @@ -53,7 +53,7 @@
</div>
</div>
</div>
<div class="col-md-12 col-lg-12 col-sm-12" style="height: 30px;">
<div class="col-md-12 col-lg-12 col-sm-12" style="margin-top: 30px; height: 30px;">
<div class="form-group">
<input style="margin-left:15px" type="checkbox" [checked]="needpath" (change)="needpath=!needpath;upward()">
<label>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/*
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
*/

.viewrule-content {
border: 1px solid #fff;
border-radius: 4px;
padding: 10px;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<div class="modal-dialog modal-xg modal-lg">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" (click)="hideModal()">&times;</button>
<h4 class="modal-title">Create measure with the below information?</h4>
</div>
<div class="modal-body">
<div class="container-fluid" id="viewruleContent" style="overflow:auto;">
<div class="row">
<h5 class="over-title margin-bottom-15">Basic information</h5>
</div>
<div class="row">
<div class="col-lg-12 col-md-12 col-sm-12">
<div id="viewrule-definition" class="viewrule-content">
<div class="row">
<label class="col-md-4 col-lg-4 col-sm-4">
Measure Name:
</label>
<div class="col-md-8 col-lg-8 col-sm-8 ">
{{step4.prName}}
</div>
</div>
<div class="row">
<label class="col-md-4 col-lg-4 col-sm-4">
Measure Description:
</label>
<div class="col-md-8 col-lg-8 col-sm-8 ">
{{step4.desc}}
</div>
</div>
<div class="row">
<label class="col-md-4 col-lg-4 col-sm-4">
Measure Type:
</label>
<div class="col-md-8 col-lg-8 col-sm-8 ">
{{step4.type}}
</div>
</div>
<div class="row">
<label class="col-md-4 col-lg-4 col-sm-4">
DataSource:
</label>
<div class="col-md-8 col-lg-8 col-sm-8">
{{step1.currentDB}}.{{step1.currentTable}}
</div>
</div>
<div class="row" *ngIf="step3.size">
<label class="col-md-4 col-lg-4 col-sm-4">
Source Partition Size:
</label>
<div class="col-md-8 col-lg-8 col-sm-8">
{{step3.size}}
</div>
</div>
<div class="row">
<label class="col-md-4 col-lg-4 col-sm-4">
Source Time Zone:
</label>
<div class="col-md-8 col-lg-8 col-sm-8">
{{step3.timezone}}
</div>
</div>
<div class="row" *ngIf="step3.config['where']">
<label class="col-md-4 col-lg-4 col-sm-4">
Source Where (Parititon):
</label>
<div class="col-md-8 col-lg-8 col-sm-8">
{{step3.config['where']}}
</div>
</div>
<div class="row" *ngIf="step3.config['whereCriteria']">
<label class="col-md-4 col-lg-4 col-sm-4">
Source Where (Criteria):
</label>
<div class="col-md-8 col-lg-8 col-sm-8">
{{step3.config['whereCriteria']}}
</div>
</div>
<div class="row" *ngIf="step3.needpath && step3.path">
<label class="col-md-4 col-lg-4 col-sm-4">
Source Path:
</label>
<div class="col-md-8 col-lg-8 col-sm-8">
{{step3.path}}
</div>
</div>
<div class="row">
<label class="col-md-4 col-lg-4 col-sm-4">
Owner:
</label>
<div class="col-md-8 col-lg-8 col-sm-8">
{{step4.owner}}
</div>
</div>
</div>
</div>
</div>
<h5 class="row">Rules</h5>
<div class="row" *ngFor="let index of step4.noderule;">
&nbsp;&nbsp;&nbsp;&nbsp;{{index.name}}&nbsp;:&nbsp;{{index.infos}}
</div>
<br/>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" (click)="hideModal()">Cancel</button>
<button type="button" id="save" class="btn btn-primary" (click)="saveModal()">Save</button>
</div>
</div>
</div>
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
/*
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
*/
import { async, ComponentFixture, TestBed } from '@angular/core/testing';

import { PrConfirmModal } from './confirmModal.component';

describe('PrConfirmModalComponent', () => {
let component: PrConfirmModal;
let fixture: ComponentFixture<PrConfirmModal>;

beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ PrConfirmModal ]
})
.compileComponents();
}));

beforeEach(() => {
fixture = TestBed.createComponent(PrConfirmModal);
component = fixture.componentInstance;
fixture.detectChanges();
});

it('should be created', () => {
expect(component).toBeTruthy();
});
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
/*
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
*/
import {Component, EventEmitter, Input, Output} from "@angular/core";
import {ProfilingStep1, ProfilingStep2, ProfilingStep3, ProfilingStep4} from "../pr.component";

@Component({
selector: "app-pr-confirm-modal",
templateUrl: "./confirmModal.component.html",
styleUrls: ["./confirmModal.component.css"]
})
export class PrConfirmModal {

@Input() step1: ProfilingStep1;
@Input() step2: ProfilingStep2;
@Input() step3: ProfilingStep3;
@Input() step4: ProfilingStep4;

@Output() hide: EventEmitter<Object> = new EventEmitter<Object>();
@Output() saveMeasure: EventEmitter<Object> = new EventEmitter<Object>();

constructor() {}

hideModal() {
this.hide.emit();
}

saveModal() {
this.saveMeasure.emit()
}
}