Skip to content
Open
Show file tree
Hide file tree
Changes from all 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
8 changes: 4 additions & 4 deletions common/config/src/main/resources/storage.conf
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@ storage {
uri-without-scheme = "localhost:5432/texera_iceberg_catalog"
uri-without-scheme = ${?STORAGE_ICEBERG_CATALOG_POSTGRES_URI_WITHOUT_SCHEME}

username = "texera"
username = "anish"
username = ${?STORAGE_ICEBERG_CATALOG_POSTGRES_USERNAME}

password = "password"
password = ""
password = ${?STORAGE_ICEBERG_CATALOG_POSTGRES_PASSWORD}
}
}
Expand Down Expand Up @@ -131,10 +131,10 @@ storage {
url-for-test-cases = "jdbc:postgresql://localhost:5432/texera_db_for_test_cases?currentSchema=texera_db,public"
url-for-test-cases = ${?STORAGE_JDBC_URL_FOR_TEST_CASES}

username = "postgres"
username = "anish"
username = ${?STORAGE_JDBC_USERNAME}

password = "postgres"
password = ""
password = ${?STORAGE_JDBC_PASSWORD}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ import org.apache.texera.amber.operator.visualization.scatter3DChart.Scatter3dCh
import org.apache.texera.amber.operator.visualization.scatterplot.ScatterplotOpDesc
import org.apache.texera.amber.operator.visualization.tablesChart.TablesPlotOpDesc
import org.apache.texera.amber.operator.visualization.ternaryPlot.TernaryPlotOpDesc
import org.apache.texera.amber.operator.visualization.polarChart.PolarChartOpDesc
import org.apache.texera.amber.operator.visualization.timeSeriesplot.TimeSeriesOpDesc
import org.apache.texera.amber.operator.visualization.treeplot.TreePlotOpDesc
import org.apache.texera.amber.operator.visualization.urlviz.UrlVizOpDesc
Expand Down Expand Up @@ -186,6 +187,7 @@ trait StateTransferFunc
new Type(value = classOf[LineChartOpDesc], name = "LineChart"),
new Type(value = classOf[WaterfallChartOpDesc], name = "WaterfallChart"),
new Type(value = classOf[BarChartOpDesc], name = "BarChart"),
new Type(value = classOf[PolarChartOpDesc], name = "PolarChart"),
new Type(value = classOf[RangeSliderOpDesc], name = "RangeSlider"),
new Type(value = classOf[PieChartOpDesc], name = "PieChart"),
new Type(value = classOf[QuiverPlotOpDesc], name = "QuiverPlot"),
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
/*
* 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.
*/

package org.apache.texera.amber.operator.visualization.polarChart

import com.fasterxml.jackson.annotation.{JsonProperty, JsonPropertyDescription}
import com.kjetland.jackson.jsonSchema.annotations.JsonSchemaTitle
import org.apache.texera.amber.core.tuple.{AttributeType, Schema}
import org.apache.texera.amber.core.workflow.OutputPort.OutputMode
import org.apache.texera.amber.core.workflow.{InputPort, OutputPort, PortIdentity}
import org.apache.texera.amber.operator.PythonOperatorDescriptor
import org.apache.texera.amber.operator.metadata.annotations.AutofillAttributeName
import org.apache.texera.amber.operator.metadata.{OperatorGroupConstants, OperatorInfo}

class PolarChartOpDesc extends PythonOperatorDescriptor {

@JsonProperty(value = "r", required = true)
@JsonSchemaTitle("r")
@JsonPropertyDescription("The column name for radial values (must be numeric)")
@AutofillAttributeName
var r: String = ""

@JsonProperty(value = "theta", required = true)
@JsonSchemaTitle("theta")
@JsonPropertyDescription("The column name for angular values (must be numeric)")
@AutofillAttributeName
var theta: String = ""

override def getOutputSchemas(
inputSchemas: Map[PortIdentity, Schema]
): Map[PortIdentity, Schema] = {
val outputSchema = Schema()
.add("html-content", AttributeType.STRING)

Map(operatorInfo.outputPorts.head.id -> outputSchema)
}

override def operatorInfo: OperatorInfo =
OperatorInfo(
"Polar Chart",
"Displays data points in a polar scatter plot",
OperatorGroupConstants.VISUALIZATION_SCIENTIFIC_GROUP,
inputPorts = List(InputPort()),
outputPorts = List(OutputPort(mode = OutputMode.SINGLE_SNAPSHOT))
)

override def generatePythonCode(): String = {
s"""from pytexera import *
|import plotly.graph_objects as go
|import plotly.io as pio
|import numpy as np
|
|class ProcessTableOperator(UDFTableOperator):
|
| @overrides
| def process_table(self, table: Table, port: int) -> Iterator[Optional[TableLike]]:
|
| if table is None or table.empty:
| yield {'html-content': '<h3>No data available for Polar Chart</h3>'}
| return
|
| if '${r}' not in table.columns or '${theta}' not in table.columns:
| yield {'html-content': '<h3>Selected columns not found in input table</h3>'}
| return
|
| if not np.issubdtype(table['${r}'].dtype, np.number) or not np.issubdtype(table['${theta}'].dtype, np.number):
| yield {'html-content': '<h3>Selected columns must be numeric</h3>'}
| return
|
| r_vals = table['${r}'].values
| theta_vals = table['${theta}'].values
|
| fig = go.Figure(data=go.Scatterpolargl(
| r=r_vals,
| theta=theta_vals,
| mode='markers',
| marker=dict(
| size=10,
| opacity=0.7,
| line=dict(color='white')
| )
| ))
|
| fig.update_layout(
| title='Polar Chart',
| showlegend=False
| )
|
| html = pio.to_html(fig, include_plotlyjs='cdn', full_html=False)
| yield {'html-content': html}
|""".stripMargin
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.