Skip to content

Commit

Permalink
Reorder columns and add javadoc
Browse files Browse the repository at this point in the history
  • Loading branch information
olivrlee committed Aug 22, 2023
1 parent 9492bf6 commit cbb02c6
Show file tree
Hide file tree
Showing 4 changed files with 77 additions and 20 deletions.
10 changes: 5 additions & 5 deletions core/src/main/java/org/apache/calcite/jdbc/CalciteMetaImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -346,21 +346,21 @@ private static ImmutableMap.Builder<DatabaseProperty, Object> addProperty(
"SOURCE_DATA_TYPE",
"IS_AUTOINCREMENT",
"IS_GENERATEDCOLUMN",
"LOOKER_FIELD_ALIAS",
"LOOKER_FIELD_CATEGORY",
"LOOKER_FIELD_DESCRIPTION",
"LOOKER_FIELD_GROUP_VARIANT",
"LOOKER_FIELD_LABEL",
"LOOKER_FIELD_NAME",
"LOOKER_TYPE",
"LOOKER_USE_STRICT_VALUE_FORMAT",
"LOOKER_VIEW_NAME",
"LOOKER_VIEW_LABEL",
"HIDDEN",
"LOOKER_FIELD_GROUP_VARIANT",
"DIMENSION_GROUP",
"LOOKER_FIELD_CATEGORY",
"LOOKER_USE_STRICT_VALUE_FORMAT",
"REQUIRES_REFRESH_ON_SORT",
"SORTABLE",
"VALUE_FORMAT",
"LOOKER_TYPE",
"LOOKER_FIELD_ALIAS",
"TAGS",
"FILTERS");
}
Expand Down
3 changes: 3 additions & 0 deletions core/src/main/java/org/apache/calcite/schema/Table.java
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,9 @@ default HashMap<String, Object> getTableMetadata() {
return map;
}

/**
* Gets Looker Field metadata if available.
*/
default HashMap<String, HashMap<String, Object>> getFieldMetadata() {
HashMap<String, HashMap<String, Object>> map = new HashMap<>();
return map;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -302,21 +302,21 @@ protected static Connection getRemoteConnection() throws SQLException {
.getColumns(null, null, null, null);
final ResultSetMetaData metaData = resultSet.getMetaData();
assertThat(metaData.getColumnCount(), is(41));
assertThat(metaData.getColumnName(25), is("LOOKER_FIELD_DESCRIPTION"));
assertThat(metaData.getColumnName(26), is("LOOKER_FIELD_LABEL"));
assertThat(metaData.getColumnName(27), is("LOOKER_FIELD_NAME"));
assertThat(metaData.getColumnName(28), is("LOOKER_VIEW_NAME"));
assertThat(metaData.getColumnName(29), is("LOOKER_VIEW_LABEL"));
assertThat(metaData.getColumnName(30), is("HIDDEN"));
assertThat(metaData.getColumnName(31), is("LOOKER_FIELD_GROUP_VARIANT"));
assertThat(metaData.getColumnName(32), is("DIMENSION_GROUP"));
assertThat(metaData.getColumnName(33), is("LOOKER_FIELD_CATEGORY"));
assertThat(metaData.getColumnName(34), is("LOOKER_USE_STRICT_VALUE_FORMAT"));
assertThat(metaData.getColumnName(35), is("REQUIRES_REFRESH_ON_SORT"));
assertThat(metaData.getColumnName(36), is("SORTABLE"));
assertThat(metaData.getColumnName(37), is("VALUE_FORMAT"));
assertThat(metaData.getColumnName(38), is("LOOKER_TYPE"));
assertThat(metaData.getColumnName(39), is("LOOKER_FIELD_ALIAS"));
assertThat(metaData.getColumnName(25), is("LOOKER_FIELD_ALIAS"));
assertThat(metaData.getColumnName(26), is("LOOKER_FIELD_CATEGORY"));
assertThat(metaData.getColumnName(27), is("LOOKER_FIELD_DESCRIPTION"));
assertThat(metaData.getColumnName(28), is("LOOKER_FIELD_GROUP_VARIANT"));
assertThat(metaData.getColumnName(29), is("LOOKER_FIELD_LABEL"));
assertThat(metaData.getColumnName(30), is("LOOKER_FIELD_NAME"));
assertThat(metaData.getColumnName(31), is("LOOKER_TYPE"));
assertThat(metaData.getColumnName(32), is("LOOKER_USE_STRICT_VALUE_FORMAT"));
assertThat(metaData.getColumnName(33), is("LOOKER_VIEW_NAME"));
assertThat(metaData.getColumnName(34), is("LOOKER_VIEW_LABEL"));
assertThat(metaData.getColumnName(35), is("HIDDEN"));
assertThat(metaData.getColumnName(36), is("DIMENSION_GROUP"));
assertThat(metaData.getColumnName(37), is("REQUIRES_REFRESH_ON_SORT"));
assertThat(metaData.getColumnName(38), is("SORTABLE"));
assertThat(metaData.getColumnName(39), is("VALUE_FORMAT"));
assertThat(metaData.getColumnName(40), is("TAGS"));
assertThat(metaData.getColumnName(41), is("FILTERS"));
resultSet.close();
Expand Down
54 changes: 54 additions & 0 deletions sqlline_edited
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
#!/bin/bash
# sqlline - Script to launch SQL shell
#
# 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.
#
# Example:
# $ ./sqlline
# sqlline> !connect jdbc:calcite: admin admin

# The script updates the classpath on each execution,
# You might use CACHE_SQLLINE_CLASSPATH=Y environment variable to cache it
# To build classpath jar manually use ./gradlew buildSqllineClasspath

# Deduce whether we are running cygwin
case $(uname -s) in
(CYGWIN*) cygwin=true;;
(*) cygwin=;;
esac

# readlink in macOS resolves only links, and it returns empty results if the path points to a file
root=$0
if [[ -L "$root" ]]; then
root=$(readlink "$root")
fi
root=$(cd "$(dirname "$root")"; pwd)

CP=$root/build/libs/sqllineClasspath.jar

if [ "x$CACHE_SQLLINE_CLASSPATH" != "xY" ] || [ ! -f "$CP" ]; then
$root/gradlew --console plain -q :buildSqllineClasspath
fi

VM_OPTS=
if [ "$cygwin" ]; then
# Work around https://github.com/jline/jline2/issues/62
VM_OPTS=-Djline.terminal=jline.UnixTerminal
fi

export JAVA_OPTS=-Djavax.xml.parsers.DocumentBuilderFactory=com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl

exec java -Xmx1g $VM_OPTS $JAVA_OPTS -jar "/usr/local/google/home/oliverlee/.m2/repository/sqlline/sqlline/1.13.0-oliver-SNAPSHOT/sqlline-1.13.0-oliver-SNAPSHOT-jar-with-dependencies.jar" "$@"

0 comments on commit cbb02c6

Please sign in to comment.